diff options
| author | 2018-11-15 15:41:55 +0000 | |
|---|---|---|
| committer | 2018-11-15 15:41:55 +0000 | |
| commit | cec97749e5fe889931ca49399f8e1f8368869c78 (patch) | |
| tree | 30e8d660479937202e0e27d453a0eae1759bf4bb /modules/ip_addresses.py | |
| parent | Translate 'synchronize' to 'committed to' in modules/github.py's pull request (diff) | |
| signature | ||
Make IP regex neater in modules/ip_addresses.py
Diffstat (limited to 'modules/ip_addresses.py')
| -rw-r--r-- | modules/ip_addresses.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/ip_addresses.py b/modules/ip_addresses.py index 6441f4b7..1d1e262a 100644 --- a/modules/ip_addresses.py +++ b/modules/ip_addresses.py @@ -2,10 +2,9 @@ import re, socket from src import ModuleManager, utils URL_GEOIP = "http://ip-api.com/json/%s" -REGEX_IP = ("((?:(?:[a-f0-9]{1,4}:){2,}|[a-f0-9:]*::)[a-f0-9:]*)" # ipv6 - "|" - "((?:\d{1,3}\.){3}\d{1,3})") # ipv4 -REGEX_IP = re.compile(REGEX_IP, re.I) +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) class Module(ModuleManager.BaseModule): @utils.hook("received.command.dns", min_args=1) |
