#2682 Backport changes to core PrimAITE
This commit is contained in:
@@ -87,7 +87,9 @@ class NMAP(Application):
|
||||
|
||||
def _init_request_manager(self) -> RequestManager:
|
||||
def _ping_scan_action(request: List[Any], context: Any) -> RequestResponse:
|
||||
results = self.ping_scan(target_ip_address=request[0]["target_ip_address"], json_serializable=True)
|
||||
results = self.ping_scan(
|
||||
target_ip_address=request[0]["target_ip_address"], show=request[0]["show"], json_serializable=True
|
||||
)
|
||||
if not self._can_perform_network_action():
|
||||
return RequestResponse.from_bool(False)
|
||||
return RequestResponse(
|
||||
@@ -311,7 +313,6 @@ class NMAP(Application):
|
||||
self.sys_log.info(
|
||||
f"{self.name}: Responding to port scan request for port {payload.port.value} "
|
||||
f"({payload.port.name}) over {payload.protocol.name}",
|
||||
True,
|
||||
)
|
||||
self.software_manager.send_payload_to_session_manager(payload=payload, session_id=session_id)
|
||||
|
||||
@@ -370,7 +371,8 @@ class NMAP(Application):
|
||||
port_open = self._check_port_open_on_ip_address(ip_address=ip_address, port=port, protocol=protocol)
|
||||
|
||||
if port_open:
|
||||
table.add_row([ip_address, port.value, port.name, protocol.name])
|
||||
if show:
|
||||
table.add_row([ip_address, port.value, port.name, protocol.name])
|
||||
_ip_address = ip_address if not json_serializable else str(ip_address)
|
||||
_protocol = protocol if not json_serializable else protocol.value
|
||||
_port = port if not json_serializable else port.value
|
||||
|
||||
@@ -143,7 +143,7 @@ class ARP(Service):
|
||||
self.sys_log.info(f"Cannot send ARP request to a network address {str(target_ip_address)}")
|
||||
return
|
||||
if target_ip_address == outbound_network_interface.ip_network.broadcast_address:
|
||||
self.sys_log.info(f"Cannot send ARP request to a broadcast address {str(target_ip_address)}")
|
||||
self.sys_log.info(f"Cannot send ARP request to a broadcast addresss {str(target_ip_address)}")
|
||||
return
|
||||
|
||||
self.sys_log.info(f"Sending ARP request from NIC {outbound_network_interface} for ip {target_ip_address}")
|
||||
|
||||
@@ -61,7 +61,7 @@ class ICMP(Service):
|
||||
if target_ip_address.is_loopback:
|
||||
self.sys_log.info("Pinging loopback address")
|
||||
return any(network_interface.enabled for network_interface in self.network_interfaces.values())
|
||||
self.sys_log.info(f"Pinging {target_ip_address}:", to_terminal=True)
|
||||
self.sys_log.info(f"Pinging {target_ip_address}:", to_terminal=False)
|
||||
sequence, identifier = 0, None
|
||||
while sequence < pings:
|
||||
sequence, identifier = self._send_icmp_echo_request(target_ip_address, sequence, identifier, pings)
|
||||
@@ -77,7 +77,7 @@ class ICMP(Service):
|
||||
f"Received = {request_replies}, "
|
||||
f"Lost = {pings - request_replies} ({(pings - request_replies) / pings * 100}% loss)"
|
||||
)
|
||||
self.sys_log.info(output, to_terminal=True)
|
||||
self.sys_log.info(output, to_terminal=False)
|
||||
|
||||
return passed
|
||||
|
||||
@@ -167,7 +167,7 @@ class ICMP(Service):
|
||||
f"bytes={len(frame.payload)}, "
|
||||
f"time={time_str}, "
|
||||
f"TTL={frame.ip.ttl}",
|
||||
to_terminal=True,
|
||||
to_terminal=False,
|
||||
)
|
||||
if not self.request_replies.get(frame.icmp.identifier):
|
||||
self.request_replies[frame.icmp.identifier] = 0
|
||||
|
||||
Reference in New Issue
Block a user