AttackParameters.py 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from enum import Enum
  2. class Parameter(Enum):
  3. """
  4. Defines the shortname for attack parameters. The shortname may be used for attack parameter specification
  5. when calling ID2T via the command line.
  6. """
  7. # type: IP address ------------------------------
  8. IP_SOURCE = 'ip.src' # source IP address
  9. IP_DESTINATION = 'ip.dst' # destination IP address
  10. IP_DNS = 'ip.dns' # IP address of DNS server
  11. # type: MAC address -----------------------------
  12. MAC_SOURCE = 'mac.src' # MAC address of source
  13. MAC_DESTINATION = 'mac.dst' # MAC address of destination
  14. # type: Port ------------------------------------
  15. PORT_OPEN = 'port.open' # open ports
  16. PORT_DESTINATION = 'port.dst' # destination ports
  17. PORT_SOURCE = 'port.src' # source ports
  18. # type: Digits ----------------------------------
  19. PACKETS_PER_SECOND = 'packets.per-second' # packets per second
  20. INJECT_AT_TIMESTAMP = 'inject.at-timestamp' # unix epoch time where attack should be injected
  21. INJECT_AFTER_PACKET = 'inject.after-pkt' # packet after which attack should be injected
  22. # type: boolean --------------------------------
  23. PORT_DEST_SHUFFLE = 'port.dst.shuffle' # shuffles the destination ports if a list of ports is given
  24. PORT_ORDER_DESC = 'port.dst.order-desc' # uses a descending port order instead of a ascending order
  25. IP_SOURCE_RANDOMIZE = 'ip.src.shuffle' # randomizes the sources IP address if a list of IP addresses is given
  26. PORT_SOURCE_RANDOM = 'port.src.shuffle' # randomizes the source port if a list of sources ports is given
  27. class ParameterTypes(Enum):
  28. """
  29. Defines types for parameters. These types may be used in the specification of allowed parameters within the
  30. individual attack classes. The type is used to verify the validity of the given value.
  31. """
  32. TYPE_IP_ADDRESS = 0
  33. TYPE_MAC_ADDRESS = 1
  34. TYPE_PORT = 2
  35. TYPE_INTEGER_POSITIVE = 3
  36. TYPE_TIMESTAMP = 4
  37. TYPE_BOOLEAN = 5
  38. TYPE_ASC_DSC = 6
  39. TYPE_FLOAT = 7
  40. TYPE_PACKET_POSITION = 8 # used to derive timestamp from parameter INJECT_AFTER_PACKET