瀏覽代碼

add normalized ip novelty entropies

Jens Keim 5 年之前
父節點
當前提交
dffc4879f1
共有 2 個文件被更改,包括 14 次插入2 次删除
  1. 13 1
      code_boost/src/cxx/statistics_db.cpp
  2. 1 1
      code_boost/src/cxx/statistics_db.h

+ 13 - 1
code_boost/src/cxx/statistics_db.cpp

@@ -709,10 +709,14 @@ void statistics_db::writeStatisticsInterval(const std::unordered_map<std::string
                     "ipDstCumEntropyNormalized REAL,"
                     "ipSrcNovelEntropy REAL,"
                     "ipDstNovelEntropy REAL,"
+                    "ipSrcNovelEntropyNormalized REAL,"
+                    "ipDstNovelEntropyNormalized REAL,"
                     "PRIMARY KEY(lastPktTimestamp));");
 
             double ip_src_entropy = 0.0;
             double ip_dst_entropy = 0.0;
+            double ip_src_novel_entropy = 0.0;
+            double ip_dst_novel_entropy = 0.0;
             double ip_src_cum_entropy = 0.0;
             double ip_dst_cum_entropy = 0.0;
             double ttl_entropy = 0.0;
@@ -733,6 +737,12 @@ void statistics_db::writeStatisticsInterval(const std::unordered_map<std::string
                 if (ip_dst_entropy < e.ip_dst_entropy) {
                     ip_dst_entropy = e.ip_dst_entropy;
                 }
+                if (ip_src_novel_entropy < e.ip_src_novel_entropy) {
+                    ip_src_novel_entropy = e.ip_src_novel_entropy;
+                }
+                if (ip_dst_novel_entropy < e.ip_dst_novel_entropy) {
+                    ip_dst_novel_entropy = e.ip_dst_novel_entropy;
+                }
                 if (ip_src_cum_entropy < e.ip_src_cum_entropy) {
                     ip_src_cum_entropy = e.ip_src_cum_entropy;
                 }
@@ -771,7 +781,7 @@ void statistics_db::writeStatisticsInterval(const std::unordered_map<std::string
                 }
             }
 
-            SQLite::Statement query(*db, "INSERT INTO " + table_name + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
+            SQLite::Statement query(*db, "INSERT INTO " + table_name + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
             for (auto it = intervalStatistics.begin(); it != intervalStatistics.end(); ++it) {
                 const entry_intervalStat &e = it->second;
 
@@ -821,6 +831,8 @@ void statistics_db::writeStatisticsInterval(const std::unordered_map<std::string
                 query.bind(44, e.ip_dst_cum_entropy/ip_dst_cum_entropy);
                 query.bind(45, e.ip_src_novel_entropy);
                 query.bind(46, e.ip_dst_novel_entropy);
+                query.bind(47, e.ip_src_novel_entropy/ip_src_novel_entropy);
+                query.bind(48, e.ip_dst_novel_entropy/ip_dst_novel_entropy);
                 query.exec();
                 query.reset();
 

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

@@ -25,7 +25,7 @@ public:
     /*
      * Database version: Increment number on every change in the C++ code!
      */
-    static const int DB_VERSION = 22;
+    static const int DB_VERSION = 23;
 
     /*
      * Methods to read from database