fix: [Yara Tracker] catch yara timeout

This commit is contained in:
Terrtia 2020-11-24 15:44:11 +01:00
parent 5cc4da2a28
commit d1b4d61ce5
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0

View file

@ -71,10 +71,12 @@ if __name__ == "__main__":
item_id = p.get_from_set() item_id = p.get_from_set()
if item_id is not None: if item_id is not None:
item_content = item_basic.get_item_content(item_id) item_content = item_basic.get_item_content(item_id)
try:
yara_match = rules.match(data=item_content, callback=yara_rules_match, which_callbacks=yara.CALLBACK_MATCHES, timeout=60) yara_match = rules.match(data=item_content, callback=yara_rules_match, which_callbacks=yara.CALLBACK_MATCHES, timeout=60)
if yara_match: if yara_match:
print(f'{item_id}: {yara_match}') print(f'{item_id}: {yara_match}')
except yara.TimeoutError as e:
print(f'{item_id}: yara scanning timed out')
else: else:
time.sleep(5) time.sleep(5)