Commit b3547998 authored by Giuseppe Tropea's avatar Giuseppe Tropea
Browse files

hashing of description

parent fc9a7135
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
import json
import json
import requests
import requests
import tlsh


# Function translations
# Function translations
def is_a_behaviour_header(type, value):
def is_a_behaviour_header(type, value):
@@ -100,8 +101,9 @@ while current_index < number_of_blocks:
            testcasemetadata['progressive_subid'] += 1
            testcasemetadata['progressive_subid'] += 1
            testcasemetadata['tp_id_fromspec'] = f"{str(testcasemetadata['seqnumber']).zfill(3)}_{str(testcasemetadata['progressive_subid']).zfill(2)}"
            testcasemetadata['tp_id_fromspec'] = f"{str(testcasemetadata['seqnumber']).zfill(3)}_{str(testcasemetadata['progressive_subid']).zfill(2)}"
            testcasemetadata['description'] = " ".join(el['c'] for el in value if el['t'] == "Str")
            testcasemetadata['description'] = " ".join(el['c'] for el in value if el['t'] == "Str")
            testcasemetadata['hash_description'] = tlsh.hash(testcasemetadata['description'].encode())
            # push a deep copy of the object into the array
            # push a deep copy of the object into the array
            testcases_fromspec.append(testcasemetadata.copy())
            testcases_fromspec.append(json.loads(json.dumps(testcasemetadata)))
            print(f"..collecting Block {current_index} of {len(value)} in {testcasemetadata['tp_id_fromspec']}")
            print(f"..collecting Block {current_index} of {len(value)} in {testcasemetadata['tp_id_fromspec']}")
            # [Add logging to file or other operations here]
            # [Add logging to file or other operations here]
        else:
        else: