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
|
||||
|
||||
[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"]]
|
||||
char_separator=||
|
||||
|
||||
|
|
|
@ -265,17 +265,36 @@ function slideAndMax(orig, newData) {
|
|||
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) {
|
||||
var tr = document.createElement('TR');
|
||||
|
||||
for (var key in log) {
|
||||
if (log.hasOwnProperty(key)) {
|
||||
var td = document.createElement('TD');
|
||||
var textToAddArray = log[key].split(char_separator);
|
||||
for(var i in textToAddArray){
|
||||
if (i > 0)
|
||||
td.appendChild(document.createElement("br"));
|
||||
td.appendChild(document.createTextNode(textToAddArray[i]));
|
||||
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);
|
||||
for(var i in textToAddArray){
|
||||
if (i > 0)
|
||||
td.appendChild(document.createElement("br"));
|
||||
td.appendChild(document.createTextNode(textToAddArray[i]));
|
||||
}
|
||||
}
|
||||
tr.appendChild(td);
|
||||
}
|
||||
|
|
|
@ -86,6 +86,22 @@ def getCoordAndPublish(zmq_name, supposed_ip, categ):
|
|||
except ValueError:
|
||||
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 ##
|
||||
##############
|
||||
|
@ -115,14 +131,6 @@ def handler_event(zmq_name, jsonevent):
|
|||
else:
|
||||
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):
|
||||
# check if jsonattr is an attribute object
|
||||
if 'Attribute' in jsonobj:
|
||||
|
|
Loading…
Reference in New Issue