Fixed reference bug

This commit is contained in:
codingo
2019-01-06 12:04:53 +10:00
parent 36657b7c0f
commit 950f547008
2 changed files with 13 additions and 0 deletions

View File

@@ -18,16 +18,28 @@ class InputHelper(object):
return arg return arg
@staticmethod
def expand_targets(targets):
# expand CIDR from net addr
# expand comma notation
# return list of unique hosts
return targets
@staticmethod @staticmethod
def process_targets(arguments): def process_targets(arguments):
targets = set() targets = set()
# build list of targets from file/input
if arguments.target: if arguments.target:
targets.add(arguments.target) targets.add(arguments.target)
else: else:
for target in arguments.target_list: for target in arguments.target_list:
targets.add(target.strip()) targets.add(target.strip())
# take list of targets and expand CIDR / comma notation
targets = set(arguments.expand_targets(targets))
return targets return targets
@staticmethod @staticmethod

View File

@@ -58,6 +58,7 @@ class Pool(object):
for thread in threads: for thread in threads:
thread.join() thread.join()
# test harness
if __name__ == "__main__": if __name__ == "__main__":
tasks = ["sleep 1", tasks = ["sleep 1",
"sleep 2", "sleep 2",