Merge pull request #338 from indrajitr/hostmatch-fix

Tighten regex rule to discard IP address as hostname
This commit is contained in:
Steven Black
2017-06-21 10:33:59 -04:00
committed by GitHub
+2 -1
View File
@@ -501,7 +501,8 @@ def normalize_rule(rule):
The rule string with spelling and spacing reformatted.
"""
result = re.search(r'^[ \t]*(\d+\.\d+\.\d+\.\d+)\s+([\w\.-]+)(.*)', rule)
result = re.search(r'^\s*(\d{1,3}\.){3}\d{1,3}\s+([\w\.-]+[a-zA-Z])(.*)',
rule)
if result:
hostname, suffix = result.group(2, 3)