forked from p15670423/monkey
Agent: Use dict comprehension instead of for
This commit is contained in:
parent
3f89e50930
commit
4987dddc0c
|
@ -46,9 +46,7 @@ def _scan_tcp_ports(
|
||||||
def _generate_tcp_scan_event(
|
def _generate_tcp_scan_event(
|
||||||
host: str, port_scan_data: Dict[int, PortScanData], event_timestamp: float
|
host: str, port_scan_data: Dict[int, PortScanData], event_timestamp: float
|
||||||
):
|
):
|
||||||
port_statuses = {}
|
port_statuses = {port: psd.status for port, psd in port_scan_data.items()}
|
||||||
for port, data in port_scan_data.items():
|
|
||||||
port_statuses[port] = data.status
|
|
||||||
|
|
||||||
return TCPScanEvent(
|
return TCPScanEvent(
|
||||||
source=get_agent_id(),
|
source=get_agent_id(),
|
||||||
|
|
|
@ -35,9 +35,7 @@ def patch_check_tcp_ports(monkeypatch, open_ports_data):
|
||||||
|
|
||||||
|
|
||||||
def _get_tcp_scan_event(port_scan_data: PortScanData):
|
def _get_tcp_scan_event(port_scan_data: PortScanData):
|
||||||
port_statuses = {}
|
port_statuses = {port: psd.status for port, psd in port_scan_data.items()}
|
||||||
for port, data in port_scan_data.items():
|
|
||||||
port_statuses[port] = data.status
|
|
||||||
|
|
||||||
return TCPScanEvent(
|
return TCPScanEvent(
|
||||||
source=get_agent_id(),
|
source=get_agent_id(),
|
||||||
|
|
Loading…
Reference in New Issue