-
Notifications
You must be signed in to change notification settings - Fork 11
/
Site_Statistics.html
383 lines (304 loc) · 12.6 KB
/
Site_Statistics.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Tell the browser to be responsive to screen width -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="Jonathan Gruber Imperva">
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="favico.png">
<title>Site Statistics Report</title>
<!-- CSS LIBRARIES -->
<!-- Bootstrap Core CSS -->
<link href="css/lib/bootstrap/bootstrap.min.css" rel="stylesheet">
<!-- Custom CSS -->
<link href="css/lib/calendar2/semantic.ui.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<body class="fix-header fix-sidebar">
<!-- page wrapper -->
<div class="main-wrapper">
<!-- HEADER BAR -->
<div class="header">
<nav class="navbar top-navbar navbar-expand-md navbar-light">
<!-- Logo -->
<div class="navbar-header>
<a class="navbar-brand" href="dashboard.php">
<!-- Dashboard logo icon -->
<b style="font-size:30;color:#37347F"><img src="incapse.png" alt="homepage" class="dark-logo" style=" height:auto;margin-right: 2.5em"/> </b>
</a>
</div>
<div class="navbar-collapse">
<!-- toggle and nav items -->
<ul class="navbar-nav mr-auto mt-md-0">
<!-- 3 LINES WHEN BROWSER COMPRESSED -->
<li class="nav-item m-l-4"> <a class="nav-link sidebartoggler hidden-sm-down text-muted " href="javascript:void(0)"><i class="fa fa-th-large"></i></a> </li>
</ul>
</div>
<!-- End Logo -->
</nav>
</div>
<!-- End header header -->
<!-- Left Sidebar -->
<div id="sidebar" class="left-sidebar">
</div>
<!-- End Left Sidebar -->
<!-- Container fluid pour page centrale -->
<div class="page-wrapper">
<!-- Bread crumb -->
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h3 class="text-primary">Site Statitics Tables</h3> </div>
<div class="col-md-7 align-self-center">
</div>
</div>
<!-- End Bread crumb -->
<div class="container-fluid">
<!-- ROW for Security Settings table summary <div class="col-lg-4" >-->
<div class="row">
<div class="card">
<div class="card-title">
<h4>Site Statistics Report</h4>
</div>
<br />
<div id="site_stats_div" style="overflow-x:auto;">
<table id="site_stats_table" class="display nowrap table table-hover table-striped table-bordered" data-page-length='25'>
<thead>
<tr>
<th>Site Name</th>
<th>Site Status</th>
<th>Total Visits</th>
<th>Human visitors (%)</th>
<th>Bot visitors (%)</th>
<th>Security Events</th>
<th>Cached Ratio %</th>
<th>Total Bw (Gbytes)</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Site Name</th>
<th>Site Status</th>
<th>Total Visits</th>
<th>Human visitors (%)</th>
<th>Bot visitors (%)</th>
<th>Security Events</th>
<th>Cached Ratio %</th>
<th>Total Bw (Gbytes)</th>
</tr>
</tfoot>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<!-- END ROW for security Settings table summary -->
<hr/>
<!-- ROW for Threat statistics table summary -->
<div class="row">
<div class="card">
<div class="card-title">
<h4>Security Statistics Account</h4>
</div>
<br />
<table class="table table-bordered table-striped table-hover table-responsive" id="api_list_stats">
<tr>
<th>Total Events</th>
<th>Bad Bots Events</th>
<th>XSS Incidents</th>
<th>SQLi Incidents</th>
<th>Illegal Resource Access</th>
<th>RFI Events</th>
<th>DDoS L7 Events</th>
</tr>
</table>
</div>
</div>
<!-- END ROW for Threat Statistics table summary -->
<hr/>
</div> <!-- end page wrapper-->
</body>
<!-- JS LIBRARIES -->
<script src="js/lib/jquery/jquery.min.js"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="js/lib/bootstrap/js/bootstrap.min.js"></script>
<script type='text/javascript' src='js\lib\datatables\datatables.min.js'></script>
<!--Menu sidebar -->
<script type='text/javascript' src='js\lib\datatables\cdn.datatables.net\buttons\1.2.2\js\datatables.buttons.min.js'></script>
<script type="text/javascript" src="https://cdn.datatables.net/r/dt/jq-2.1.4,jszip-2.5.0,pdfmake-0.1.18,dt-1.10.9,af-2.0.0,b-1.0.3,b-colvis-1.0.3,b-html5-1.0.3,b-print-1.0.3,se-1.0.1/datatables.min.js"></script>
<script src="js/lib/calendar-2/moment.latest.min.js"></script>
<script src="js/jquery.slimscroll.js"></script> <!-- to have scroll within a div part -->
<script src="js/scripts.js"></script>
<script src="js/lib/sticky-kit-master/dist/sticky-kit.min.js"></script>
<script>
$(function () {
$("#sidebar").load("sidebar.html");
});
</script>
<script>
$(document).ready(function() {
var list_sites = '';
$.ajax({
url: 'export_sites_stats_7_days.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(data_calc) {
console.log("EXPORT SITE STATS");
console.log(data_calc);
// $.ajax({
// url: 'export_sites.json',
// datatype: 'json',
// type: 'get',
// cache: false,
// success: function(data_sites) {
// console.log("EXPORT SITE SETTINGS");
// console.log(data_sites);
$(data_calc).each(function(index, value) {
var stats_array = ["N/A",0,0,0,0,0,0];
if (value.stats.bandwidth_timeseries[1].data.length == 0){
}else{
for (i=0; i<value.stats.bandwidth_timeseries[1].data.length; i++){
stats_array[1] += value.stats.visits_timeseries[0].data[i][1]+value.stats.visits_timeseries[1].data[i][1] ; // total visits
stats_array[2] += value.stats.visits_timeseries[0].data[i][1] ; //human visitor %
stats_array[3] += value.stats.visits_timeseries[1].data[i][1] ; // bot visitors %
}
for (j=0; j<value.stats.threats.length; j++){
stats_array[4] += value.stats.threats[j].incidents
}
stats_array[1] = Intl.NumberFormat().format(stats_array[1]);
stats_array[2] = (Math.round(stats_array[2]/stats_array[1] * 100) || 0) +" %";
stats_array[3] = (Math.round(stats_array[3]/stats_array[1] * 100) || 0) + " %";
stats_array[5] = (Math.round(value.stats.caching.saved_bytes / value.stats.caching.total_bytes * 100) || 0) +"%";
stats_array[6] = Intl.NumberFormat().format((Math.round(value.stats.caching.total_bytes / 10000000)/100) || 0) +" Gbytes";
}
list_sites += '<tr>';
list_sites += '<td>'+value.domain+'</td>';
list_sites += '<td>'+stats_array[0]+'</td>';
list_sites += '<td>'+stats_array[1]+'</td>';
list_sites += '<td>'+stats_array[2]+'</td>';
list_sites += '<td>'+stats_array[3]+'</td>';
list_sites += '<td>'+stats_array[4]+'</td>';
list_sites += '<td>'+stats_array[5]+'</td>';
list_sites += '<td>'+stats_array[6]+'</td>';
list_sites += '</tr>';
});
$("#site_stats_table tbody").append(list_sites);
$('#site_stats_table').DataTable({
dom: 'Bfrtip',
buttons: [{
extend: 'excelHtml5',
title: 'Site Traffic Statistics'
},
{
extend: 'pdfHtml5',
title: 'Site Traffic Statistics'
}]
});
}
});
});
</script>
<!-- print table site list and settings
<script>
$(document).ready(function() {
var list_sites = '';
var sites_performance = '';
$.ajax({
url: 'sitesStats2.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(data) {
console.log("EXPORT SITES SETTINGS");
console.log(data);
$(data).each(function(index, value) {
list_sites += '<tr>';
list_sites += '<td>'+value.account_id+'</td>';
list_sites += '<td>'+value.site_id+'</td>';
list_sites += '<td>'+value.domain+'</td>';
list_sites += '<td>'+value.status+'</td>';
list_sites += '<td>'+value.security.waf.rules[5].action_text+'</td>';
list_sites += '<td>'+value.security.waf.rules[0].action_text+'</td>';
list_sites += '<td>'+value.security.waf.rules[1].action_text+'</td>';
list_sites += '<td>'+value.security.waf.rules[2].action_text+'</td>';
list_sites += '<td>'+value.security.waf.rules[6].action_text+'</td>';
list_sites += '<td>'+value.security.waf.rules[4].activation_mode_text+'</td>';
list_sites += '<td>'+value.security.waf.rules[4].ddos_traffic_threshold+'</td>';
list_sites += '<td>'+value.security.waf.rules[3].block_bad_bots+'</td>';
list_sites += '<td>'+value.security.waf.rules[3].challenge_suspected_bots+'</td>';
list_sites += '</tr>';
});
$("#site_stats_table tbody").append(list_sites);
$('#site_stats_table').DataTable({
dom: 'Bfrtip',
buttons: [{
extend: 'excelHtml5',
title: 'security assessment'
},
{
extend: 'pdfHtml5',
title: 'security assessment',
orientation: 'landscape'
}]
});
$('#site_stats_table tr td').each(function(){
if($(this).text() == "Alert Only")$(this).css('color','red');
if($(this).text() == "1000")$(this).css('color','orange');
if($(this).text() == "off")$(this).css('color','red');
});
$('#site_stats_table tr td:nth-child(12)').each(function(){
if($(this).text() != "true")$(this).css('color','red');
});
$('#performance_table tr td:nth-child(4)').each(function(){
if($(this).text() != "fully-configured")$(this).css('color','orange');
if($(this).text() == "fully-configured")$(this).css('color','green');
});
}
});
});
</script>
-->
<!-- print table stats 7 days -->
<script>
$(document).ready(function() {
$.ajax({
url: 'export_stats_7_days.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(data) {
console.log("EXPORT SITES STATISTICS");
console.log(data);
}
});
});
</script>
<!-- complete the security stats table -->
<script>
$(document).ready(function() {
var list_stats = '';
var count_XSS_events = 0;
var count_ddos_events = 0;
$.ajax({
url: 'export_stats_7_days.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(data) {
list_stats += '<tr>';
list_stats += '<td>'+data.threats[5].incidents+'</td>';
list_stats += '<td>'+data.threats[10].incidents+'</td>';
list_stats += '<td>'+data.threats[0].incidents+'</td>';
list_stats += '<td>'+data.threats[3].incidents+'</td>';
list_stats += '<td>'+data.threats[5].incidents+'</td>';
list_stats += '<td>'+data.threats[9].incidents+'</td>';
list_stats += '<td>'+data.threats[8].incidents+'</td>';
$('#api_list_stats').append(list_stats);
}
});
});
</script>
</html>