fix: [Yara Tracker] catch yara timeout

pull/534/head
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
1 changed files with 6 additions and 4 deletions

View File

@ -71,10 +71,12 @@ if __name__ == "__main__":
item_id = p.get_from_set()
if item_id is not None:
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)
if yara_match:
print(f'{item_id}: {yara_match}')
except yara.TimeoutError as e:
print(f'{item_id}: yara scanning timed out')
else:
time.sleep(5)