coherent usage of sets

This commit is contained in:
MrMatch246 2025-08-06 11:43:19 +02:00
parent ca77242c86
commit 8bfedde7b3
1 changed files with 5 additions and 5 deletions

View File

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