forked from p34709852/monkey
Agent: Make minor code cleanliness changes
This commit is contained in:
parent
8091a0c4a5
commit
abec851ed0
|
@ -49,13 +49,14 @@ class IPScanner:
|
||||||
|
|
||||||
results_callback(ip, ping_scan_data, port_scan_data)
|
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:
|
except queue.Empty:
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"ips_to_scan queue is empty, scanning thread {threading.get_ident()} exiting"
|
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):
|
def _scan_tcp_ports(self, ip: str, options: Dict, stop: Event):
|
||||||
port_scan_data = {}
|
port_scan_data = {}
|
||||||
|
|
|
@ -145,7 +145,7 @@ def test_scan_lots_of_ips(callback, scan_config, stop):
|
||||||
|
|
||||||
|
|
||||||
def test_stop_after_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
|
# Block all threads here until 2 threads reach this barrier, then set stop
|
||||||
# and test that niether thread continues to scan.
|
# and test that niether thread continues to scan.
|
||||||
_callback.barrier.wait()
|
_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 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
|
# Block all threads here until 2 threads reach this barrier, then set stop
|
||||||
# and test that niether thread scans any more ports
|
# and test that niether thread scans any more ports
|
||||||
stopable_scan_tcp_port.barrier.wait()
|
stopable_scan_tcp_port.barrier.wait()
|
||||||
|
|
Loading…
Reference in New Issue