mirror of https://github.com/MISP/misp-dashboard
Added possibility to display any fields form zmq + possibility to display for objects
parent
724157f9e5
commit
c566cea338
|
@ -19,7 +19,7 @@ zoomlevel = 11
|
||||||
clusteringDistance = 10
|
clusteringDistance = 10
|
||||||
|
|
||||||
[Log]
|
[Log]
|
||||||
fieldname_order=["Event.id", "Attribute.category", "Attribute.type", ["Attribute.value", "Attribute.comment"]]
|
fieldname_order=["Event.id", "Attribute.Tag", "Attribute.category", "Attribute.type", ["Attribute.value", "Attribute.comment"]]
|
||||||
#fieldname_order=["id", "category", "type", ["value", "comment"]]
|
#fieldname_order=["id", "category", "type", ["value", "comment"]]
|
||||||
char_separator=||
|
char_separator=||
|
||||||
|
|
||||||
|
|
|
@ -265,18 +265,37 @@ function slideAndMax(orig, newData) {
|
||||||
return [curMaxDataNumLog, slided];
|
return [curMaxDataNumLog, slided];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addObjectToLog(name, obj, td) {
|
||||||
|
if(name == "Tag") {
|
||||||
|
td.appendChild(document.createTextNode('tag'));
|
||||||
|
} else if (name == "mispObject") {
|
||||||
|
td.appendChild(document.createTextNode('mispObj'));
|
||||||
|
} else {
|
||||||
|
td.appendChild(document.createTextNode('nop'));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function createRow(tableBody, log) {
|
function createRow(tableBody, log) {
|
||||||
var tr = document.createElement('TR');
|
var tr = document.createElement('TR');
|
||||||
|
|
||||||
for (var key in log) {
|
for (var key in log) {
|
||||||
if (log.hasOwnProperty(key)) {
|
if (log.hasOwnProperty(key)) {
|
||||||
var td = document.createElement('TD');
|
var td = document.createElement('TD');
|
||||||
|
if(typeof log[key] === 'object') { //handle list of objects
|
||||||
|
theObj = log[key];
|
||||||
|
for(var objI in theObj.data) {
|
||||||
|
addObjectToLog(theObj.name, theObj.data[objI], td);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
var textToAddArray = log[key].split(char_separator);
|
var textToAddArray = log[key].split(char_separator);
|
||||||
for(var i in textToAddArray){
|
for(var i in textToAddArray){
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
td.appendChild(document.createElement("br"));
|
td.appendChild(document.createElement("br"));
|
||||||
td.appendChild(document.createTextNode(textToAddArray[i]));
|
td.appendChild(document.createTextNode(textToAddArray[i]));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
tr.appendChild(td);
|
tr.appendChild(td);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,22 @@ def getCoordAndPublish(zmq_name, supposed_ip, categ):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("can't resolve ip")
|
print("can't resolve ip")
|
||||||
|
|
||||||
|
def getFields(obj, fields):
|
||||||
|
jsonWalker = fields.split('.')
|
||||||
|
itemToExplore = obj
|
||||||
|
lastName = ""
|
||||||
|
try:
|
||||||
|
for i in jsonWalker:
|
||||||
|
itemToExplore = itemToExplore[i]
|
||||||
|
lastName = i
|
||||||
|
if type(itemToExplore) is list:
|
||||||
|
return { 'name': lastName , 'data': itemToExplore }
|
||||||
|
else:
|
||||||
|
return itemToExplore
|
||||||
|
except KeyError as e:
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
##############
|
##############
|
||||||
## HANDLERS ##
|
## HANDLERS ##
|
||||||
##############
|
##############
|
||||||
|
@ -115,14 +131,6 @@ def handler_event(zmq_name, jsonevent):
|
||||||
else:
|
else:
|
||||||
handler_attribute(zmq_name, attributes)
|
handler_attribute(zmq_name, attributes)
|
||||||
|
|
||||||
|
|
||||||
def getFields(obj, fields):
|
|
||||||
jsonWalker = fields.split('.')
|
|
||||||
itemToExplore = obj
|
|
||||||
for i in jsonWalker:
|
|
||||||
itemToExplore = itemToExplore[i]
|
|
||||||
return itemToExplore
|
|
||||||
|
|
||||||
def handler_attribute(zmq_name, jsonobj):
|
def handler_attribute(zmq_name, jsonobj):
|
||||||
# check if jsonattr is an attribute object
|
# check if jsonattr is an attribute object
|
||||||
if 'Attribute' in jsonobj:
|
if 'Attribute' in jsonobj:
|
||||||
|
|
Loading…
Reference in New Issue