MISP / misp-dashboard

A live dashboard for a real-time overview of threat intelligence from MISP instances
GNU Affero General Public License v3.0
192 stars 66 forks source link

Bug: Attribute.category panel does not work as expected #172

Open Nicolas-Pellletier opened 1 year ago

Nicolas-Pellletier commented 1 year ago

Hello,

Expected behavior

On the misp-dashboard github page we see a preview of the MISP Live Dashboard. We can see the attribute.category panel that looks like the following:

image

Description:

_A graph that shows the occurence of several attributes.category over time against the attributes pushed to ZMQsubsrciber. The Y axis shows the number of occurrence observed for each category. The upper limit is fixed according to the number of the most populated attribute.category (Attribute number with this specific category). The X axis represent the time in hours that span on 48 hours. The line plot is supposed to shift to the left as the time pass.

Actual behavior image

1) Unfortunately the dashboard that i have let only see a plot line that shows the number of all categories observed for an attribute (not object attribute - only attribute) . As each attribute as always a category attached to it. each time an attribute is pushed to zmq_subscriber, the plot line goes up (as the total category number observed increase)

2) Furthermore we don't have the name of the attribute.category observed (just a yellow line)

3) I'm not sure, but i think that the plot line does not shift over time.

Nicolas-Pellletier commented 1 year ago

I change my mind i think it takes too much time to explain i'm just going to show you the few changes to make in order to make it work:

Here is a view of git diff ./static/js/index.js:

Change to made to ./static/js/index.js file:

@@ -195,8 +199,11 @@ function updateLogTable(name, log, zmqName, ignoreLed) {
     }

     // only add row for attribute
-    if (name == "Attribute" ) {
-        var categName = log[toPlotLocationLog];
+    if (name == "Attribute" || name == "ObjectAttribute") {
+       console.log("\n\nLOG\n\n");
+       console.dir(log);
+       //var categName = log[toPlotLocationLog];
+        var categName = log[3];
         sources.addIfNotPresent(categName);
         sources.incCountOnSource(categName);
         sources.incCountOnSource('global');

Change to made to static/js/index/index_lineChart.js file:

@@ -51,7 +55,9 @@ function updateChartDirect() {
     plotLineChart.getOptions().yaxes[0].max = sources.getGlobalMax();
     plotLineChart.setupGrid();
     plotLineChart.draw();
-    //setTimeout(updateChartDirect, updateIntervalDirect);
+    //console.log(updateIntervalDirect);
+    setTimeout(updateChartDirect, updateIntervalDirect);
+    
 }

-var updateInterval = 1000*60*60*graph_log_refresh_rate; // 1h
+var updateInterval = 1000*60*1*graph_log_refresh_rate; // 1 min

The one above is to see the shift more rapidly instead of showing category occurrence every hours it shows it every minutes.

@@ -8,7 +8,7 @@ var optionsLineChart = {
                 lines: { 
                     fill: true, 
                     fillColor: { 
-                        colors: [ { opacity: 1 }, { opacity: 0.1 } ]
+                        colors: [ { opacity: 0.1 }, { opacity: 0.1 } ]
                     }
                 }
             },

The one above is for styling purpose for one color not overlap another one (one category info not overlap another one)