nopasaran.primitives.action_primitives.probing_primitives.PortProbingPrimitives

class nopasaran.primitives.action_primitives.probing_primitives.PortProbingPrimitives

Bases: object

Class containing port probing primitives for the state machine.

__init__()

Methods

__init__()

listen_tcp_probes(inputs, outputs, state_machine)

Listen for TCP probes and track which ports received traffic from a specific source IP.

listen_udp_probes(inputs, outputs, state_machine)

Listen for UDP probes and track which ports received traffic from a specific source IP.

probe_tcp_syn_ports(inputs, outputs, ...)

Send TCP SYN packets to all possible ports.

probe_udp_ports(inputs, outputs, state_machine)

Send UDP packets to all possible ports (0-65535) using L3 sockets.

static listen_tcp_probes(inputs, outputs, state_machine)

Listen for TCP probes and track which ports received traffic from a specific source IP.

Number of input arguments: 2 Number of output arguments: 1 Optional input arguments: No Optional output arguments: No

Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments:
  • The name of the variable containing the timeout in seconds.

  • The name of the variable containing the source IP to track.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument:
  • The name of the variable to store the dictionary of {“received”: [ports]} or {“received”: None} if timeout.

state_machine: The state machine object.

Returns:

None

static listen_udp_probes(inputs, outputs, state_machine)

Listen for UDP probes and track which ports received traffic from a specific source IP.

Number of input arguments: 2 Number of output arguments: 1 Optional input arguments: No Optional output arguments: No

Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments:
  • The name of the variable containing the timeout in seconds.

  • The name of the variable containing the source IP to track.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument:
  • The name of the variable to store the dictionary of {“received”: [ports]} or {“received”: None} if timeout.

state_machine: The state machine object.

Returns:

None

static probe_tcp_syn_ports(inputs, outputs, state_machine)

Send TCP SYN packets to all possible ports.

Number of input arguments: 2 Number of output arguments: 0 Optional input arguments: No Optional output arguments: No

Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments:
  • The name of the variable containing the source port (int).

  • The name of the variable containing the target IP address (str).

outputs (List[str]): No output arguments needed. state_machine: The state machine object.

Returns:

None

static probe_udp_ports(inputs, outputs, state_machine)

Send UDP packets to all possible ports (0-65535) using L3 sockets.

Number of input arguments: 2 Number of output arguments: 0 Optional input arguments: No Optional output arguments: No

Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments:
  • The name of the variable containing the source port (int).

  • The name of the variable containing the target IP address (str).

outputs (List[str]): No output arguments needed. state_machine: The state machine object.

Returns:

None