Make IP regex neater in modules/ip_addresses.py
This commit is contained in:
parent
64a58fe041
commit
cec97749e5
1 changed files with 3 additions and 4 deletions
|
@ -2,10 +2,9 @@ import re, socket
|
||||||
from src import ModuleManager, utils
|
from src import ModuleManager, utils
|
||||||
|
|
||||||
URL_GEOIP = "http://ip-api.com/json/%s"
|
URL_GEOIP = "http://ip-api.com/json/%s"
|
||||||
REGEX_IP = ("((?:(?:[a-f0-9]{1,4}:){2,}|[a-f0-9:]*::)[a-f0-9:]*)" # ipv6
|
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}"
|
||||||
"((?:\d{1,3}\.){3}\d{1,3})") # ipv4
|
REGEX_IP = re.compile("%s|%s" % (REGEX_IPv4, REGEX_IPv6), re.I)
|
||||||
REGEX_IP = re.compile(REGEX_IP, re.I)
|
|
||||||
|
|
||||||
class Module(ModuleManager.BaseModule):
|
class Module(ModuleManager.BaseModule):
|
||||||
@utils.hook("received.command.dns", min_args=1)
|
@utils.hook("received.command.dns", min_args=1)
|
||||||
|
|
Loading…
Reference in a new issue