Browse Source

Attacks without parameters add a note to the labels file.

Remove obsolete variable and fix other little things.
Carlos Garcia 6 years ago
parent
commit
ffa8cef1e7
3 changed files with 3 additions and 10 deletions
  1. 0 4
      code/CLI.py
  2. 2 5
      code/ID2TLib/AttackController.py
  3. 1 1
      code/ID2TLib/Controller.py

+ 0 - 4
code/CLI.py

@@ -86,10 +86,6 @@ class CLI(object):
         # Parse arguments
         self.args = parser.parse_args(args)
 
-        # Either PCAP filepath or GUI mode must be enabled
-        if not self.args.input:
-            parser.error("Parameter -i/--input required. See available options with -h/--help")
-
         self.process_arguments()
 
 def main(args):

+ 2 - 5
code/ID2TLib/AttackController.py

@@ -21,9 +21,6 @@ class AttackController:
         self.current_attack = None
         self.added_attacks = []
 
-        # The PCAP where the attack should be injected into
-        self.base_pcap = self.statistics.pcap_filepath
-
     def create_attack(self, attack_name: str):
         """
         Creates dynamically a new class instance based on the given attack_name.
@@ -52,7 +49,7 @@ class AttackController:
         # Add attack parameters if provided
         print("Validating and adding attack parameters.")
         params_dict = []
-        if params is not None:
+        if isinstance(params, list) and params:
             # Convert attack param list into dictionary
             for entry in params:
                 params_dict.append(entry.split('='))
@@ -75,7 +72,7 @@ class AttackController:
             # Pass paramters to attack controller
             self.set_params(params_dict)
         else:
-            attack_note = ""
+            attack_note = "This attack used only (random) default parameters."
 
         # Write attack into pcap file
         print("Generating attack packets...", end=" ")

+ 1 - 1
code/ID2TLib/Controller.py

@@ -70,7 +70,7 @@ class Controller:
         print("done.")
 
         # delete intermediate PCAP files
-        print('Deleting intermediate attack pcap...', end="")
+        print('Deleting intermediate attack pcap...', end=" ")
         sys.stdout.flush()  # force python to print text immediately
         os.remove(attacks_pcap_path)
         print("done.")