Skip to content
This repository was archived by the owner on Apr 4, 2024. It is now read-only.

Commit 5781d59

Browse files
author
floyd
committed
Improve fingerprint module so that the confidence rating is based on the best score, not on the number of downloaded files. A file that cannot be downloaded often is a good indicator for fingerprinting
1 parent 402ca8b commit 5781d59

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

UploadScanner.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3204,16 +3204,18 @@ def _fingerping(self, injector):
32043204
confidence = "Tentative"
32053205
print "Fingerping module was able to download", str(number_of_responses), \
32063206
"of", str(len(FingerpingImages.all_images)), "images as PNGs again"
3207-
if number_of_responses < 10:
3208-
# This is guesswork, no point in making an issue, stop here
3209-
print "Fingerping: Could download less than 10 images, not making a fingerping issue"
3210-
return
3211-
elif number_of_responses > 50:
3207+
results, fingerprintScores = f.do_tests(downloads, True)
3208+
text_score, total = f.get_results_table(fingerprintScores)
3209+
highest_score = text_score[-1][1]
3210+
score_percentage = float(highest_score) / total
3211+
3212+
if score_percentage > 0.6:
32123213
confidence = "Certain"
3213-
elif number_of_responses > 40:
3214+
elif score_percentage > 0.85:
32143215
confidence = "Firm"
3215-
results, fingerprintScores = f.do_tests(downloads, True)
3216-
result_table = f.get_results_table(fingerprintScores)
3216+
3217+
result_table = "<br>".join([text + " " + str(score) + "/" + str(total) for text, score in text_score])
3218+
32173219
title = "Fingerping Fingerprinting results"
32183220
desc = "The fingerping tool is able to fingerprint images libraries that modify a set of png files that are " \
32193221
"uploaded. The original project by Dominique Bongard is located at https://github.com/0xcite/fingerping " \
@@ -3231,7 +3233,7 @@ def _fingerping(self, injector):
32313233
"together with the exact version of the image library on the server. Please also make sure " \
32323234
"that the common error case does not apply." \
32333235
"<br><br>{}".format(str(number_of_responses), str(len(FingerpingImages.all_images)),
3234-
result_table.replace("\n", "<br>"), repr(results))
3236+
result_table, repr(results))
32353237
issue = self._create_issue_template(injector.get_brr(), title, desc, confidence, "Information")
32363238
self._add_scan_issue(issue)
32373239

@@ -6755,12 +6757,9 @@ def do_tests(self, image_dict, warn):
67556757

67566758
def get_results_table(self, scores):
67576759
"""Show the fingerprinting result with the most likely library match at the bottom"""
6758-
res = ''
67596760
nb = len(self.all_tests)
6760-
ordered = sorted(scores.iteritems(), key=lambda x: x[1])
6761-
for result in ordered:
6762-
res += '{:20s} {:3d}/{:3d}'.format(result[0], result[1], nb) + "\n"
6763-
return res
6761+
text_score = sorted(scores.iteritems(), key=lambda x: x[1])
6762+
return text_score, nb
67646763
# end modules
67656764

67666765

0 commit comments

Comments
 (0)