Przeglądaj źródła

refactor directory structure

Jens Keim 6 lat temu
rodzic
commit
87253d5224

+ 1 - 1
code/Attack/AttackParameters.py

@@ -4,7 +4,7 @@ import enum
 class Parameter(enum.Enum):
     """
     Defines the shortname for attack parameters. The shortname may be used for attack parameter specification
-    when calling ID2T via the command line.
+    when calling Core via the command line.
     """
     # recommended type: IP address -------------------------------
     IP_SOURCE = 'ip.src'  # source IP address

+ 3 - 3
code/CLI.py

@@ -2,7 +2,7 @@
 import argparse
 import sys
 
-from ID2TLib.Controller import Controller
+from Core.Controller import Controller
 
 
 class LoadFromFile(argparse.Action):
@@ -31,7 +31,7 @@ class CLI(object):
         :param args: The application arguments
         """
         # Create parser for arguments
-        parser = argparse.ArgumentParser(description="Intrusion Detection Dataset Toolkit (ID2T) - A toolkit for "
+        parser = argparse.ArgumentParser(description="Intrusion Detection Dataset Toolkit (Core) - A toolkit for "
                                                      "injecting synthetically created attacks into PCAP files.",
                                          prog="id2t")
         # Required arguments
@@ -138,7 +138,7 @@ class CLI(object):
         Loads the application controller, the PCAP file statistics and if present, processes the given attacks.
         Evaluates given queries.
         """
-        # Create ID2T Controller
+        # Create Core Controller
         controller = Controller(self.args.input, self.args.extraTests)
 
         # Load PCAP statistics

+ 2 - 2
code/ID2TLib/AttackController.py → code/Core/AttackController.py

@@ -2,10 +2,10 @@ import importlib
 import sys
 
 import Attack.AttackParameters as atkParam
+import Core.LabelManager as LabelManager
+import Core.Statistics as Statistics
 import ID2TLib.Label as Label
-import ID2TLib.LabelManager as LabelManager
 import ID2TLib.PcapFile as PcapFile
-import ID2TLib.Statistics as Statistics
 
 
 class AttackController:

+ 3 - 3
code/ID2TLib/Controller.py → code/Core/Controller.py

@@ -2,10 +2,10 @@ import os
 import readline
 import sys
 
-import ID2TLib.AttackController as atkCtrl
-import ID2TLib.LabelManager as LabelManager
+import Core.AttackController as atkCtrl
+import Core.LabelManager as LabelManager
+import Core.Statistics as Statistics
 import ID2TLib.PcapFile as PcapFile
-import ID2TLib.Statistics as Statistics
 
 
 class Controller:

+ 0 - 0
code/ID2TLib/LabelManager.py → code/Core/LabelManager.py


+ 1 - 1
code/ID2TLib/Statistics.py → code/Core/Statistics.py

@@ -9,8 +9,8 @@ from operator import itemgetter
 import ID2TLib.libpcapreader as pr
 import matplotlib
 
+import Core.StatsDatabase as statsDB
 import ID2TLib.PcapFile as PcapFile
-import ID2TLib.StatsDatabase as statsDB
 import ID2TLib.Utility as Util
 
 matplotlib.use('Agg', force=True)

+ 0 - 0
code/ID2TLib/StatsDatabase.py → code/Core/StatsDatabase.py


+ 2 - 2
code/Test/ID2TAttackTest.py

@@ -3,13 +3,13 @@ import unittest
 
 import scapy.utils as pcr
 
-import ID2TLib.Controller as Ctrl
+import Core.Controller as Ctrl
 import ID2TLib.TestLibrary as Lib
 
 
 class ID2TAttackTest(unittest.TestCase):
     """
-    Generic Test Class for ID2T attacks based on unittest.TestCase.
+    Generic Test Class for Core attacks based on unittest.TestCase.
     """
 
     def checksum_test(self, attack_args, sha256_checksum, seed=5, cleanup=True, pcap=Lib.test_pcap,

+ 2 - 2
code/Test/test_DDoSAttack.py

@@ -23,12 +23,12 @@ class UnitTestDDoS(Test.ID2TAttackTest):
                            sha_num_attackers_ddos)
 
     @mock.patch('ID2TLib.Utility.get_attacker_config', side_effect=Lib.get_attacker_config)
-    @mock.patch('ID2TLib.Statistics.Statistics.get_mac_address', return_value=[])
+    @mock.patch('Core.Statistics.Statistics.get_mac_address', return_value=[])
     def test_ddos_dest_mac_length_zero(self, mock_dest_mac, mock_get_attacker_config):
         self.checksum_test([['DDoSAttack']], sha_dest_mac_length_zero_ddos)
 
     @mock.patch('ID2TLib.Utility.get_attacker_config', side_effect=Lib.get_attacker_config)
-    @mock.patch('ID2TLib.Statistics.Statistics.get_most_used_mss', return_value=None)
+    @mock.patch('Core.Statistics.Statistics.get_most_used_mss', return_value=None)
     def test_ddos_mss_none(self, mock_mss, mock_get_attacker_config):
         self.checksum_test([['DDoSAttack']], sha_mss_none_ddos)
 

+ 1 - 1
code/Test/test_FTPWinaXeExploit.py

@@ -21,7 +21,7 @@ class UnitTestFTPWinaXeExploit(Test.ID2TAttackTest):
 
     @mock.patch('ID2TLib.Utility.get_rnd_bytes', side_effect=Lib.get_bytes)
     @mock.patch('ID2TLib.Utility.get_rnd_x86_nop', side_effect=Lib.get_x86_nop)
-    @mock.patch('ID2TLib.Statistics.Statistics.get_mac_address')
+    @mock.patch('Core.Statistics.Statistics.get_mac_address')
     def test_ftp_mac(self, mock_mac_address, mock_get_rnd_x86_nop, mock_get_rnd_bytes):
         mock_mac_address.return_value = Lib.test_pcap_empty
         self.checksum_test([['FTPWinaXeExploit']], sha_ftp_mac)

+ 1 - 1
code/Test/test_Queries.py

@@ -1,7 +1,7 @@
 import random
 import unittest
 
-import ID2TLib.Controller as Ctrl
+import Core.Controller as Ctrl
 import ID2TLib.TestLibrary as Test
 
 # TODO: improve coverage

+ 1 - 1
code/Test/test_SalityBotnet.py

@@ -11,7 +11,7 @@ class UnitTestSalityBotnet(Test.ID2TAttackTest):
     def test_botnet_basic(self):
         self.checksum_test([['SalityBotnet']], sha_botnet_basic)
 
-    @mock.patch('ID2TLib.Statistics.Statistics.get_most_used_ip_address')
+    @mock.patch('Core.Statistics.Statistics.get_most_used_ip_address')
     def test_botnet_most_used_ip(self, mock_most_used_ip_address):
         mock_most_used_ip_address.return_value = Lib.test_pcap_ips[0]
         self.checksum_test([['SalityBotnet']], sha_botnet_most_used_ip_in_list)