2016-07-25 14:38:57 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
|
|
|
|
<title>Analysis Information Leak framework Dashboard</title>
|
|
|
|
|
|
|
|
<!-- Core CSS -->
|
|
|
|
<link href="{{ url_for('static', filename='css/bootstrap.min.css') }}" rel="stylesheet">
|
|
|
|
<link href="{{ url_for('static', filename='font-awesome/css/font-awesome.css') }}" rel="stylesheet">
|
|
|
|
<link href="{{ url_for('static', filename='css/sb-admin-2.css') }}" rel="stylesheet">
|
|
|
|
<link href="{{ url_for('static', filename='css/dygraph_gallery.css') }}" rel="stylesheet" type="text/css" />
|
|
|
|
<!-- JS -->
|
|
|
|
<script type="text/javascript" src="{{ url_for('static', filename='js/dygraph-combined.js') }}"></script>
|
|
|
|
<script language="javascript" src="{{ url_for('static', filename='js/jquery.js')}}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.pie.js') }}"></script>
|
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.time.js') }}"></script>
|
2016-07-26 14:56:52 +00:00
|
|
|
<script src="{{ url_for('static', filename='js/jquery.flot.stack.js') }}"></script>
|
2016-07-25 14:38:57 +00:00
|
|
|
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
|
|
|
|
<div id="wrapper">
|
|
|
|
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
|
|
|
<div class="navbar-header">
|
|
|
|
<ul class="nav navbar-nav">
|
|
|
|
<li><a href="{{ url_for('index') }}"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a></li>
|
|
|
|
<li class="active"><a href="{{ url_for('trending') }}"><i class="glyphicon glyphicon-stats"></i> Trending charts</a></li>
|
|
|
|
<li class="active"><a href="{{ url_for('moduletrending') }}"><i class="glyphicon glyphicon-stats"></i> Modules statistics</a></li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<!-- /.navbar-top-links -->
|
|
|
|
<div class="navbar-default sidebar" role="navigation">
|
|
|
|
<div class="sidebar-collapse">
|
|
|
|
<ul class="nav" id="side-menu">
|
|
|
|
<li class="sidebar-search">
|
|
|
|
{% include 'searchbox.html' %}
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<!-- /#side-menu -->
|
|
|
|
</div>
|
|
|
|
<!-- /.sidebar-collapse -->
|
|
|
|
<a href="{{ url_for('index') }}"><img src="{{ url_for('static', filename='image/AIL.png') }}" /></a>
|
|
|
|
</div>
|
|
|
|
<!-- /.navbar-static-side -->
|
|
|
|
</nav>
|
|
|
|
<div id="page-wrapper">
|
|
|
|
</br>
|
|
|
|
{% include 'trending_graphs/Moduletrending.html' %}
|
|
|
|
</div>
|
|
|
|
<!-- /#page-wrapper -->
|
|
|
|
|
|
|
|
<script>
|
|
|
|
$(document).ready(function(){
|
|
|
|
/* Already defined variable (Before the input)
|
|
|
|
*
|
|
|
|
* var chart_1_num_day = 5;
|
|
|
|
* var chart_2_num_day = 15;
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
plot_top_graph("credential");
|
|
|
|
plot_top_graph("mail");
|
|
|
|
plot_top_graph("size");
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var chart_1_num_day = 5;
|
|
|
|
var chart_2_num_day = 15;
|
|
|
|
$SCRIPT_ROOT = {{ request.script_root|tojson|safe }};
|
|
|
|
|
2016-07-26 14:56:52 +00:00
|
|
|
|
|
|
|
function labelFormatter(label, series) {
|
|
|
|
return "<div style='font-size:8pt; text-align:center; padding:2px; color:white;'>"
|
|
|
|
+ label + "<br/>" + Math.round(series.percent) + "%</div>";
|
|
|
|
}
|
|
|
|
|
2016-07-25 14:38:57 +00:00
|
|
|
function plot_top_graph(module_name){
|
|
|
|
/**** Flot Pie Chart ****/
|
|
|
|
var options = {
|
2016-07-26 14:56:52 +00:00
|
|
|
series: { pie: { show: true,
|
|
|
|
radius: 3/5,
|
|
|
|
combine: {
|
|
|
|
color: '#999',
|
|
|
|
threshold: 0.05
|
|
|
|
},
|
|
|
|
label: {
|
|
|
|
show: true,
|
|
|
|
radius: 1,
|
|
|
|
formatter: labelFormatter,
|
|
|
|
background: {
|
|
|
|
opacity: 0.5,
|
|
|
|
color: '#000'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2016-07-25 14:38:57 +00:00
|
|
|
grid: { hoverable: true, clickable: true },
|
2016-07-26 14:56:52 +00:00
|
|
|
legend: { show: false },
|
|
|
|
|
2016-07-25 14:38:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-07-26 08:45:02 +00:00
|
|
|
var moduleCharts = "size" == module_name ? "sizeCharts" : "moduleCharts";
|
2016-07-26 14:56:52 +00:00
|
|
|
var tot_sum = 0;
|
|
|
|
var data_other = [];
|
2016-07-25 14:38:57 +00:00
|
|
|
// Graph1
|
|
|
|
$.getJSON($SCRIPT_ROOT+"/_"+moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day,
|
|
|
|
function(data) {
|
2016-07-26 08:45:02 +00:00
|
|
|
var temp_data_pie = [];
|
2016-07-25 14:38:57 +00:00
|
|
|
for(i=0; i<data.length; i++){
|
2016-07-26 10:07:52 +00:00
|
|
|
if (i==0 && data[0][0] == "passed_days"){ //If there is no data today, take it from the past
|
|
|
|
if (data[0][1] > 0 && data[0][1] < 7){
|
|
|
|
$("#day-"+module_name).text(data[0][1] + " Day(s) ago ");
|
2016-07-26 14:56:52 +00:00
|
|
|
$("#panel-"+module_name).removeClass("panel-green")
|
|
|
|
$("#panel-"+module_name).addClass("panel-yellow")
|
2016-07-26 10:07:52 +00:00
|
|
|
} else if (data[0][1] > 6) {
|
|
|
|
$("#day-"+module_name).text(data[0][1] + " Day(s) ago ");
|
2016-07-26 14:56:52 +00:00
|
|
|
$("#panel-"+module_name).removeClass("panel-green")
|
|
|
|
$("#panel-"+module_name).addClass("panel-red")
|
2016-07-26 10:07:52 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
temp_data_pie.push({label: data[i][0], data: data[i][1]});
|
2016-07-26 14:56:52 +00:00
|
|
|
tot_sum += data[i][1]
|
2016-07-26 10:07:52 +00:00
|
|
|
}
|
2016-07-25 14:38:57 +00:00
|
|
|
}
|
2016-07-26 14:56:52 +00:00
|
|
|
for(i=0; i<temp_data_pie.length; i++){
|
|
|
|
if (parseInt(temp_data_pie[i].data) / tot_sum < 0.05)
|
|
|
|
data_other.push(temp_data_pie[i].label);
|
|
|
|
}
|
2016-07-25 14:38:57 +00:00
|
|
|
$.plot($("#flot-pie-chart-"+module_name), temp_data_pie, options);
|
|
|
|
setTimeout(function() {
|
|
|
|
$("#flot-pie-chart-"+module_name).bind("plotclick", function (event, pos, item) {
|
|
|
|
if (item == null)
|
|
|
|
return;
|
|
|
|
var clicked_label = item.series.label;
|
2016-07-26 08:45:02 +00:00
|
|
|
update_bar_chart(moduleCharts, "#flot-bar-chart-"+module_name, clicked_label, item.series.color, chart_1_num_day, "%m/%d");
|
2016-07-25 14:38:57 +00:00
|
|
|
});
|
|
|
|
}, 500);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// flot bar char
|
2016-07-26 08:45:02 +00:00
|
|
|
function update_bar_chart(chartUrl, chartID, involved_item, serie_color, num_day, timeformat){
|
2016-07-25 14:38:57 +00:00
|
|
|
var barOptions = {
|
|
|
|
series: {
|
|
|
|
bars: { show: true, barWidth: 82800000 }
|
|
|
|
},
|
|
|
|
xaxis: {
|
|
|
|
mode: "time",
|
|
|
|
timeformat: timeformat,
|
|
|
|
tickSize: [1, 'day'],
|
|
|
|
minTickSize: [1, "day"]
|
|
|
|
},
|
|
|
|
grid: { hoverable: true },
|
2016-07-26 14:56:52 +00:00
|
|
|
legend: { show: true,
|
|
|
|
noColumns: 0,
|
|
|
|
position: "nw"
|
|
|
|
},
|
2016-07-25 14:38:57 +00:00
|
|
|
tooltip: true,
|
|
|
|
tooltipOpts: { content: "x: %x, y: %y" }
|
|
|
|
};
|
2016-07-26 14:56:52 +00:00
|
|
|
|
|
|
|
if (involved_item == "Other"){
|
|
|
|
var all_other_temp_data = []
|
|
|
|
var temp_data_bar = []
|
|
|
|
for(i=0; i<data_other.length; i++){
|
|
|
|
$.getJSON($SCRIPT_ROOT+"/_"+chartUrl+"?keywordName="+data_other[i]+"&moduleName="+module_name+"&bar=true"+"&days="+num_day,
|
|
|
|
function(data) {
|
|
|
|
temp_data_bar = []
|
|
|
|
for(i=0; i<data.length; i++){
|
|
|
|
var curr_date = data[i][0].split('/');
|
|
|
|
temp_data_bar.push([new Date(curr_date[0], curr_date[1]-1, curr_date[2]), data[i][1]]);
|
|
|
|
}
|
|
|
|
all_other_temp_data.push(temp_data_bar);
|
|
|
|
});
|
2016-07-25 14:38:57 +00:00
|
|
|
var barData = {
|
|
|
|
label: involved_item,
|
2016-07-26 14:56:52 +00:00
|
|
|
data: all_other_temp_data,
|
2016-07-25 14:38:57 +00:00
|
|
|
color: serie_color
|
|
|
|
};
|
2016-07-26 14:56:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
var dataBar = []
|
|
|
|
for(i=0; i<data_other.length; i++)
|
|
|
|
dataBar.push({label: data_other[i], data: all_other_temp_data[i]})
|
|
|
|
$.plot($(chartID), dataBar, {
|
|
|
|
series: {
|
|
|
|
stack: true,
|
|
|
|
lines: { show: false, fill: true, steps: false },
|
|
|
|
bars: { show: true, barWidth: 82800000 },
|
|
|
|
},
|
|
|
|
xaxis: {
|
|
|
|
mode: "time",
|
|
|
|
timeformat: timeformat,
|
|
|
|
tickSize: [1, 'day'],
|
|
|
|
minTickSize: [1, "day"]
|
|
|
|
},
|
|
|
|
grid: { hoverable: true },
|
|
|
|
legend: { show: true,
|
|
|
|
noColumns: 1,
|
|
|
|
position: "nw"
|
|
|
|
},
|
|
|
|
tooltip: true,
|
|
|
|
tooltipOpts: { content: "x: %x, y: %y" }
|
|
|
|
});
|
|
|
|
}, 750);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$.getJSON($SCRIPT_ROOT+"/_"+chartUrl+"?keywordName="+involved_item+"&moduleName="+module_name+"&bar=true"+"&days="+num_day,
|
|
|
|
function(data) {
|
|
|
|
var temp_data_bar = []
|
|
|
|
for(i=0; i<data.length; i++){
|
|
|
|
var curr_date = data[i][0].split('/');
|
|
|
|
temp_data_bar.push([new Date(curr_date[0], curr_date[1]-1, curr_date[2]), data[i][1]]);
|
|
|
|
}
|
|
|
|
var barData = {
|
|
|
|
label: involved_item,
|
|
|
|
data: temp_data_bar,
|
|
|
|
color: serie_color
|
|
|
|
};
|
|
|
|
$.plot($(chartID), [barData], barOptions);
|
|
|
|
});
|
|
|
|
}
|
2016-07-25 14:38:57 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<script src="{{ url_for('static', filename='js/bootstrap.min.js') }}"></script>
|
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|