Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Limmen committed Nov 15, 2023
1 parent 38348c2 commit 4f39a10
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ def _parse_nmap_hostnames_xml(xml_data) -> List[str]:
return hostnames

@staticmethod
def _parse_nmap_ports_xml(xml_data, action: EmulationAttackerAction) -> Tuple[List[NmapPort], List[NmapVuln],
List[NmapBruteCredentials]]:
def _parse_nmap_ports_xml(xml_data, action: EmulationAttackerAction) \
-> Tuple[List[NmapPort], List[NmapVuln], List[NmapBruteCredentials]]:
"""
Parses a ports XML element in the XML tree
Expand Down Expand Up @@ -322,10 +322,9 @@ def _parse_nmap_table_vuln(xml_data, port: int, protocol: TransportProtocol, ser

@staticmethod
def _parse_nmap_script(xml_data, port: int, protocol: TransportProtocol, service: str,
action: EmulationAttackerAction) -> Tuple[Union[List[NmapVuln],
List[NmapBruteCredentials],
NmapHttpEnum, NmapHttpGrep,
NmapVulscan, None], Union[NmapVuln, None]]:
action: EmulationAttackerAction) \
-> Tuple[Union[List[NmapVuln], List[NmapBruteCredentials], NmapHttpEnum, NmapHttpGrep, NmapVulscan, None],
Union[NmapVuln, None]]:
"""
Parses a XML script element
Expand Down Expand Up @@ -475,7 +474,7 @@ def nmap_scan_action_helper(s: EmulationEnvState, a: EmulationAttackerAction,
cmds = a.masscan_cmds()

Logger.__call__().get_logger().info(
f"Running NMAP scan on container: {s.emulation_env_config.containers_config.agent_ip}, commands: "
f"Running NMAP scan on container: {s.emulation_env_config.containers_config.agent_ip}, commands: "
f"{','.join(cmds)}")
results = EmulationUtil.execute_ssh_cmds(cmds=cmds, conn=s.emulation_env_config.get_hacker_connection())
total_time = sum(list(map(lambda x: x[2], results)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2430,7 +2430,7 @@ def test_save_system_identification_job(
system_identification_job=example_system_identification_job_config)
mocked_cursor.execute.assert_called_once_with(
f"INSERT INTO {constants.METADATA_STORE.SYSTEM_IDENTIFICATION_JOBS_TABLE} "
f"(config, emulation_name, pid) "
f"(id, config, emulation_name, pid) "
f"VALUES (%s, %s, %s, %s) RETURNING id", (example_system_identification_job_config.id,
example_system_identification_job_config.to_json_str(),
example_system_identification_job_config.emulation_env_name,
Expand Down

0 comments on commit 4f39a10

Please sign in to comment.