diff --git a/autorecon/main.py b/autorecon/main.py index c5abcb4..5de2cdf 100644 --- a/autorecon/main.py +++ b/autorecon/main.py @@ -509,7 +509,7 @@ async def scan_target(target): target.reportdir = reportdir - pending = [] + pending = set() heartbeat = asyncio.create_task(start_heartbeat(target, period=config['heartbeat'])) @@ -532,7 +532,7 @@ async def scan_target(target): services.append(service) if services: - pending.append(asyncio.create_task(asyncio.sleep(0))) + pending.add(asyncio.create_task(asyncio.sleep(0))) else: error('No services were defined. Please check your service syntax: [tcp|udp]///[secure|insecure]') heartbeat.cancel() @@ -568,7 +568,7 @@ async def scan_target(target): if matching_tags and not excluded_tags: target.scans['ports'][plugin.slug] = {'plugin':plugin, 'commands':[]} - pending.append(asyncio.create_task(port_scan(plugin, target))) + pending.add(asyncio.create_task(port_scan(plugin, target))) async with autorecon.lock: autorecon.scanning_targets.append(target) @@ -1549,10 +1549,10 @@ async def run(): if not config['disable_keyboard_control']: terminal_settings = termios.tcgetattr(sys.stdin.fileno()) - pending = [] + pending = set() i = 0 while autorecon.pending_targets: - pending.append(asyncio.create_task(scan_target(autorecon.pending_targets.pop(0)))) + pending.add(asyncio.create_task(scan_target(autorecon.pending_targets.pop(0)))) i+=1 if i >= num_initial_targets: break