fix: [Credential] add regex timeout

pull/497/head
Terrtia 2020-05-04 11:11:35 +02:00
parent 52b7f13a6f
commit c3d37f2bbf
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 13 additions and 1 deletions

View File

@ -148,8 +148,20 @@ if __name__ == "__main__":
p.populate_set_out(msg, 'Tags')
#Put in form, count occurences, then send to moduleStats
signal.alarm(max_execution_time)
try:
site_occurence = re.findall(regex_site_for_stats, content)
except TimeoutException:
p.incr_module_timeout_statistic()
err_mess = "Credential: site occurence, processing timeout: {}".format(item_id)
print(err_mess)
publisher.info(err_mess)
site_occurence = []
else:
signal.alarm(0)
creds_sites = {}
site_occurence = re.findall(regex_site_for_stats, content)
for site in site_occurence:
site_domain = site[1:-1]
if site_domain in creds_sites.keys():