From 30e6b71c36868ad6d6200a2303822fc12a91755d Mon Sep 17 00:00:00 2001 From: ProDigySML Date: Thu, 10 Jan 2019 03:02:19 -0800 Subject: [PATCH] Fixed the errors for ports and exclusions --- Interlace/lib/core/input.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Interlace/lib/core/input.py b/Interlace/lib/core/input.py index 1a819bd..1f20e88 100644 --- a/Interlace/lib/core/input.py +++ b/Interlace/lib/core/input.py @@ -66,13 +66,14 @@ class InputHelper(object): final_commands = set() output = OutputHelper(arguments) - if "," in arguments.port: - ports = arguments.port.split(",") - elif "-" in arguments.port: - tmp_ports = arguments.port.split("-") - ports = list(range(int(tmp_ports[0]), int(tmp_ports[1]) + 1)) - else: - ports = [arguments.port] + if arguments.port: + if "," in arguments.port: + ports = arguments.port.split(",") + elif "-" in arguments.port: + tmp_ports = arguments.port.split("-") + ports = list(range(int(tmp_ports[0]), int(tmp_ports[1]) + 1)) + else: + ports = [arguments.port] # process targets first @@ -86,8 +87,9 @@ class InputHelper(object): if arguments.exclusions: exclusions_ranges.add(arguments.exclusions) else: - for exclusion in arguments.exclusions_list: - exclusions_ranges.add(target.strip()) + if arguments.exclusions_list: + for exclusion in arguments.exclusions_list: + exclusions_ranges.add(target.strip()) # removing elements that may have spaces (helpful for easily processing comma notation) for target in ranges: