nopasaran.primitives.action_primitives.replay_primitives.ReplayPrimitives

class nopasaran.primitives.action_primitives.replay_primitives.ReplayPrimitives

Bases: object

Class containing packet replay primitives for the state machine.

__init__()

Methods

__init__()

listen_udp_replays(inputs, outputs, ...)

Listen for UDP packets and return the count of packets received for a specific source IP and destination port.

replay_udp_packets(inputs, outputs, ...)

Replay UDP packets to a specific port multiple times using Scapy in batches.

static listen_udp_replays(inputs, outputs, state_machine)

Listen for UDP packets and return the count of packets received for a specific source IP and destination port.

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

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

  • The name of the variable containing the source IP to filter by.

  • The name of the variable containing the destination port to filter by.

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

state_machine: The state machine object.

Returns:

None

static replay_udp_packets(inputs, outputs, state_machine)

Replay UDP packets to a specific port multiple times using Scapy in batches.

Args:
inputs (List[str]): The list of input variable names. It contains:
  • Target IP address.

  • Source port.

  • Destination port.

  • Number of packets per batch (batch_size).

  • Number of batches (num_batches).

  • Payload to send.

  • Time delay between batches in seconds.

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

Returns:

None