diff --git a/bin/IPAddress.py b/bin/IPAddress.py index f03ee8b3..e45a4ce6 100755 --- a/bin/IPAddress.py +++ b/bin/IPAddress.py @@ -6,7 +6,7 @@ This module is consuming the global channel. -It first performs a regex to find IP addresses and then matches those IPs to +It first performs a regex to find IP addresses and then matches those IPs to some configured ip ranges. The list of IP ranges are expected to be in CIDR format (e.g. 192.168.0.0/16) @@ -16,6 +16,7 @@ import time import re +import sys from pubsublogger import publisher from packages import Paste from Helper import Process @@ -60,8 +61,12 @@ def search_ip(message): p = Process(config_section) ip_networks = [] - for network in p.config.get("IP", "networks").split(","): - ip_networks.append(IPv4Network(network)) + try: + for network in p.config.get("IP", "networks").split(","): + ip_networks.append(IPv4Network(network)) + except: + print('Please provide a list of valid IP addresses') + sys.exit(0) # Sent to the logging a description of the module @@ -78,4 +83,3 @@ def search_ip(message): # Do something with the message from the queue search_ip(message) -