4 Commits 078fd54731 ... e5a87dc00b

Author SHA1 Message Date
  Patrick Jattke e5a87dc00b Extended prerequisites 7 years ago
  Patrick Jattke 77b92b4881 - Fixes returning the wrong packet count from DDoSAttack 7 years ago
  Patrick Jattke 29d6a99849 Merge branch 'development' of git.tk.informatik.tu-darmstadt.de:SPIN/ID2T-toolkit into development 7 years ago
  Patrick Jattke 53309a97ca - Enables generation of plots on headless machines 7 years ago
4 changed files with 9 additions and 5 deletions
  1. 2 1
      README.md
  2. 2 1
      code/Attack/DDoSAttack.py
  3. 2 0
      code/ID2TLib/Statistics.py
  4. 3 3
      code_boost/src/cxx/pcap_processor.cpp

+ 2 - 1
README.md

@@ -40,7 +40,8 @@ The following packages/libraries are required to compile the ID2T C++ modules
 The following python packages are required to run ID2T. Install the packages with your preferred package manager. For example, you can use pip3 (pip for python 3). Install pip3 in ubuntu with ``apt install python3-pip`` and install the packages with ``sudo pip3 install <packagename>``.
 * ``scapy`` (make sure its the python3 version)
 * ``lea``
-* ``SciPy Stack` (see [installation instructions](https://www.scipy.org/install.html))
+* ``matplotlib``
+* ``SciPy Stack`` (see [installation instructions](https://www.scipy.org/install.html))
 
 #### Notes on the Minimum Package Versions
 The minimum version stated in the previous requirements are the versions we have used in the development of ID2T. Other (older) versions might also work; however, we cannot guarantee nor support them. Furthermore, some compilation scripts would need to be manually modified to accommodate these older versions.

+ 2 - 1
code/Attack/DDoSAttack.py

@@ -193,4 +193,5 @@ class DDoSAttack(BaseAttack.BaseAttack):
         self.attack_end_utime = last_packet.time
 
         # return packets sorted by packet time_sec_start
-        return pkt_num, path_attack_pcap
+        # pkt_num+1: because pkt_num starts at 0
+        return pkt_num + 1, path_attack_pcap

+ 2 - 0
code/ID2TLib/Statistics.py

@@ -1,6 +1,8 @@
 import os
 import time
 import ID2TLib.libpcapreader as pr
+import matplotlib
+matplotlib.use('Agg')
 import matplotlib.pyplot as plt
 from ID2TLib.PcapFile import PcapFile
 from ID2TLib.StatsDatabase import StatsDatabase

+ 3 - 3
code_boost/src/cxx/pcap_processor.cpp

@@ -71,7 +71,7 @@ std::string pcap_processor::merge_pcaps(const std::string pcap_path) {
             try {
                 writer.write(*iterator_attack);
             } catch (serialization_error) {
-                std::cout << "Could not serialize attack packet with timestamp " << tstmp_attack << std::endl;
+                std::cout << std::setprecision(15) << "Could not serialize attack packet with timestamp " << tstmp_attack << std::endl;
             }
             iterator_attack++;
             if (iterator_attack == sniffer_attack.end())
@@ -80,7 +80,7 @@ std::string pcap_processor::merge_pcaps(const std::string pcap_path) {
             try {
                 writer.write(*iterator_base);
             } catch (serialization_error) {
-                    std::cout << "Could not serialize base packet with timestamp " << tstmp_attack << std::endl;
+                    std::cout << "Could not serialize base packet with timestamp " << std::setprecision(15) << tstmp_attack << std::endl;
             }
             iterator_base++;
         }
@@ -93,7 +93,7 @@ std::string pcap_processor::merge_pcaps(const std::string pcap_path) {
             writer.write(*iterator_attack);
         } catch (serialization_error) {
             auto tstmp_attack = (iterator_attack->timestamp().seconds()) + (iterator_attack->timestamp().microseconds()*1e-6);
-            std::cout << "Could not serialize attack packet with timestamp " << tstmp_attack << std::endl;
+            std::cout << "Could not serialize attack packet with timestamp " << std::setprecision(15) << tstmp_attack << std::endl;
         }
     }
     return new_filepath;