mirror of https://github.com/CIRCL/AIL-framework
fix: [IPAdress module] empty queue if no IP ranges provided
parent
b64c70e0cd
commit
c02b9f2a81
|
@ -43,14 +43,15 @@ class IPAddress(AbstractModule):
|
||||||
networks = config_loader.get_config_str("IP", "networks")
|
networks = config_loader.get_config_str("IP", "networks")
|
||||||
if not networks:
|
if not networks:
|
||||||
print('No IP ranges provided')
|
print('No IP ranges provided')
|
||||||
sys.exit(0)
|
# sys.exit(0)
|
||||||
try:
|
else:
|
||||||
for network in networks.split(","):
|
try:
|
||||||
self.ip_networks.add(IPv4Network(network))
|
for network in networks.split(","):
|
||||||
print(f'IP Range To Search: {network}')
|
self.ip_networks.add(IPv4Network(network))
|
||||||
except:
|
print(f'IP Range To Search: {network}')
|
||||||
print('Please provide a list of valid IP addresses')
|
except:
|
||||||
sys.exit(0)
|
print('Please provide a list of valid IP addresses')
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
self.re_ipv4 = r'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
|
self.re_ipv4 = r'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'
|
||||||
re.compile(self.re_ipv4)
|
re.compile(self.re_ipv4)
|
||||||
|
@ -62,6 +63,9 @@ class IPAddress(AbstractModule):
|
||||||
self.logger.info(f"Module {self.module_name} initialized")
|
self.logger.info(f"Module {self.module_name} initialized")
|
||||||
|
|
||||||
def compute(self, message, r_result=False):
|
def compute(self, message, r_result=False):
|
||||||
|
if not self.ip_networks:
|
||||||
|
return None
|
||||||
|
|
||||||
item = Item(message)
|
item = Item(message)
|
||||||
content = item.get_content()
|
content = item.get_content()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue