ソースを参照

comment out all Aidmar modifications for performance measure

aidmar.wainakh 6 年 前
コミット
beccce4271

+ 0 - 2
code/ID2TLib/Statistics.py

@@ -1,6 +1,4 @@
 # Aidmar
-from scipy.spatial import distance as dist
-import numpy as np
 from operator import itemgetter
 import math
 

+ 8 - 6
code_boost/src/cxx/pcap_processor.cpp

@@ -117,12 +117,12 @@ void pcap_processor::collect_statistics() {
         stats.setTimestampFirstPacket(i->timestamp());
     
         // Aidmar
-        int counter=0;
+        //int counter=0;
         //int timeIntervalCounter = 1;   
         //int timeIntervalsNum = 100;
         //std::chrono::microseconds intervalStartTimestamp = stats.getTimestampFirstPacket();
         //std::chrono::microseconds firstTimestamp = stats.getTimestampFirstPacket();        
-        SnifferIterator lastpkt;
+        //SnifferIterator lastpkt;
         //for (SnifferIterator j = snifferOverview.begin(); j != snifferOverview.end(); j++) {lastpkt = j;}        
         //std::chrono::microseconds lastTimestamp = lastpkt->timestamp();                  
         //std::chrono::microseconds captureDuration = lastTimestamp - firstTimestamp;
@@ -153,8 +153,9 @@ void pcap_processor::collect_statistics() {
             
             stats.incrementPacketCount();
             this->process_packets(*i);                    
-            lastProcessedPacket = i->timestamp();            
-            counter++;
+            lastProcessedPacket = i->timestamp(); 
+            
+            //counter++;
         }
         
         // Save timestamp of last packet into statistics
@@ -263,10 +264,11 @@ void pcap_processor::process_packets(const Packet &pkt) {
             
             // Aidmar
             // Check window size for SYN noly
-            if(tcpPkt.get_flag(TCP::SYN)) {
+            /*if(tcpPkt.get_flag(TCP::SYN)) {
                 int win = tcpPkt.window();
                 stats.incrementWinCount(ipAddressSender, win);
-            }                   
+            }
+            */
             try {                                                                
                 int val = tcpPkt.mss();
                 stats.addMSS(ipAddressSender, val);

+ 1 - 1
code_boost/src/cxx/pcap_processor.h

@@ -34,7 +34,7 @@ public:
     std::string filePath;
 
     // Aidmar
-    artifacts_tests tests;
+    //artifacts_tests tests;
     /*
      * Methods
      */

+ 13 - 8
code_boost/src/cxx/statistics.cpp

@@ -308,7 +308,7 @@ void statistics::assignMacAddress(std::string ipAddress, std::string macAddress)
  * @param bytesSent The packet's size.
  */
 void statistics::addIpStat_packetSent(std::string filePath, std::string ipAddressSender, std::string ipAddressReceiver, long bytesSent, std::chrono::microseconds timestamp) {
-    
+    /*
     // Aidmar - Adding IP as a sender for first time
     if(ip_statistics[ipAddressSender].pkts_sent==0){  
         // Add the IP class
@@ -341,8 +341,9 @@ void statistics::addIpStat_packetSent(std::string filePath, std::string ipAddres
             s_t = packetCount - pktCntNvlSndr + 1;        
             ipSrc_Mahoney_score = (float)s_t*n/s_r;
         }
-        
-    // Replace pcap filename with 'filename_ip_entropy'
+       */
+       
+    //// Replace pcap filename with 'filename_ip_entropy'
     /*std::string new_filepath = filePath;
     const std::string &newExt = "_ip_src_anomaly_score.csv";
     std::string::size_type h = new_filepath.rfind('.', new_filepath.length());
@@ -359,6 +360,7 @@ void statistics::addIpStat_packetSent(std::string filePath, std::string ipAddres
     file.close();  
     */
     
+    /*
     ip_statistics[ipAddressSender].firstAppearAsSenderPktCount = packetCount;  
     ip_statistics[ipAddressSender].sourceAnomalyScore = ipSrc_Mahoney_score;    
     }
@@ -392,8 +394,9 @@ void statistics::addIpStat_packetSent(std::string filePath, std::string ipAddres
         
             ipDst_Mahoney_score = (float)s_t*n/s_r;
         }
-        
-    // Replace pcap filename with 'filename_ip_entropy'
+      */
+    
+    //// Replace pcap filename with 'filename_ip_entropy'
     /*std::string new_filepath = filePath;
     const std::string &newExt = "_ip_dst_anomaly_score.csv";
     std::string::size_type h = new_filepath.rfind('.', new_filepath.length());
@@ -409,17 +412,19 @@ void statistics::addIpStat_packetSent(std::string filePath, std::string ipAddres
     file.close();  
     */
     
+    /*
     ip_statistics[ipAddressReceiver].firstAppearAsReceiverPktCount = packetCount;
     ip_statistics[ipAddressReceiver].destinationAnomalyScore = ipDst_Mahoney_score;
     }
+    */
     
     // Update stats for packet sender
     ip_statistics[ipAddressSender].kbytes_sent += (float(bytesSent) / 1024);
     ip_statistics[ipAddressSender].pkts_sent++;
     // Aidmar
-    ip_statistics[ipAddressSender].pktsSentTimestamp.push_back(timestamp);
+    //ip_statistics[ipAddressSender].pktsSentTimestamp.push_back(timestamp);
     
-    // Aidmar - calculate packet rate (assumption: max_pkt_rate=1/smallest time between two consecutive pkts)
+    //// Aidmar - calculate packet rate (assumption: max_pkt_rate=1/smallest time between two consecutive pkts)
     // resulting in very big rates, therefore it could be better to calculate pkt rate on time intervals
     /*if(ip_statistics[ipAddressSender].pktsSentTimestamp.size() > 0){
     std::chrono::microseconds temp_pkt_consecutive_time = timestamp - ip_statistics[ipAddressSender].pktsSentTimestamp.back();
@@ -434,7 +439,7 @@ void statistics::addIpStat_packetSent(std::string filePath, std::string ipAddres
     ip_statistics[ipAddressReceiver].kbytes_received += (float(bytesSent) / 1024);
     ip_statistics[ipAddressReceiver].pkts_received++;  
      // Aidmar
-    ip_statistics[ipAddressReceiver].pktsReceivedTimestamp.push_back(timestamp);
+    //ip_statistics[ipAddressReceiver].pktsReceivedTimestamp.push_back(timestamp);
 }
 
 /**