Browse Source

added creation of the memory test script to build.sh, adjusted test parameters

Jonathan Speth 6 years ago
parent
commit
d6a9b6c3e3
3 changed files with 22 additions and 6 deletions
  1. 18 1
      build.sh
  2. 0 1
      code/Test/ID2TAttackTest.py
  3. 4 4
      code/Test/memory_testing.py

+ 18 - 1
build.sh

@@ -67,7 +67,7 @@ coverage html
 coverage report -m
 EOF
 
-# Create the test script
+# Create the efficiency test script
 cat >./test_efficiency  <<EOF
 #!/bin/sh
 # Find the executable
@@ -82,12 +82,29 @@ set -e
 python -m unittest Test/efficiency_testing.py
 EOF
 
+# Create the memory usage test script
+cat >./test_memory  <<EOF
+#!/bin/sh
+# Find the executable
+if [ $(uname) = 'Darwin' ]; then
+    alias readlink='greadlink'
+fi
+ID2T_DIR=\$(readlink -f \$0)
+SCRIPT_PATH=\${ID2T_DIR%/*}
+cd \$SCRIPT_PATH/code
+# Execute tests
+set -e
+python -m unittest Test/memory_testing.py
+EOF
+
 chmod +x ./code/CLI.py
 chmod +x ./id2t
 chmod +x ./run_tests
 chmod +x ./test_efficiency
+chmod +x ./test_memory
 
 echo -e "\n\nAll is set. ID2T is ready."
 echo -e "\nRun efficiency tests with the command './test_efficiency'"
+echo -e "Run memory usage tests with the command './test_memory'"
 echo -e "Run unit tests with the command './run_tests'"
 echo -e "Run ID2T with the command './id2t'"

+ 0 - 1
code/Test/ID2TAttackTest.py

@@ -180,7 +180,6 @@ class ID2TAttackTest(unittest.TestCase):
 
         caller_function = inspect.stack()[1].function
 
-
         if cleanup:
             Lib.clean_up(controller)
         else:

+ 4 - 4
code/Test/memory_testing.py

@@ -6,10 +6,10 @@ import Test.ID2TAttackTest as Test
 
 class MemoryTests(Test.ID2TAttackTest):
     def test_SMBLoris(self):
-        self.memory_test([['SMBLorisAttack']])
+        self.memory_test([['SMBLorisAttack', 'attackers.count=30', 'packets.per-second=8.0']])
 
-    def test_SMBScanself(self):
-        self.memory_test([['SMBScanAttack']])
+    def test_SMBScan(self):
+        self.memory_test([['SMBScanAttack', 'ip.src=192.168.178.1', 'ip.dst=192.168.178.10-192.168.197.145']])
 
     @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)
@@ -30,7 +30,7 @@ class MemoryTests(Test.ID2TAttackTest):
 
     @mock.patch('Attack.BaseAttack.BaseAttack.write_attack_pcap', side_effect=Lib.write_attack_pcap)
     def test_DDoS(self, mock_write_attack_pcap):
-        self.memory_test([['DDoSAttack']])
+        self.memory_test([['DDoSAttack', 'attackers.count=100', 'packets.per-second=95', 'attack.duration=150']])
 
     def test_EternalBlue(self):
         self.memory_test([['EternalBlueExploit']])