Attacker.py – Attacker¶
The attacker module is used for simualtion predefined attacks. Messages between clients and servers are passed through the attacker and modified for attacks. The attacker runs as a single process.
Classes¶
Attacker¶
-
class
Attacker.Attacker(config, clientConfigs, clientQueues, serverConfigs, serverQueues, writer, counter, attacks, attackerQueue, attackers, verbose=False)[source]¶ Initializes the Attacker.
Parameters: - config – Own config
- clientConfigs – List of all available client configurations
- clientQueues – List of all available Client queues to pass messages to the client
- serverConfigs – List of all available server configurations
- serverQueues – List of all available Client queues to pass messages to the client
- writer – Writer queue to pass messages to that are send on the interface or written to the .pcap file
- conter – Number of attacks to be executed, can be set to 0 to create dumps without attacks
- attacks – List of attacks that can be executed during runtime, those values can be configured using the configuration file
- attackerQueue – Own queue messages from all clients and servers are passed to
- attackers – Other attackers whos messages can be ignored and are not attacked
- verbose – can be set to True for additional output, default=False
Returns: configured Attacker Object
-
setIntervalMax(intervalMax)[source]¶ Set the maximum Interval an attacker will respond. The interval is given as int im ms.
-
setIntervalMin(intervalMin)[source]¶ Set the minimum Interval an attacker will respond. The interval is given as int im ms.
Basic Functions¶
attacker¶
-
Attacker.attacker(a)[source]¶ Main method of the module that is initializing needed data and executing the attacking loop. The default value to set the minimum attacker response time is 0 ms. The default value to set the maximum attacker response time is 10 ms. Thoose values are used in case nothing is specified.
sendMsg¶
forward¶
doAttack¶
-
Attacker.doAttack(curAttack, msgOrig, a, attacksSuc)[source]¶ Execute one of the predefined attacks that are configured to be executed.
Parameters: - curAttack – Choosen current attack.
- msgOrig – Original message the attack is applied to.
- a – Attacker Object containing all needed configurations and information.
- attacksSuc – Counter for successfully executed attacks.
Returns: Triple(Boolean, Boolean, Int), First entry means that the original message is forwarded or not, The second part means attack was successfull, the last value indicates the number of successfully executed attacks.