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