geneva.actions.trigger¶
-
class
trigger.
Trigger
(trigger_type, trigger_field, trigger_proto, trigger_value=0, environment_id=None, gas=None)¶ Bases:
object
-
__init__
(trigger_type, trigger_field, trigger_proto, trigger_value=0, environment_id=None, gas=None)¶ - Params:
- trigger_type: the type of trigger. Only “field” (matching based on a field value) is currently supported.
- trigger_field: the field the trigger should check in a packet to trigger on
- trigger_proto: the protocol the trigger should look in to retrieve the trigger field
- trigger_value: the value in the trigger_field that, upon a match, will cause the trigger to fire
- environment_id: environment_id the current trigger is running under. Used to retrieve previously saved packets
- gas: how many times this trigger can fire before it stops triggering. gas=None disables gas (unlimited triggers.)
- has_wildcard: represents if the trigger will match a specific value, or any value containing trigger_value
-
add_gas
(gas)¶ Adds gas to this trigger, gas is an integer
-
disable_gas
()¶ Disables the use of gas.
-
enable_gas
()¶ Sets gas to 0
-
static
get_gas
()¶ Returns a random value for gas for this trigger.
-
static
get_rand_trigger
(environment_id, real_packet_probability)¶ Creates a random trigger.
-
is_applicable
(packet, logger)¶ Checks if this trigger is applicable to a given packet.
-
mutate
(environment_id, real_packet_probability=0.5)¶ Mutates this trigger object by picking a new protocol, field, and value.
-
static
parse
(string)¶ Given a string representation of a trigger, define a new Trigger represented by this string.
-
set_gas
(gas)¶ Sets the gas to the specified value
-