Browse Source

fix --inject-empty functionality

Jens Keim 5 years ago
parent
commit
512262a99a
2 changed files with 5 additions and 5 deletions
  1. 3 3
      code/Core/Controller.py
  2. 2 2
      code/Test/ID2TAttackTest.py

+ 3 - 3
code/Core/Controller.py

@@ -75,7 +75,7 @@ class Controller:
                                              self.non_verbose, intervals=intervals, delete=delete,
                                              recalculate_intervals=recalculate_intervals)
 
-    def process_attacks(self, attacks_config: list, seeds=None, time: bool=False, inject_empty: bool=False):
+    def process_attacks(self, attacks_config: list, seeds=None, measure_time: bool=False, inject_empty: bool=False):
         """
         Creates the attack based on the attack name and the attack parameters given in the attacks_config. The
         attacks_config is a list of attacks.
@@ -85,7 +85,7 @@ class Controller:
 
         :param attacks_config: A list of attacks with their attack parameters.
         :param seeds: A list of random seeds for the given attacks.
-        :param time: Measure time for packet generation.
+        :param measure_time: Measure time for packet generation.
         :param inject_empty: if flag is set, Attack PCAPs will not be merged with the base PCAP, ie. Attacks are injected into an empty PCAP
         """
 
@@ -97,7 +97,7 @@ class Controller:
             else:
                 rng_seed = int.from_bytes(os.urandom(16), sys.byteorder)
             self.attack_controller.set_seed(seed=rng_seed)
-            temp_attack_pcap, duration = self.attack_controller.process_attack(attack[0], attack[1:], time)
+            temp_attack_pcap, duration = self.attack_controller.process_attack(attack[0], attack[1:], measure_time)
             self.durations.append(duration)
             self.added_packets += self.attack_controller.total_packets
             if not self.non_verbose:

+ 2 - 2
code/Test/ID2TAttackTest.py

@@ -74,9 +74,9 @@ class ID2TAttackTest(unittest.TestCase):
                                         intervals=[], delete=True)
 
         if seed is None:
-            controller.process_attacks(attack_args, time=True)
+            controller.process_attacks(attack_args, measure_time=True)
         else:
-            controller.process_attacks(attack_args, [[seed]], time=True)
+            controller.process_attacks(attack_args, [[seed]], measure_time=True)
 
         duration = controller.durations[0] * factor / controller.attack_controller.total_packets
         print(attack_args[0][0] + ' needs ' + str(duration) + ' seconds to generate ' + str(factor) + ' packets.')