-
Notifications
You must be signed in to change notification settings - Fork 11
/
dashboard.php
2052 lines (1733 loc) · 62.3 KB
/
dashboard.php
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
$post = [
'api_id' => $_POST['api_id'],
'api_key' => $_POST['api_key'],
'account_id' => $_POST['account_nb'],
'page_size' => 100,
];
$post_stats = [
'api_id' => $_POST['api_id'],
'api_key' => $_POST['api_key'],
'account_id' => $_POST['account_nb'],
'stats' => 'visits_timeseries, hits_timeseries, bandwidth_timeseries, requests_geo_dist_summary, visits_dist_summary, caching, caching, caching_timeseries, threats, incap_rules, incap_rules_timeseries',
'time_range' => $_POST['period'],
];
/* generic Function for CURL to list sites and settings for page 2 and above*/
function requestList($pageNb) {
$post_extra = [
'api_id' => $_POST['api_id'],
'api_key' => $_POST['api_key'],
'account_id' => $_POST['account_nb'],
'page_size' => 100,
'page_num' => $pageNb
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/prov/v1/sites/list");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post_extra)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json_extra = curl_exec($ch);
return $json_extra;
curl_close($ch);
}
/* CURL to list sites and settings */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/prov/v1/sites/list");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
curl_close($ch);
$json_object = json_decode($json);
$json_object_2 = json_decode($json,true);
$array_sites = [];
$array_sites = $json_object_2['sites'];
if (count ($json_object-> sites) == "100") {
$number_sites = 100;
$page_count = 1;
// start pagination loop
while ($number_sites == 100) {
$json_extra = requestList($page_count);
$json_extra_object_2 = json_decode($json_extra,true);
$array_sites = array_merge($array_sites, $json_extra_object_2['sites']);
$number_sites = count($json_extra_object_2['sites']);
$page_count = $page_count + 1;
}
}
$json_export_sites = json_encode($array_sites);
file_put_contents("export_sites.json",$json_export_sites);
/* curl to get account stats*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/stats/v1");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post_stats)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
file_put_contents("export_stats_7_days.json",$json);
curl_close($ch);
/* Curl to get the account Info */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/prov/v1/account");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
file_put_contents("export_account_plan.json",$json);
curl_close($ch);
/* Curl to get the account subscription */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/prov/v1/accounts/subscription");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
file_put_contents("export_account_subscriptions.json",$json);
curl_close($ch);
/* curl to get the list of sub accounts */
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/prov/v1/accounts/listSubAccounts");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
file_put_contents("export_subaccounts.json",$json);
curl_close($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/prov/v1/accounts/list");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json = curl_exec($ch);
file_put_contents("export_account_list.json",$json);
curl_close($ch);
function requestSitesStats($site_id) {
$post_stats_sites = [
'api_id' => $_POST['api_id'],
'api_key' => $_POST['api_key'],
'account_id' => $_POST['account_nb'],
'site_id' => $site_id,
'stats' => 'visits_timeseries, hits_timeseries, bandwidth_timeseries, requests_geo_dist_summary, visits_dist_summary, caching, caching, caching_timeseries, threats, incap_rules, incap_rules_timeseries',
'time_range' => $_POST['period']
];
/* curl to get Site stats*/
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://my.incapsula.com/api/stats/v1");
curl_setopt($ch, CURLOPT_POST, 1);// set post data to true
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($post_stats_sites)); // post data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$json_sites_stats = curl_exec($ch);
return $json_sites_stats;
curl_close($ch);
}
if (isset($_POST['sites_checkbox']) )
{
$array_sites_stats = [];
$json_site_list = file_get_contents('./export_sites.json');
$json_site_list_data = json_decode($json_site_list,true);
foreach ($json_site_list_data as $key1 => $site_id) {
// echo $json_site_list_data[$key1]['domain'], '<br>';
$json_extra_sites_stats = requestSitesStats($json_site_list_data[$key1]['site_id']);
$json_extra_sites_stats_2 = json_decode($json_extra_sites_stats,true);
// echo $json_extra_sites_stats_2['caching']['saved_bytes'], '<br>';
// $array_sites_stats[$json_site_list_data[$key1]['domain']] = $json_extra_sites_stats_2;
$array_sites_stats[] = array("domain"=>$json_site_list_data[$key1]['domain'], "stats"=>$json_extra_sites_stats_2);
// $array_sites_stats = array_merge($array_sites_stats, $json_extra_sites_stats_2);
}
$json_export_sites_stats = json_encode($array_sites_stats);
file_put_contents("export_sites_stats_7_days.json",$json_export_sites_stats);
} else
{
}
}
?>
<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="Account Level Dashboard for Imperva Incapsula APIs">
<meta name="author" content="Jonathan Gruber Imperva">
<!-- Favicon icon -->
<link rel="icon" type="image/png" sizes="16x16" href="favico.png">
<title>Account Imperva Incapsula Dashboard</title>
<!-- CSS LIBRARIES -->
<!-- Bootstrap Core CSS -->
<link href="css/style.css" rel="stylesheet" type="text/css">
<!-- Custom CSS -->
<link href="css/lib/calendar2/semantic.ui.min.css" rel="stylesheet" type="text/css">
<link href="css/lib/bootstrap/bootstrap.min.css" rel="stylesheet" type="text/css">
<!-- OLD JS LIBRARIES WERE -->
<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 text-muted " href="javascript:void(0)"><i class="fa fa-th-large"></i></a> </li>
</ul>
</div>
<!-- End Logo -->
</nav>
</div>
<!-- Left Sidebar -->
<div id="sidebar" class="left-sidebar">
</div>
<!-- End Left Sidebar -->
<!-- Container fluid for central page -->
<div id="export-pdf" class="page-wrapper">
<!-- Bread crumb -->
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<h3 class="text-primary">Account Level Dashboard</h3> </div>
<div class="col-md-7 align-self-center">
</div>
</div>
<!-- End Bread crumb -->
<div class="container-fluid">
<!-- ROW for column of Account information -->
<div class="row">
<div class="col-lg-6">
<div class="card card-outline-info" style="background-color: #F5F7FF">
<div class="card-header">
<h2 class="m-b-0 text-white">Account Name: <span id="account_name" class="m-b-0 text-white" style="font-weight: bold;">tbd</span> id: <span id="account_id" class="m-b-0 text-white" style="font-weight: bold;">tbd</span></h2>
</div>
<div class="card-body" style="background-color: #F5F7FF">
<br/>
<p style="font-size: 16px; Color: black">Account Base Plan: <span id="plan_name" style="Color: blue">tbd</span></p>
<p style="font-size: 16px; Color: black">Bandwidth Utilization: <span id="purchased_bandwidth" style="Color: blue">tbd</span></p>
<p style="font-size: 16px; Color: black">Websites Utilization: <span id="nb_websites" style="Color: blue">tbd</span></p>
<p style="font-size: 16px; Color: black">Purchased Add On: <span id="add_on" style="Color: blue"></span></p>
<p style="font-size: 16px; Color: black">Onboarding Date (end of trial): <span id="trial_end" style="Color: blue">tbd</span></p>
<p style="font-size: 16px; Color: black"># registered users: <span id="nb_users" style="Color: blue">tbd</span></p>
<p style="font-size: 16px; Color: black">Support Level: <span id="support_level" style="Color: blue">tbd</span></p>
</div>
</div>
</div>
<div class="col-lg-6">
<div class="card">
<div class="card-title">
<h2>Account Structure:</h2></p>
</div>
<table class="display nowrap table table-hover table-striped table-bordered" id="account_structure">
<tr>
<th> Sub Account ID </th>
<th> Sub Account Name </th>
</table>
<!-- <p">Sub Account 1: nameabc <span id="subaccounts" class="text-success">4 sites</span></p>
<p>Sub Account 2: namecdf <span id="temp2" class="text-success">3 sites</span></p>
<p>Sub Account 3: name rfd <span id="nhkklhjkrs" class="text-success">6 sites</span></p> -->
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Executive Summary Assessment</h2>
</div>
<p class="f-w-600" style="margin-top: 30px;">SITES FULLY CONFIGURED <span class="pull-right" id="configured right">0%</span></p>
<div class="progress ">
<div role="progressbar" id="configured" style="width: 0%;" class="progress-bar bg-success wow animated progress-animated"> <span class="sr-only">60% Complete</span>
</div>
</div>
<p class="m-t-30 f-w-600" id="block" style="margin-top: 30px;">SECURITY SETTINGS IN BLOCKED MODE<span class="pull-right" id="block right">0%</span></p>
<div class="progress">
<div role="progressbar" id="block progress" style="width: 0%;" class="progress-bar bg-danger wow animated progress-animated"> <span class="sr-only">60% Complete</span>
</div>
</div>
<p class="m-t-30 f-w-600" style="margin-top: 30px;">CONFIGURED VS PURCHASED SITES<span class="pull-right" id="configured sites">0%</span></p>
<div class="progress">
<div role="progressbar" id="configured_sites" style="width: 0%;" class="progress-bar bg-info wow animated progress-animated"> <span class="sr-only">60% Complete</span>
</div>
</div>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>95-percentile Traffic Utilization of last 3 months</h2>
</div>
<canvas id="95perc" style="max-height: 300px, width:auto"></canvas>
</div>
</div>
</div>
<!-- ROW for line Security Assessment -->
<div class="pagebreak"> </div>
<div class="row">
<div class="col-12" >
<div class="card" style="background-color: #e6f7ff">
<div class="card-body" style="background-color: #e6f7ff"><h1>SECURITY ASSESSMENT SUMMARY </h1></div>
</div>
</div>
</div>
<!-- END ROW for line Security Assessment -->
<!-- ROW 4 boxes for the 4 cards -->
<div class="row">
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-globe f-s-40 color-success" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="nb_configured" class="text-success">tbd
</h2>
<p class="m-b-0">Sites Fully Configured</p>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-exclamation-triangle f-s-40 color-danger" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="nb_security" class="text-danger">tbd</h2>
<p class="m-b-0">settings in Block mode</p>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-bolt f-s-40 color-warning" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="nb_ddos" class="text-warning">tbd</h2>
<p class="m-b-0">DDoS thresholds <> Default</p>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-user f-s-40 color-info" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="nb_incaprules" class="text-info">#</h2>
<p class="m-b-0">Incaprules configured</p><span style="font-size: 10px">valid 30days range only</span>
</div>
</div>
</div>
</div>
</div>
<!-- ROW for column of the progress -->
<div class="row">
<div class="col-lg-6">
<div class="card">
<div class="card-title">
<h2>Nb Explicit Security Events per OWASP threat <span style="font-size: 10pt">(on selected period)</span> </h2>
</div>
<canvas id="threatChart"></canvas>
</div>
</div>
<div class="col-lg-6">
<div class="card">
<div class="card-title">
<h2>Nb Custom and DDoS Security Events <span style="font-size: 10pt">(on selected period)</span> </h2>
</div>
<canvas id="threatChart_custom"></canvas>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Human versus Bot Visits</h2>
</div>
<canvas id="humanGraph"></canvas>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Visits per Bot type on all sites</h2>
</div>
<canvas id="BotsGraph"></canvas>
</div>
</div>
<!-- <div class="col-md-4" ">
<div class="card" style="max-height: 500px">
<div class="card-title">
<h4>List of domains: more details</h4> <a style="color:blue" href="raw tables.html">here</a>
</div>
<table class="table nowrap table-hover table-bordered table-striped table-responsive" id="api_list_sites">
<tr>
<th>Site ID</th>
<th>Site Name</th>
<th>Site Status</th>
</table>
</div>
</div>-->
</div>
<!-- END ROW for column of the progress -->
<!-- ROW for line Performance Assessment TITLE-->
<div class="pagebreak"> </div>
<div class="row">
<div class="col-12">
<div class="card" style="background-color: #e6fff2">
<div class="card-body" style="background-color: #e6fff2"><h1>PERFORMANCE ASSESSMENT SUMMARY </h1></div>
</div>
</div>
</div>
<!-- END ROW for Performance Assessment -->
<!-- ROW 4 boxes for the 4 cards -->
<div class="row">
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-globe f-s-40 color-success" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="trafficVolume" class="text-success">tbd</h2>
<p class="m-b-0">Total Traffic period (Gbytes)</p>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-bolt f-s-40 color-success" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="cachingRatio" class="text-success">tbd</h2>
<p class="m-b-0">Global Caching Ratio</p>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-cloud f-s-40 color-warning" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="cachingSettings" class="text-warning">tbd</h2>
<p class="m-b-0">Sites with Static+Dynamic</p>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card p-30">
<div class="media">
<div class="media-left meida media-middle">
<span><i class="fa fa-signal f-s-40 color-info" style="font-size:28"></i></span>
</div>
<div class="media-body media-text-right">
<h2 id="cached_total" class="text-info">tbd</h2>
<p class="m-b-0">Cached Bw (Gbytes)</p>
</div>
</div>
</div>
</div>
</div>
<!-- ROW for Traffic Graphs -->
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Nb Site Configured Trend last 6 months</h2> <p>
</div>
<canvas id="site_addition" style="max-height: 300px";> </canvas>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Accumulated Cached Bandwidth in Account</h2>
</div>
<canvas id="bwGraph" style="max-height: 300px; width:auto"></canvas>
</div>
</div>
</div>
<!-- END ROW for Traffic Graphs -->
<!-- ROW for serving Data Centers vs visitors -->
<div class="pagebreak"> </div>
<!-- Map of Visitors per country row -->
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-title">
<h2>Map of Visitors per Country for all Sites</h2>
</div>
<div id="threatmap"></div>
</div>
</div>
</div>
<!-- ROW for Traffic Graphs -->
<div class="row">
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Visitors per Country (on all sites)</h2> <p>
</div>
<canvas id="visitorsCountry"></canvas>
</div>
</div>
<div class="col-md-6">
<div class="card">
<div class="card-title">
<h2>Serving POPs (on all sites)</h2><p>
<span style="font-size: 12px">tip: compare with visited countries to see that customer is served by best POP</span>
</div>
<canvas id="POPCountry"></canvas>
</div>
</div>
</div>
<!-- END ROW for serving data centers vs visitors -->
<button class="btn btn-info" onclick="printPage()">Generate PDF </button>
<!-- footer -->
<footer class="footer"> © 2018 Imperva dashboard for Incapsula APIs, not an Imperva product <a href="https://github.com/imperva">Github Imperva Page</a></footer>
<!-- End footer -->
</div>
</div> <!-- end page wrapper-->
<!-- START OF JAVASCRIPT SCRIPTS -->
<!--JS LIBRARIES -->
<!-- All Jquery -->
<script src="js/lib/jquery/jquery.min.js"></script>
<!-- Bootstrap tether Core JavaScript -->
<script src="js/lib/bootstrap/js/bootstrap.min.js"></script>
<script src="js/lib/sticky-kit-master/dist/sticky-kit.min.js"></script>
<!--Charts and scripts JavaScript -->
<script src="js/lib/calendar-2/moment.latest.min.js"></script>
<script src="js/Chart.js"></script>
<script src="js/chartjs-plugin-datalabels.js"></script>
<script src="js/jquery.slimscroll.js"></script> <!-- to have scroll within a div part -->
<script src="js/scripts.js"></script>
<script>
$(function(){
$("#sidebar").load("sidebar.html");
});
</script>
</head>
<script src="js/incapse-graphs.js"></script>
<script>
var default_colors = ['#e1e1ea','#ccffcc','#ccffff','#ffccff',' #ccccff','#ffe0cc','#ccfff5','#ffd9b3','#ffff80','#f0b3ff','#316395','#ff6666','#5353c6','#ff794d','#6633CC','#E67300','#8B0707','#329262','#5574A6','#3B3EAC']
</script>
<!-- SECURITY JAVASCRIPTS -->
<!-- Javascript graph for threat type -->
<script>
let myChart = document.getElementById('threatChart').getContext('2d');
let myChart_Custom = document.getElementById('threatChart_custom').getContext('2d');
//let myChart = document.getElementById('threatChart').getContext('2d');
let threatsGraph = new Chart(threatChart,{
type:'bar',
data:{
labels:['Suspected Bots','Bad Bots', 'XSS', 'SQLi', 'illegal Resource', 'RFi', 'Backdoor'],
datasets:[{
label:'threats events',
data:[
0,
0,
0,
0,
0,
0
],
//backgroundColor:'green',
backgroundColor:[
'rgba(255, 99, 132, 0.6)',
'rgba(54, 162, 235, 0.6)',
'rgba(255, 206, 86, 0.6)',
'rgba(75, 192, 192, 0.6)',
'rgba(153, 102, 255, 0.6)',
'rgba(255, 159, 64, 0.6)',
'rgba(255, 99, 132, 0.6)'
],
borderWidth:1,
borderColor:'#777',
hoverBorderWidth:3,
hoverBorderColor:'#000'
}]
},
options:{
plugins: {
datalabels: {
display: true,
anchor: 'end',
align: 'top',
formatter: Math.round,
font: {
weight: 'bold',
size: '16'
}
}
},
title:{
display:false,
text:'Threat Events for selected period',
fontSize:14
},
layout:{
padding:{
left:0,
right:0,
bottom:0,
top:0
}
},
legend:{
display:false,
position:'right',
labels:{
fontColor:'#000'
}
},
tooltips:{
enabled:true
},
scales: {
xAxes: [{
display: true,
gridLines: {
display: false,
drawBorder: false
},
display: true,
ticks: {
beginAtZero: true // minimum value will be 0.
}
}],
yAxes: [{
display: true,
gridLines: {
display: true,
drawBorder: false
},
display: true,
ticks: {
beginAtZero: true // minimum value will be 0.
}
}]
}
}
});
let threatsGraph_custom = new Chart(threatChart_custom,{
type:'bar',
data:{
labels:['Incaprules','Blacklisted URL', 'Blacklisted Country', 'Blacklisted IP', 'DDoS'],
datasets:[{
label:'threats events',
data:[
0,
0,
0,
0,
0,
0
],
//backgroundColor:'green',
backgroundColor:[
'rgba(255, 99, 132, 0.6)',
'rgba(54, 162, 235, 0.6)',
'rgba(255, 206, 86, 0.6)',
'rgba(75, 192, 192, 0.6)',
'rgba(153, 102, 255, 0.6)',
'rgba(255, 159, 64, 0.6)',
'rgba(255, 99, 132, 0.6)'
],
borderWidth:1,
borderColor:'#777',
hoverBorderWidth:3,
hoverBorderColor:'#000'
}]
},
options:{
plugins: {
datalabels: {
display: true,
anchor: 'end',
align: 'top',
formatter: Math.round,
font: {
weight: 'bold',
size: '16'
}
}
},
title:{
display:false,
text:'Threat Events for selected period',
fontSize:14
},
layout:{
padding:{
left:0,
right:0,
bottom:0,
top:0
}
},
legend:{
display:false,
position:'right',
labels:{
fontColor:'#000'
}
},
tooltips:{
enabled:true
},
scales: {
xAxes: [{
display: true,
gridLines: {
display: false,
drawBorder: false
},
display: true,
ticks: {
beginAtZero: true // minimum value will be 0.
}
}],
yAxes: [{
display: true,
gridLines: {
display: true,
drawBorder: false
},
display: true,
ticks: {
beginAtZero: true // minimum value will be 0.
}
}]
}
}
});
$(document).ready(function(){
$.ajax({
url:'export_stats_7_days.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(result){
if (typeof result.incap_rules === 'undefined'){
threatsGraph_custom.data.datasets[0].data[0] = 0;
}else{
threatsGraph_custom.data.datasets[0].data[0] = result.incap_rules[0].incidents;
}
threatsGraph.data.datasets[0].data[2] = result.threats[0].incidents;
threatsGraph_custom.data.datasets[0].data[1] = result.threats[1].incidents;
threatsGraph_custom.data.datasets[0].data[2] = result.threats[2].incidents;
threatsGraph.data.datasets[0].data[3] = result.threats[3].incidents;
threatsGraph_custom.data.datasets[0].data[3] = result.threats[4].incidents;
threatsGraph.data.datasets[0].data[4] = result.threats[5].incidents;
threatsGraph.data.datasets[0].data[0] = result.threats[6].incidents;
threatsGraph.data.datasets[0].data[6] = result.threats[7].incidents;
threatsGraph_custom.data.datasets[0].data[4] = result.threats[8].incidents;
threatsGraph.data.datasets[0].data[5] = result.threats[9].incidents;
threatsGraph.data.datasets[0].data[1] = result.threats[10].incidents;
threatsGraph.update();
threatsGraph_custom.update();
}
});
});
// print console list of managed accounts
$(document).ready(function(){
$.ajax({
url:'export_account_list.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(result){
console.log("list of managed accounts");
console.log(result);
}
});
$.ajax({
url:'export_sites_stats_7_days.json',
datatype: 'json',
type: 'get',
cache: false,
success: function(result){
console.log("SITES STATS");
console.log(result);
}
});
});
</script>
<!-- Graph for Human / Bot visits -->
<script>
var dataHuman = {
datasets: [{
data: [
2,
4
],
backgroundColor: [
"#36A2EB",
'#ffce56'
],
label: 'My dataset' // for legend
}],
labels: [
"Human",
"Bots"
]
};
var optionsHuman = {
legend:{
display:true,
position:'right',
labels:{
fontColor:'#000',
fontSize:14
}
},
plugins: {
datalabels: {
display: false
}
},
layout:{
padding:{
left:0,
right:0,
bottom:0,
top:0
}
},
tooltips:{
enabled:true
}
};
var humanGraph2 = document.getElementById("humanGraph").getContext('2d');
var varHumanChart = new Chart(humanGraph2, {