Browse Source

Merge branch 'memory_efficiency_SKIP_CI' of stefan.schmidt/ID2T-toolkit into master

Carlos Garcia 6 years ago
parent
commit
9c58c7d4f8
2 changed files with 28 additions and 3 deletions
  1. 27 2
      build.sh
  2. 1 1
      resources/install_dependencies.sh

+ 27 - 2
build.sh

@@ -83,10 +83,35 @@ if [ $(uname) = 'Darwin' ]; then
 fi
 ID2T_DIR=\$(readlink -f \$0)
 SCRIPT_PATH=\${ID2T_DIR%/*}
-cd \$SCRIPT_PATH/code
+TEST_DIR=\${SCRIPT_PATH}/resources/test/
+TEST_PCAP=\${TEST_DIR}reference_1998.pcap
+cd \${SCRIPT_PATH}/code
+error=0
 # Execute tests
-set -e
+set +e
 python3 -m unittest Test/efficiency_testing.py
+error=\$?
+cd \$SCRIPT_PATH
+smbloris="SMBLorisAttack attackers.count=4 packets.per-second=8.0"
+smbscan1="SMBScanAttack ip.src=192.168.178.1 ip.dst=192.168.178.10-192.168.179.253"
+smbscan2="SMBScanAttack ip.src=192.168.178.1 ip.dst=192.168.178.10-192.168.178.109 hosting.ip=192.168.178.10-192.168.178.109"
+ftp="FTPWinaXeExploit ip.src=192.168.178.1 ip.dst=192.168.178.10"
+porto="PortscanAttack ip.src=192.168.178.1 port.open=80"
+portc="PortscanAttack ip.src=192.168.178.1 port.open=20"
+sqli="SQLiAttack ip.dst=192.168.0.1"
+joomla="JoomlaRegPrivExploit ip.src=192.168.178.1"
+sality="SalityBotnet"
+ddos="DDoSAttack attackers.count=10 packets.per-second=95 attack.duration=10"
+ms17="MS17Scan ip.src=192.168.178.1"
+eb="EternalBlue"
+for i in "\$smbloris" "\$smbscan1" "\$smbscan2" "\$ftp" "\$porto" "\$portc" "\$sqli" "\$joomla" "\$sality" "\$ddos" "\$ms17" "\$eb"; do
+    mprof run ./id2t -i \${TEST_PCAP} -a \${i}
+    mprof plot -t "\${i}" -o "\${TEST_DIR}\${i}.png"
+    mv mprofile_* "\${TEST_DIR}\${i}.dat"
+done
+echo "\nPlotted images can be found in \"\${TEST_DIR}\"."
+echo "By executing \"mprof plot <file>.dat\" you can get a more detailed look."
+exit \$error
 EOF
 
 chmod +x ./code/CLI.py

+ 1 - 1
resources/install_dependencies.sh

@@ -75,7 +75,7 @@ install_pkg_darwin()
 
 install_pip()
 {
-    PYTHON_MODULES="pyxdg lea numpy matplotlib scapy-python3 scipy coverage"
+    PYTHON_MODULES="pyxdg lea numpy matplotlib scapy-python3 scipy coverage memory_profiler"
     echo -e "Python modules: Checking..."
 
     # Check first to avoid unnecessary sudo