Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions scanner/modules/core_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ def __init__(self,
self.timeout = timeout
self.results = defaultdict(dict)
self.total_time = float()
self._loop = asyncio.get_event_loop()
self._observers = list()

@property
Expand Down Expand Up @@ -97,7 +96,10 @@ async def _scan_target_port(self, address: str, port: int) -> None:
service = 'unknown'
self.results[address].update({port: (port_state, service, reason)})

def execute(self):
async def _execute(self):
with self._timer():
self._loop.run_until_complete(asyncio.wait(self._scan_tasks))
self._loop.run_until_complete(self._notify_all())
await asyncio.gather(*self._scan_tasks)
await self._notify_all()

def execute(self):
asyncio.run(self._execute())