nopasaran.primitives.action_primitives.udp_primitives.UDPPrimitives

class nopasaran.primitives.action_primitives.udp_primitives.UDPPrimitives

Bases: object

Class containing UDP action primitives for the state machine.

__init__()

Methods

__init__()

create_UDP_packet(inputs, outputs, state_machine)

Create a UDP packet and store it in an output variable in the machine's state.

fill_UDP_packet_with_placeholder(inputs, ...)

Attach a payload of repeated 'A' characters to a UDP packet.

get_UDP_dport(inputs, outputs, state_machine)

Get the destination port from a UDP packet.

get_UDP_payload_size(inputs, outputs, ...)

Get the size (in bytes) of the UDP payload from a UDP packet.

get_UDP_sport(inputs, outputs, state_machine)

Get the source port from a UDP packet.

set_UDP_dport(inputs, outputs, state_machine)

Set the destination port of a UDP packet.

set_UDP_payload(inputs, outputs, state_machine)

Set/replace the payload of an existing UDP packet.

set_UDP_sport(inputs, outputs, state_machine)

Set the source port of a UDP packet.

static create_UDP_packet(inputs, outputs, state_machine)

Create a UDP packet and store it in an output variable in the machine’s state.

Number of input arguments: 0

Number of output arguments: 1

Optional input arguments: No

Optional output arguments: No

Args:

inputs (List[str]): The list of input variable names.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument, which is

the name of the variable to store the created UDP packet.

state_machine: The state machine object.

Returns:

None

static fill_UDP_packet_with_placeholder(inputs, outputs, state_machine)

Attach a payload of repeated ‘A’ characters to a UDP packet.

Number of input arguments: 2

inputs[0]: The variable name for the UDP packet. inputs[1]: The size (number of bytes) to fill with ‘A’.

Number of output arguments: 1

outputs[0]: The variable name to store the updated packet.

static get_UDP_dport(inputs, outputs, state_machine)

Get the destination port from a UDP packet.

Number of input arguments: 1

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 one mandatory input argument:
  • The name of the variable containing the UDP packet.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument,

which is the name of the variable to store the destination port.

state_machine: The state machine object.

Returns:

None

static get_UDP_payload_size(inputs, outputs, state_machine)

Get the size (in bytes) of the UDP payload from a UDP packet.

Number of input arguments: 1

inputs[0]: The variable name for the UDP packet.

Number of output arguments: 1

outputs[0]: The variable name to store the UDP payload size.

static get_UDP_sport(inputs, outputs, state_machine)

Get the source port from a UDP packet.

Number of input arguments: 1

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 one mandatory input argument:
  • The name of the variable containing the UDP packet.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument,

which is the name of the variable to store the source port.

state_machine: The state machine object.

Returns:

None

static set_UDP_dport(inputs, outputs, state_machine)

Set the destination port of a UDP packet.

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 UDP packet.

  • The name of the variable containing the destination port to set.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument,

which is the name of the variable to store the modified UDP packet.

state_machine: The state machine object.

Returns:

None

static set_UDP_payload(inputs, outputs, state_machine)

Set/replace the payload of an existing UDP packet.

Number of input arguments: 2

inputs[0]: The variable name for the UDP packet. inputs[1]: The variable name for the payload bytes.

Number of output arguments: 1

outputs[0]: The variable name to store the updated packet.

static set_UDP_sport(inputs, outputs, state_machine)

Set the source port of a UDP packet.

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 UDP packet.

  • The name of the variable containing the source port to set.

outputs (List[str]): The list of output variable names. It contains one mandatory output argument,

which is the name of the variable to store the modified UDP packet.

state_machine: The state machine object.

Returns:

None