From 943016d6ca9eed3654da3a1d8b52b545be66f865 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Tue, 9 Aug 2016 15:06:55 +0200 Subject: [PATCH] Fixed one of the small display bug in DUplicate_ssdeep_v2 (was displaying [tlsh, tlsh] instead of simply tlsh) --- bin/Duplicate_ssdeep_v2.py | 6 +++++- var/www/Flask_server.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/Duplicate_ssdeep_v2.py b/bin/Duplicate_ssdeep_v2.py index 2eedda96..d2efcab3 100755 --- a/bin/Duplicate_ssdeep_v2.py +++ b/bin/Duplicate_ssdeep_v2.py @@ -117,7 +117,11 @@ if __name__ == "__main__": for hash_type, paste_hash in paste_hashes.iteritems(): for dico_hash in curr_dico_redis.smembers('HASHS_'+hash_type): 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] if percent < threshold_duplicate: percent = 100 - percent if hash_type == 'ssdeep' else percent #recovert the correct percent value for ssdeep diff --git a/var/www/Flask_server.py b/var/www/Flask_server.py index 22d407f8..254b3d2d 100755 --- a/var/www/Flask_server.py +++ b/var/www/Flask_server.py @@ -101,7 +101,8 @@ def parseStringToList2(the_string): for i in range(1, len(tab_str)-2): tab_str[i] = '['+tab_str[i]+']' res.append(parseStringToList(tab_str[i])) - res.append(parseStringToList(tab_str[len(tab_str)-1])) + if len(tab_str) > 1: + res.append(parseStringToList(tab_str[len(tab_str)-1])) return res