[Netfilter] Skip invalid regex

master
andryyy 2020-08-27 21:13:30 +02:00
parent bf62f31b9e
commit 0884f42379
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
1 changed files with 4 additions and 1 deletions

View File

@ -305,7 +305,10 @@ def watch():
refreshF2bregex()
for rule_id, rule_regex in f2bregex.items():
if item['data'] and item['type'] == 'message':
try:
result = re.search(rule_regex, item['data'])
except re.error:
result = False
if result:
addr = result.group(1)
ip = ipaddress.ip_address(addr)