aidmar.wainakh hace 6 años
padre
commit
a0555e1e52
Se han modificado 2 ficheros con 6 adiciones y 2 borrados
  1. 5 1
      code/ID2TLib/Statistics.py
  2. 1 1
      code_boost/src/cxx/pcap_processor.cpp

+ 5 - 1
code/ID2TLib/Statistics.py

@@ -261,7 +261,11 @@ class Statistics:
 
         result = self.stats_db._process_user_defined_query("SELECT SUM(mssCount) FROM tcp_mss_dist WHERE mssValue > 536 AND mssValue < 1460")
         # The most used range of MSS: 536 < MSS < 1460. Calculate the ratio of the values in this range to total values.
-        mss5361460 = (result[0][0] / sum(frequency)) * 100
+        if not result[0][0]:
+            result = 0
+        else:
+            result = result[0][0]
+        mss5361460 = (result / sum(frequency)) * 100
 
         return [("Payload ratio", payloadRatio, "%"),
                 ("Incorrect TCP checksum ratio", incorrectChecksumRatio, "%"),

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

@@ -130,7 +130,7 @@ void pcap_processor::collect_statistics() {
         for (SnifferIterator j = snifferOverview.begin(); j != snifferOverview.end();  snifferIteratorIncrement(j)) {lastpkt = j;}          
         std::chrono::high_resolution_clock::time_point t2 = std::chrono::high_resolution_clock::now();
         auto duration = std::chrono::duration_cast<std::chrono::microseconds>( t2 - t1 ).count()*1e-6;
-        std::cout<< "empty loop: " << duration << " sec" << std::endl;            
+        //std::cout<< "empty loop: " << duration << " sec" << std::endl;
         std::chrono::microseconds lastTimestamp = lastpkt->timestamp();                  
         std::chrono::microseconds captureDuration = lastTimestamp - firstTimestamp;
         if(captureDuration.count()<=0){