diff options
| author | 2019-08-13 13:48:03 +0100 | |
|---|---|---|
| committer | 2019-08-13 13:48:03 +0100 | |
| commit | 03c7e8f0665c1036ece49155340697aa3b2d107d (patch) | |
| tree | 55cb3283e4c27389b2b0a75107feef5be66243c9 /modules/ip_addresses.py | |
| parent | "!yt" without args should get .message from BufferLine (diff) | |
return matching string from buffer.find() as most uses were redundantly regexing
Diffstat (limited to 'modules/ip_addresses.py')
| -rw-r--r-- | modules/ip_addresses.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/ip_addresses.py b/modules/ip_addresses.py index 1f4fd6d7..07b1a463 100644 --- a/modules/ip_addresses.py +++ b/modules/ip_addresses.py @@ -7,7 +7,7 @@ import dns.resolver URL_GEOIP = "http://ip-api.com/json/%s" REGEX_IPv6 = r"(?:(?:[a-f0-9]{1,4}:){2,}|[a-f0-9:]*::)[a-f0-9:]*" REGEX_IPv4 = r"(?:\d{1,3}\.){3}\d{1,3}" -REGEX_IP = re.compile("(%s)|(%s)" % (REGEX_IPv4, REGEX_IPv6), re.I) +REGEX_IP = re.compile("%s|%s" % (REGEX_IPv4, REGEX_IPv6), re.I) class DnsSetting(utils.Setting): def parse(self, value: str) -> typing.Any: @@ -109,8 +109,7 @@ class Module(ModuleManager.BaseModule): if not ip: line = event["target"].buffer.find(REGEX_IP) if line: - match = REGEX_IP.search(line.message) - ip = match.group(1) or match.group(2) + ip = line.match if not ip: raise utils.EventError("No IP provided") |
