Compare commits

...

2 Commits

Author SHA1 Message Date
MrMatch246 ec2283ba45 use of raw strings for regex 2025-08-06 11:43:47 +02:00
MrMatch246 8bfedde7b3 coherent usage of sets 2025-08-06 11:43:19 +02:00
1 changed files with 7 additions and 7 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']))
@ -518,7 +518,7 @@ async def scan_target(target):
forced_services = [x.strip().lower() for x in config['force_services']] forced_services = [x.strip().lower() for x in config['force_services']]
for forced_service in forced_services: for forced_service in forced_services:
match = re.search('(?P<protocol>(tcp|udp))\/(?P<port>\d+)\/(?P<service>[\w\-]+)(\/(?P<secure>secure|insecure))?', forced_service) match = re.search(r'(?P<protocol>(tcp|udp))/(?P<port>\d+)/(?P<service>[\w\-]+)(/(?P<secure>secure|insecure))?', forced_service)
if match: if match:
protocol = match.group('protocol') protocol = match.group('protocol')
if config['proxychains'] and protocol == 'udp': if config['proxychains'] and protocol == 'udp':
@ -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)
@ -1266,7 +1266,7 @@ async def run():
mode = 'udp' mode = 'udp'
port = port.split('U:')[1] port = port.split('U:')[1]
match = re.search('^([0-9]+)\-([0-9]+)$', port) match = re.search(r'^([0-9]+)-([0-9]+)$', port)
if match: if match:
num1 = int(match.group(1)) num1 = int(match.group(1))
num2 = int(match.group(2)) num2 = int(match.group(2))
@ -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