Fixed one of the small display bug in DUplicate_ssdeep_v2 (was displaying [tlsh, tlsh] instead of simply tlsh)

This commit is contained in:
Mokaddem 2016-08-09 15:06:55 +02:00
parent a4595010c0
commit 943016d6ca
2 changed files with 7 additions and 2 deletions

View file

@ -117,7 +117,11 @@ if __name__ == "__main__":
for hash_type, paste_hash in paste_hashes.iteritems(): for hash_type, paste_hash in paste_hashes.iteritems():
for dico_hash in curr_dico_redis.smembers('HASHS_'+hash_type): for dico_hash in curr_dico_redis.smembers('HASHS_'+hash_type):
try: try:
percent = 100-ssdeep.compare(dico_hash, paste_hash) if hash_type == 'ssdeep' else tlsh.diffxlen(dico_hash, paste_hash) if hash_type == 'ssdeep':
percent = 100-ssdeep.compare(dico_hash, paste_hash)
else:
percent = tlsh.diffxlen(dico_hash, paste_hash)
threshold_duplicate = threshold_set[hash_type] threshold_duplicate = threshold_set[hash_type]
if percent < threshold_duplicate: if percent < threshold_duplicate:
percent = 100 - percent if hash_type == 'ssdeep' else percent #recovert the correct percent value for ssdeep percent = 100 - percent if hash_type == 'ssdeep' else percent #recovert the correct percent value for ssdeep

View file

@ -101,6 +101,7 @@ def parseStringToList2(the_string):
for i in range(1, len(tab_str)-2): for i in range(1, len(tab_str)-2):
tab_str[i] = '['+tab_str[i]+']' tab_str[i] = '['+tab_str[i]+']'
res.append(parseStringToList(tab_str[i])) res.append(parseStringToList(tab_str[i]))
if len(tab_str) > 1:
res.append(parseStringToList(tab_str[len(tab_str)-1])) res.append(parseStringToList(tab_str[len(tab_str)-1]))
return res return res