Agent: Make minor code cleanliness changes

This commit is contained in:
Mike Salvatore 2021-12-10 11:45:20 -05:00
parent 8091a0c4a5
commit abec851ed0
2 changed files with 6 additions and 5 deletions

View File

@ -49,13 +49,14 @@ class IPScanner:
results_callback(ip, ping_scan_data, port_scan_data)
logger.debug(
f"Detected the stop signal, scanning thread {threading.get_ident()} exiting"
)
except queue.Empty:
logger.debug(
f"ips_to_scan queue is empty, scanning thread {threading.get_ident()} exiting"
)
return
logger.debug(f"Detected the stop signal, scanning thread {threading.get_ident()} exiting")
def _scan_tcp_ports(self, ip: str, options: Dict, stop: Event):
port_scan_data = {}

View File

@ -145,7 +145,7 @@ def test_scan_lots_of_ips(callback, scan_config, stop):
def test_stop_after_callback(scan_config, stop):
def _callback(_, __, ___):
def _callback(*_):
# Block all threads here until 2 threads reach this barrier, then set stop
# and test that niether thread continues to scan.
_callback.barrier.wait()
@ -164,7 +164,7 @@ def test_stop_after_callback(scan_config, stop):
def test_interrupt_port_scanning(callback, scan_config, stop):
def stopable_scan_tcp_port(port, _, __):
def stopable_scan_tcp_port(port, *_):
# Block all threads here until 2 threads reach this barrier, then set stop
# and test that niether thread scans any more ports
stopable_scan_tcp_port.barrier.wait()