nopasaran.primitives.action_primitives.ip_primitives.IPPrimitives

class nopasaran.primitives.action_primitives.ip_primitives.IPPrimitives

Bases: object

Class containing IP action primitives for the state machine.

__init__()

Methods

__init__()

get_IP_dst(inputs, outputs, state_machine)

Get the destination IP address from an IP packet.

get_IP_fields(inputs, outputs, state_machine)

Get all fields from the IP layer of a packet.

get_IP_src(inputs, outputs, state_machine)

Get the source IP address from an IP packet.

get_IP_ttl(inputs, outputs, state_machine)

Get the TTL (Time To Live) value from an IP packet.

get_default_dns_resolver_ip(inputs, outputs, ...)

Get the system's default DNS resolver IP address.

set_IP_dst(inputs, outputs, state_machine)

Set the destination IP address of an IP packet.

set_IP_src(inputs, outputs, state_machine)

Set the source IP address of an IP packet.

set_IP_ttl(inputs, outputs, state_machine)

Set the TTL (Time To Live) value of an IP packet.

static get_IP_dst(inputs, outputs, state_machine)

Get the destination IP address from an IP 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 IP 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 IP address.

state_machine: The state machine object.

Returns:

None

static get_IP_fields(inputs, outputs, state_machine)

Get all fields from the IP layer of a 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 IP 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 dictionary of IP fields.

state_machine: The state machine object.

Returns:

None

static get_IP_src(inputs, outputs, state_machine)

Get the source IP address from an IP 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 IP 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 IP address.

state_machine: The state machine object.

Returns:

None

static get_IP_ttl(inputs, outputs, state_machine)

Get the TTL (Time To Live) value from an IP 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 IP 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 TTL value.

state_machine: The state machine object.

Returns:

None

static get_default_dns_resolver_ip(inputs, outputs, state_machine)

Get the system’s default DNS resolver IP address.

Number of input arguments: 0

Number of output arguments: 1

Optional input arguments: No

Optional output arguments: No

Args:

inputs (List[str]): No inputs required.

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 resolver IP address.

state_machine: The state machine object.

Returns:

None

static set_IP_dst(inputs, outputs, state_machine)

Set the destination IP address of an IP 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 IP packet.

  • The name of the variable containing the destination IP address 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 IP packet.

state_machine: The state machine object.

Returns:

None

static set_IP_src(inputs, outputs, state_machine)

Set the source IP address of an IP 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 IP packet.

  • The name of the variable containing the source IP address 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 IP packet.

state_machine: The state machine object.

Returns:

None

static set_IP_ttl(inputs, outputs, state_machine)

Set the TTL (Time To Live) value of an IP 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 IP packet.

  • The name of the variable containing the TTL value 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 IP packet.

state_machine: The state machine object.

Returns:

None