Fixed a bug where event loop would be closed before another host was scanned.

This commit is contained in:
Tib3rius 2019-03-07 18:33:25 -05:00
parent 599a5a357f
commit 8dc24e9e26
1 changed files with 3 additions and 9 deletions

View File

@ -417,8 +417,6 @@ async def scan_services(loop, semaphore, target):
pending.add(asyncio.ensure_future(run_cmd(semaphore, e(command), target, tag)))
loop.stop()
def scan_host(target, concurrent_scans):
info('Scanning target {byellow}{target.address}{rst}')
@ -453,14 +451,10 @@ def scan_host(target, concurrent_scans):
semaphore = asyncio.Semaphore(concurrent_scans)
try:
loop.create_task(scan_services(loop, semaphore, target))
loop.run_forever()
except KeyboardInterrupt:
pass
finally:
loop.close()
loop.run_until_complete(scan_services(loop, semaphore, target))
info('Finished scanning target {byellow}{target.address}{rst}')
return
except KeyboardInterrupt:
sys.exit(1)
class Target:
def __init__(self, address):