mirror of https://github.com/MISP/misp-dashboard
Added support of custom categories from config
parent
6f3998df68
commit
4e396d2eb3
|
@ -22,6 +22,7 @@ clusteringDistance = 10
|
||||||
[CONTRIB]
|
[CONTRIB]
|
||||||
#[1.5 -> +inf]
|
#[1.5 -> +inf]
|
||||||
rankMultiplier = 2
|
rankMultiplier = 2
|
||||||
|
categories = ["internal_reference", "targeting_data", "antivirus_detection", "payload_delivery", "artifacts_dropped", "payload_installation", "persistence_mechanism", "network_activity", "payload_type", "attribution", "external_analysis", "financial_fraud", "support_Tool", "social_network", "person", "other" ]
|
||||||
|
|
||||||
[Log]
|
[Log]
|
||||||
field_to_plot = Attribute.category
|
field_to_plot = Attribute.category
|
||||||
|
|
63
server.py
63
server.py
|
@ -28,6 +28,8 @@ serv_redis_db = redis.StrictRedis(
|
||||||
port=cfg.getint('RedisGlobal', 'port'),
|
port=cfg.getint('RedisGlobal', 'port'),
|
||||||
db=cfg.getint('RedisDB', 'db'))
|
db=cfg.getint('RedisDB', 'db'))
|
||||||
|
|
||||||
|
categories = json.loads(cfg.get('CONTRIB', 'categories'))
|
||||||
|
|
||||||
subscriber_log = redis_server_log.pubsub(ignore_subscribe_messages=True)
|
subscriber_log = redis_server_log.pubsub(ignore_subscribe_messages=True)
|
||||||
subscriber_log.psubscribe(cfg.get('RedisLog', 'channel'))
|
subscriber_log.psubscribe(cfg.get('RedisLog', 'channel'))
|
||||||
subscriber_map = redis_server_map.pubsub(ignore_subscribe_messages=True)
|
subscriber_map = redis_server_map.pubsub(ignore_subscribe_messages=True)
|
||||||
|
@ -143,9 +145,13 @@ def geo():
|
||||||
|
|
||||||
@app.route("/contrib")
|
@app.route("/contrib")
|
||||||
def contrib():
|
def contrib():
|
||||||
|
categ_list = json.loads(cfg.get('CONTRIB', 'categories'))
|
||||||
|
categ_list_str = [ s[0].upper() + s[1:].replace('_', ' ') for s in json.loads(cfg.get('CONTRIB', 'categories'))]
|
||||||
return render_template('contrib.html',
|
return render_template('contrib.html',
|
||||||
currOrg="",
|
currOrg="",
|
||||||
rankMultiplier=cfg.getfloat('CONTRIB' ,'rankMultiplier')
|
rankMultiplier=cfg.getfloat('CONTRIB' ,'rankMultiplier'),
|
||||||
|
categ_list=json.dumps(categ_list),
|
||||||
|
categ_list_str=categ_list_str
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/_getLastContributor")
|
@app.route("/_getLastContributor")
|
||||||
|
@ -217,49 +223,18 @@ def getTop5Overtime():
|
||||||
|
|
||||||
@app.route("/_getCategPerContrib")
|
@app.route("/_getCategPerContrib")
|
||||||
def getCategPerContrib():
|
def getCategPerContrib():
|
||||||
data = [
|
|
||||||
{
|
data = []
|
||||||
'rank': random.randint(1,16),
|
for d in range(15):
|
||||||
'logo_path': 'logo1',
|
dic = {}
|
||||||
'org': 'CIRCL',
|
dic['rank'] = random.randint(1,16)
|
||||||
'network_activity': random.randint(100,1600),
|
dic['logo_path'] = 'logo'
|
||||||
'payload_delivery': random.randint(100,1600),
|
dic['org'] = 'Org'+str(d)
|
||||||
'others': random.randint(1,16)
|
for f in categories:
|
||||||
},
|
dic[f] = random.randint(0,1600)
|
||||||
{
|
data.append(dic)
|
||||||
'rank': random.randint(1,16),
|
|
||||||
'logo_path': 'logo2',
|
return jsonify(data)
|
||||||
'org': 'CASES',
|
|
||||||
'network_activity': random.randint(10,1600),
|
|
||||||
'payload_delivery': random.randint(10,1600),
|
|
||||||
'others': random.randint(1,16)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'rank': random.randint(1,16),
|
|
||||||
'logo_path': 'logo3',
|
|
||||||
'org': 'SMILE',
|
|
||||||
'network_activity': random.randint(1,160),
|
|
||||||
'payload_delivery': random.randint(1,160),
|
|
||||||
'others': random.randint(1,160)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'rank': random.randint(1,16),
|
|
||||||
'logo_path': 'logo4',
|
|
||||||
'org': 'ORG4',
|
|
||||||
'network_activity': random.randint(1,160),
|
|
||||||
'payload_delivery': random.randint(1,160),
|
|
||||||
'others': random.randint(1,16)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'rank': random.randint(1,16),
|
|
||||||
'logo_path': 'logo5',
|
|
||||||
'org': 'ORG5',
|
|
||||||
'network_activity': random.randint(1,16),
|
|
||||||
'payload_delivery': random.randint(1,16),
|
|
||||||
'others': random.randint(1,16)
|
|
||||||
},
|
|
||||||
]
|
|
||||||
return jsonify(data*2)
|
|
||||||
|
|
||||||
@app.route("/_getAllOrg")
|
@app.route("/_getAllOrg")
|
||||||
def getAllOrg():
|
def getAllOrg():
|
||||||
|
|
|
@ -56,6 +56,7 @@ var optionDatatable_Categ = {
|
||||||
responsive: true,
|
responsive: true,
|
||||||
searching: true,
|
searching: true,
|
||||||
scrollY: '39vh',
|
scrollY: '39vh',
|
||||||
|
"scrollX": true,
|
||||||
scrollCollapse: true,
|
scrollCollapse: true,
|
||||||
paging: false,
|
paging: false,
|
||||||
"info": false,
|
"info": false,
|
||||||
|
@ -251,10 +252,11 @@ $(document).ready(function() {
|
||||||
getRankIcon(row.rank),
|
getRankIcon(row.rank),
|
||||||
row.logo_path,
|
row.logo_path,
|
||||||
row.org,
|
row.org,
|
||||||
row.network_activity,
|
|
||||||
row.payload_delivery,
|
|
||||||
row.others
|
|
||||||
];
|
];
|
||||||
|
for (categ of categ_list) {
|
||||||
|
to_add.push(row[categ]);
|
||||||
|
}
|
||||||
|
|
||||||
datatableCateg.row.add(to_add);
|
datatableCateg.row.add(to_add);
|
||||||
}
|
}
|
||||||
datatableCateg.draw();
|
datatableCateg.draw();
|
||||||
|
|
|
@ -155,10 +155,9 @@
|
||||||
<th>#</th>
|
<th>#</th>
|
||||||
<th>Org rank</th>
|
<th>Org rank</th>
|
||||||
<th>Logo</th>
|
<th>Logo</th>
|
||||||
<th>Organization name</th>
|
{% for categ in categ_list_str %}
|
||||||
<th>Network Activity</th>
|
<th>{{ categ }}</th>
|
||||||
<th>Payload delivery</th>
|
{% endfor %}
|
||||||
<th>Others</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -239,6 +238,8 @@
|
||||||
/* DATA FROM CONF */
|
/* DATA FROM CONF */
|
||||||
var currOrg = "{{ currOrg }}";
|
var currOrg = "{{ currOrg }}";
|
||||||
var rankMultiplier = {{ rankMultiplier }};
|
var rankMultiplier = {{ rankMultiplier }};
|
||||||
|
var categ_list = JSON.parse('{{ categ_list|safe }}');
|
||||||
|
var categ_list_str = JSON.parse("{{ categ_list_str|safe }}");
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script src="{{ url_for('static', filename='js/contrib.js') }}"></script>
|
<script src="{{ url_for('static', filename='js/contrib.js') }}"></script>
|
||||||
|
|
Loading…
Reference in New Issue