mirror of https://github.com/MISP/misp-dashboard
339 lines
14 KiB
HTML
339 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta name="description" content="">
|
|
<meta name="author" content="">
|
|
|
|
<title>Misp live dashboard</title>
|
|
|
|
<!-- Bootstrap Core CSS -->
|
|
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
|
<!-- Custom CSS -->
|
|
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
|
|
<!-- Custom Fonts -->
|
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.2.0/dist/leaflet.css"
|
|
integrity="sha512-M2wvCLH6DSRazYeZRIm1JnYyh22purTM+FDB5CsyxtQJYeKq83arPe5wgbNmcFXGqiSH2XR8dT/fJISVA1r/zQ=="
|
|
crossorigin=""/>
|
|
<script src="https://unpkg.com/leaflet@1.2.0/dist/leaflet.js"
|
|
integrity="sha512-lInM/apFSqyy1o6s89K4iQUKg6ppXEgsVxT35HbzUupEVRh2Eu9Wdl4tHj7dZO0s1uvplcYGmt3498TtHq+log=="
|
|
crossorigin=""></script>
|
|
|
|
</head>
|
|
|
|
<style>
|
|
.panel-body {
|
|
padding: 0px;
|
|
}
|
|
|
|
.col-lg-6 {
|
|
padding-right: 5px;
|
|
padding-left: 5px;
|
|
}
|
|
|
|
.leftSepa {
|
|
border-left-color: rgb(221, 221, 221);
|
|
border-left-style: solid;
|
|
border-left-width: 2px;
|
|
padding-left: 8px;
|
|
}
|
|
|
|
.textTopHeader {
|
|
height: 50px;
|
|
text-align: center;
|
|
margin-left: 8px;
|
|
float: left;
|
|
padding-top: 9px;
|
|
}
|
|
|
|
.center {
|
|
display:block;
|
|
margin-left:auto;
|
|
margin-right:auto;
|
|
}
|
|
|
|
small {
|
|
font-size: 100%;
|
|
font-weight: bold;
|
|
}
|
|
|
|
</style>
|
|
|
|
<body>
|
|
|
|
<div id="wrapper">
|
|
|
|
<!-- Navigation -->
|
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0; padding-left: 15px;">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand" href="{{ url_for('geo') }}">Misp Geolocalization</a>
|
|
<div id="ledsHolder" style="float: right; height: 50px;">
|
|
<div class='leftSepa textTopHeader'>
|
|
<strong>Zoom level:</strong>
|
|
<select id="zoom_selector">
|
|
<option value="18">18</option>
|
|
<option value="17">17</option>
|
|
<option value="15" selected>15</option>
|
|
<option value="13">13</option>
|
|
<option value="11">11</option>
|
|
<option value="9">9</option>
|
|
<option value="7">7</option>
|
|
</select>
|
|
</div>
|
|
<div class='leftSepa textTopHeader'>
|
|
<strong>Date: <input type="text" id="datepicker" size="30" style="margin-bottom: 5px;"></strong>
|
|
</div>
|
|
<div id="alertUpdate" class="textTopHeader alert alert-info" style="margin-left: 100px; Display: none;">Maps updated</div>
|
|
</div>
|
|
</div>
|
|
<!-- /.navbar-header -->
|
|
|
|
</nav>
|
|
|
|
<!-- Page Content -->
|
|
<div id="page-wrapper" style="margin: 0px; padding: 0px;">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div style="height: 10px;"></div>
|
|
<div class="col-lg-6">
|
|
|
|
<div class="col-lg-6">
|
|
<div class="panel panel-default" style="">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="topMap1Header">1. Top location</b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="">
|
|
<div id="topMap1" style="width:100%; height: calc(75vh / 3);"></div>
|
|
</div>
|
|
</div><!-- /.panel-body -->
|
|
|
|
<div class="panel panel-default" style="">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="topMap3Header">3. Top location</b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="">
|
|
<div id="topMap3" style="width:100%; height: calc(75vh / 3);"></div>
|
|
</div>
|
|
</div><!-- /.panel-body -->
|
|
|
|
<div class="panel panel-default" style="">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="topMap5Header">5. Top location</b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="">
|
|
<div id="topMap5" style="width:100%; height: calc(75vh / 3);"></div>
|
|
</div>
|
|
</div><!-- /.panel-body -->
|
|
</div><!-- /.col-lg-6-6 -->
|
|
|
|
<div class="col-lg-6">
|
|
<div class="panel panel-default" style="">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="topMap2Header">2. Top location</b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="">
|
|
<div id="topMap2" style="width:100%; height: calc(75vh / 3);"></div>
|
|
</div>
|
|
</div><!-- /.panel-body -->
|
|
|
|
<div class="panel panel-default" style="">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="topMap4Header">4. Top location</b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="">
|
|
<div id="topMap4" style="width:100%; height: calc(75vh / 3);"></div>
|
|
</div>
|
|
</div><!-- /.panel-body -->
|
|
|
|
<div class="panel panel-default" style="">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="topMap6Header">6. Top location</b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="">
|
|
<div id="topMap6" style="width:100%; height: calc(75vh / 3);"></div>
|
|
</div>
|
|
</div><!-- /.panel-body -->
|
|
</div><!-- /.col-lg-6-6 -->
|
|
|
|
</div><!-- /.col-lg-6 -->
|
|
|
|
<div class="col-lg-6">
|
|
|
|
<div class="panel panel-default" style="height: 100%;">
|
|
<div class="panel-heading bg-info" style="font-weight: bold;">
|
|
<b id="worldMapHeader">Hit map </b>
|
|
</div>
|
|
<div id="panelbody" class="panel-body" style="height: 100%;">
|
|
<div id="worldMap" style="width:100%; height: 88vh; position: relative;"></div>
|
|
</div>
|
|
<!-- /.panel-body -->
|
|
|
|
</div><!-- /.panel -->
|
|
|
|
</div><!-- /.col-lg-6 -->
|
|
|
|
</div><!-- /.col-lg-12 -->
|
|
</div><!-- /.row -->
|
|
|
|
</div> <!-- /.container-fluid -->
|
|
|
|
</div>
|
|
<!-- /#page-wrapper -->
|
|
|
|
</div>
|
|
<!-- /#wrapper -->
|
|
|
|
<!-- jQuery -->
|
|
<script src="{{ url_for('static', filename='js/jquery.min.js') }}"></script>
|
|
<!-- jQuery flot -->
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.pie.min.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.resize.js') }}"></script>
|
|
<!-- Bootstrap Core JavaScript -->
|
|
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
|
|
|
<link href="{{ url_for('static', filename='css/font-awesome.min.css') }}" rel="text/css">
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/jquery-jvectormap-2.0.3.css') }}" type="text/css" media="screen"/>
|
|
<script src="{{ url_for('static', filename='js/jquery-jvectormap-2.0.3.min.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/jquery-jvectormap-world-mill.js') }}"></script>
|
|
<link href="{{ url_for('static', filename='css/jquery-ui.min.css') }}" rel="stylesheet" type="text/css" />
|
|
<script src="{{ url_for('static', filename='js/jquery-ui.min.js') }}"></script>
|
|
|
|
<!-- Index -->
|
|
<script>
|
|
var regionhitsMax = 10;
|
|
var regionhits = {};
|
|
|
|
const OSMURL='http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|
const OSMATTRIB='Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors';
|
|
var ZOOMLEVEL = 15;
|
|
var updateFrequency = 1000*60*60*1 //1h
|
|
var allOpenStreetMap = {};
|
|
var savedMarker = {};
|
|
var datePickerWidget;
|
|
|
|
for(var i=1; i<7; i++) {
|
|
allOpenStreetMap[i] = L.map('topMap'+i).setView([0, 0], 0);
|
|
new L.TileLayer(OSMURL, {minZoom: 0, maxZoom: 18}).addTo(allOpenStreetMap[i]);
|
|
}
|
|
|
|
var vectorMapConfig = {
|
|
map: 'world_mill',
|
|
markers: [],
|
|
series: {
|
|
regions: [{
|
|
values: [],
|
|
min: 0,
|
|
max: 10,
|
|
scale: ['#003FBF','#0063BF','#0087BF','#00ACBF','#00BFAD','#00BF89','#00BF64','#00BF40','#00BF1C','#08BF00','#2CBF00','#51BF00','#75BF00','#99BF00','#BEBF00','#BF9B00','#BF7700','#BF5200','#BF2E00','#BF0900'],
|
|
normalizeFunction: 'linear',
|
|
legend: {
|
|
horizontal: true
|
|
}
|
|
}]
|
|
},
|
|
onRegionTipShow: function(e, el, code){
|
|
el.html(el.html()+' ('+regionhits[code]+')');
|
|
}
|
|
}
|
|
|
|
|
|
function updateTopMaps(dayNum) {
|
|
$.getJSON("{{ url_for('getTopCoord') }}?dayNum="+dayNum, function(list){
|
|
for(var i=0; i<6 && i<list.length; i++) {
|
|
// create marker + flyToIt
|
|
coordJson = JSON.parse(list[i][0]);
|
|
allOpenStreetMap[i+1].flyTo([coordJson.lat, coordJson.lon], ZOOMLEVEL);
|
|
|
|
// update marker
|
|
var markerToUpdate = savedMarker[i+1];
|
|
if (markerToUpdate != undefined) {
|
|
markerToUpdate.setLatLng({lat: coordJson.lat, lng: coordJson.lon});
|
|
markerToUpdate._popup._content = 'lat: '+coordJson.lat+', lon: '+coordJson.lon+' - '+list[i][1];
|
|
markerToUpdate.update();
|
|
} else { // create new marker
|
|
var marker = L.marker([coordJson.lat, coordJson.lon]).addTo(allOpenStreetMap[i+1]);
|
|
savedMarker[i+1] = marker;
|
|
marker.bindPopup('lat: '+coordJson.lat+', lon: '+coordJson.lon+' - '+list[i][1]).openPopup();
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
function updateWorldMap(dayNum) {
|
|
$.getJSON("{{ url_for('getHitMap') }}?dayNum="+dayNum, function(list){
|
|
for(var i=0; i<list.length; i++) {
|
|
var rCode = list[i][0];
|
|
var rNum = list[i][1];
|
|
update_region(rCode, rNum);
|
|
}
|
|
});
|
|
}
|
|
|
|
function update_region(regionCode, num) {
|
|
regionhits[regionCode] = num;
|
|
// Force recomputation of min and max for correct color scaling
|
|
regionhitsMax = regionhitsMax >= regionhits[regionCode] ? regionhitsMax : regionhits[regionCode];
|
|
worldMapObj.series.regions[0].params.max = regionhitsMax;
|
|
worldMapObj.series.regions[0].legend.render();
|
|
// Update data
|
|
worldMapObj.series.regions[0].setValues(regionhits);
|
|
}
|
|
|
|
function days_between(date1, date2) {
|
|
var ONEDAY = 60*60*24*1000;
|
|
var diff_ms = Math.abs(date1.getTime() - date2.getTime());
|
|
return Math.round(diff_ms/ONEDAY);
|
|
}
|
|
|
|
function updateAll() {
|
|
var currentDate = datePickerWidget.datepicker( "getDate" );
|
|
var now = new Date();
|
|
var numDay = days_between(now, currentDate);
|
|
updateTopMaps(numDay);
|
|
updateWorldMap(numDay);
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
$('#worldMap').vectorMap(vectorMapConfig);
|
|
worldMapObj = $("#worldMap").vectorMap('get','mapObject');
|
|
|
|
/* Create the datepicker and button*/
|
|
var datePickerOptions = {
|
|
showOn: "button",
|
|
minDate: -31,
|
|
maxDate: 0,
|
|
buttonImage: "{{ url_for('static', filename='pics/calendar.gif') }}",
|
|
buttonImageOnly: true,
|
|
buttonText: "Select date",
|
|
showAnim: "slideDown",
|
|
onSelect: updateAll
|
|
};
|
|
datePickerWidget = $( "#datepicker" )
|
|
datePickerWidget.datepicker(datePickerOptions);
|
|
datePickerWidget.datepicker("setDate", new Date());
|
|
|
|
$( "#zoom_selector" ).change(function() {
|
|
var sel = parseInt($( this ).val());
|
|
ZOOMLEVEL = sel;
|
|
updateAll();
|
|
});
|
|
|
|
updateAll();
|
|
setInterval(function(){
|
|
updateAll();
|
|
$("#alertUpdate").fadeIn(2200).fadeOut(2200);
|
|
}, updateFrequency);
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|