Merge pull request #12 from codingo/ports-par

Added in dash (-) notation for ports
This commit is contained in:
Michael Skelton
2019-01-06 22:41:08 +10:00
committed by GitHub

View File

@@ -64,7 +64,14 @@ class InputHelper(object):
final_commands = set() final_commands = set()
output = OutputHelper(arguments) output = OutputHelper(arguments)
ports = arguments.port.split(",") 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 # process targets first
if arguments.target: if arguments.target:
@@ -108,7 +115,7 @@ class InputHelper(object):
if arguments.output: if arguments.output:
command = str(command).replace("_output_", arguments.output) command = str(command).replace("_output_", arguments.output)
if arguments.port: if arguments.port:
command = str(command).replace("_port_", port) command = str(command).replace("_port_", str(port))
if arguments.realport: if arguments.realport:
command = str(command).replace("_realport_", arguments.realport) command = str(command).replace("_realport_", arguments.realport)
final_commands.add(command) final_commands.add(command)