From 1c991aa792acce111ca054dbe7d2dc2852feb3e6 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 23 Feb 2021 15:16:29 +0100 Subject: [PATCH] chg: [IPAddress] Add Debug + Check if option is empty --- bin/IPAddress.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/IPAddress.py b/bin/IPAddress.py index e2ed59cf..4ec11647 100755 --- a/bin/IPAddress.py +++ b/bin/IPAddress.py @@ -62,9 +62,14 @@ if __name__ == '__main__': p = Process(config_section) ip_networks = [] + networks = p.config.get("IP", "networks") + if not networks: + print('No IP ranges provided') + sys.exit(0) try: - for network in p.config.get("IP", "networks").split(","): + for network in networks.split(","): ip_networks.append(IPv4Network(network)) + print(f'IP Range: {network}') except: print('Please provide a list of valid IP addresses') sys.exit(0)