-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathclient.html
321 lines (298 loc) · 18.1 KB
/
client.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
<!DOCTYPE html><!--[if lt IE 9]><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"><![endif]--><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"><meta name="author" content="Copyright (c) 2017 Christopher MJ Gray - Updated 6/13/2017 07:49:06 EST" /><META NAME="application-name" CONTENT="DDoS Information Sharing" /><META NAME="ROBOTS" CONTENT="NO-INDEX, NO-FOLLOW"><meta name="generator" content="By hand!"><meta name="description" content="DDoS Information Sharing"><meta name="keyword" content="ddos"><meta http-equiv="refresh" content="3600">
<!--
Made by Christopher MJ Gray - christophermjgray@gmail.com
https://raw.githubusercontent.com/c2theg/DDoS_Information_Sharing/master/client.html
-->
<link rel="icon" href="https://raw.githubusercontent.com/c2theg/DDoS_Information_Sharing/master/images/favicon.ico">
<title>DDoS Information Sharing</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><link href="https://getbootstrap.com/docs/3.3/examples/dashboard/dashboard.css" rel="stylesheet">
<link href="https://cdn.datatables.net/1.10.15/css/dataTables.bootstrap.min.css" rel="stylesheet">
</head><body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">DDoS Info Sharing - Client - v0.1.10</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li><a href="#" data-toggle="modal" data-target="#modal_Settings"> Settings </a></li>
<li><a href="https://github.com/c2theg/DDoS_Information_Sharing/blob/master/README.md" target="_blank"> Help </a></li>
</ul>
<form class="navbar-form navbar-right">
<input type="text" class="form-control" placeholder="Search...">
</form>
</div>
</div>
</nav>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li class="active"><a href="client.html">Bad IPs <span class="sr-only">(current)</span></a></li>
<li><a href="client_submissions.html">Uploaded IPs</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<h1 class="page-header">Dashboard <button class="btn btn-default" id="btn_refresh" name="btn_refresh" type="button"><span class="glyphicon glyphicon-refresh" aria-hidden="true"></span></button> <span id="lbl_status_main"></span></h1>
<span id="lbl_status_minor"></span><span id="lbl_status_refesh"></span>
<h2 class="sub-header">Attacking Source IPs</h2>
<div class="table-responsive">
<table id="tbl_sources" class="table table-striped table-bordered table-hover table-condensed" cellspacing="0" width="100%">
<thead>
<tr>
<th>IP Address</th>
<!-- <th>AS Info</th> -->
<th>Location</th>
<th>Size</th>
<th>Occurred</th>
<th>Last Seen by</th>
<th>Events</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Modals -->
<div class="modal fade" id="modal_Settings" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Settings</h4>
</div>
<div class="modal-body">
<h3>CRITs Login Info</h3>
<table class="table table-bordered table-condensed table-hover table-striped">
<tbody>
<tr>
<td>URL: </td>
<td><input type="text" name="txt_url" id="txt_url" placeholder="" value="https://dis-demo2.cablelabs.com/api/v1/ips/"></td>
</tr>
<tr>
<td>Username: </td>
<td><input type="text" name="txt_userid" id="txt_userid" placeholder="" value=""></td>
</tr>
<tr>
<td>API Key: </td>
<td><input type="text" name="txt_apikey" id="txt_apikey" placeholder="" value=""></td>
</tr>
<tr>
<td>Default Row Limit: </td>
<td><input type="text" name="txt_resultLimit" id="txt_resultLimit" placeholder="" value="30"></td>
</tr>
</tbody>
</table>
<h3>General</h3>
<table class="table table-bordered table-condensed table-hover table-striped">
<tbody>
<tr>
<td>Refresh Interval: (seconds) </td>
<td><input type="text" name="txt_refreshInt" id="txt_refreshInt" placeholder="" value="300"></td>
</tr>
</tbody>
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-success" id="btn_saveSettings" name="btn_saveSettings"> <span class="i-cloud-upload" aria-hidden="true"></span> Save </button>
</div>
</div>
</div>
</div>
<!-- --------------------------------------------------------------------------------------------------------- -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script><script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
<script type="text/javascript">
var data = IS_User = IS_Key = IS_URL = IS_Limit = '';
/* --------------------------------------------------------------------------------------------------------- */
$(document).ready(function() {
function bytesToSize(a,b){if(0==a)return"0 Bytes";var c=1e3,d=b||2,e=["B","K","M","G","T","P","E","Z","Y"],f=Math.floor(Math.log(a)/Math.log(c));return parseFloat((a/Math.pow(c,f)).toFixed(d))+" "+e[f]}
// instantiate datatable
var t1 = $('#tbl_sources').DataTable( {
"order": [[ 4, "desc" ]],
"pageLength": 50,
"columns": [
{ "width": "15%" },
{ "width": "15%" },
{ "width": "10%" },
{ "width": "5%" },
{ "width": "35%" },
null
]
});
//----------- init Load of Settings ------------------
load_CritsDB();
/* --------------------------------------------------------------------------------------------------------- */
$('#btn_refresh').click(function(e) {
load_CritsDB();
});
$('#btn_saveSettings').click(function(e) {
localStorage.IS_URL = $("#txt_url").val();
localStorage.IS_User = $("#txt_userid").val();
localStorage.IS_Key = $("#txt_apikey").val();
localStorage.IS_Limit = $("#txt_resultLimit").val();
localStorage.IS_Refresh = $("#txt_refreshInt").val();
$('#modal_Settings').modal('hide');
load_CritsDB();
});
function load_CritsDB() {
if (typeof(Storage) !== "undefined") {
if (localStorage.IS_User) {
IS_URL = localStorage.IS_URL;
IS_User = localStorage.IS_User;
IS_Key = localStorage.IS_Key;
IS_Limit = localStorage.IS_Limit;
IS_Refresh = localStorage.IS_Refresh;
$("#txt_url").val(IS_URL);
$("#txt_userid").val(IS_User);
$("#txt_apikey").val(IS_Key);
$("#txt_resultLimit").val(IS_Limit);
$("#txt_refreshInt").val(IS_Refresh);
//console.log('values are set!');
} else {
$('#modal_Settings').modal('show');
}
} else {
alert("Sorry! No Web Storage support..");
}
if (localStorage.IS_URL) {
$('#lbl_status_minor').fadeTo("fast",100).html("<div class='alert alert-info' role='alert'><img src='https://bit.ly/cgray-loader4' alt='loading' /> Gathering Data from: " + IS_URL + " - Username: " + IS_User + "</div>");
$.ajax({
url: IS_URL + "/api/v1/data_distribution_resource/?",
dataType: "text",
type: 'GET',
data: {
username: IS_User,
api_key: IS_Key,
limit: IS_Limit
},
success: function(data) {
var parsed_json = sub_objects = '';
t1.clear(); // clear table
$('#lbl_status_minor').fadeTo("fast",100).html("<div class='alert alert-success' role='alert'>Processing... <img src='https://bit.ly/cgray-loader4' alt='loading' /> </div>");
//console.log(data);
if (data != '') {
parsed_json = JSON.parse(data);
$.each(parsed_json.outputData, function(index, element) {
var display_ip = display_location = display_size_agg = display_size_total = display_size_peak = display_Saw = display_asn = display_asn_num = display_asn_name = display_timesSeen = display_City = display_State = display_Zip = display_Country = display_lastseen = display_lastSeenBy = display_reporters = DST_Port = SRC_Port = Protocol = display_event = "";
if(typeof element.City !== "undefined") {
display_City = element.City;
}
if(typeof element.State !== "undefined") {
if (display_City != '') { display_State = ", "; }
display_State += element.State;
}
if(typeof element.Country !== "undefined") {
if (display_State != '') { display_Country = "<br />"; }
display_Country += element.Country;
}
display_ip = element.IPaddress;
display_lastseen = new Date(element.lastTimeReceived);
display_reporters = element.numberOfReporters;
display_timesSeen = element.numberOfTimesSeen;
//-- sub objects --
$.each(element.events, function(index1, element1) {
if(typeof element1.aggregateBytesPerSecond !== "undefined") {
display_size_agg += "Agg: " + bytesToSize(element1.aggregateBytesPerSecond) + "bps / " + element1.aggregatePacketsPerSecond + "pps";
}
//----------------------------------------------------------------------------
if(typeof element1.totalBytesSent !== "undefined") {
if (display_size_agg != '') { display_size_agg += "<br />"; }
display_size_total += "Total: " + bytesToSize(element1.totalBytesSent) + "bps / " + element1.totalPacketsSent + "pps";
}
//----------------------------------------------------------------------------
if(typeof element1.peakBPS !== "undefined") {
if (display_size_total != '') { display_size_total += "<br />"; }
display_size_peak = "Peak: " + bytesToSize(element1.peakBPS) + "bps / " + element1.peakPPS + "pps";
}
//----------------------------------------------------------------------------
if(typeof element1.attackTypes !== "undefined") {
if (display_event != '') { display_event += "<br />"; }
display_event = element1.attackTypes;
}
if (element.destinationPort) {
DST_Port = element1.destinationPort;
display_event += "DST: " + DST_Port + " ";
}
if (element.sourcePort) {
SRC_Port = element1.sourcePort;
display_event += "SRC: " + SRC_Port + " ";
}
if (element.protocol) {
Protocol = element1.protocol;
display_event += " " + Protocol + " ";
}
display_event += "<br />";
});
$.each(element.reportedBy, function(index2, element2) {
display_lastSeenBy += element2 + ', ';
});
display_lastSeenBy = display_lastSeenBy.substring(0, display_lastSeenBy.length - 2);
display_asn = display_asn_num + ' ' + display_asn_name;
display_location = display_City + display_State + display_Country;
display_size = display_size_agg + display_size_total + display_size_peak;
display_Saw = display_lastseen + " <br /> By: " + display_lastSeenBy + " - " + display_reporters + " reporter(s)";
//--- populate table ---
t1.row.add( [
display_ip,
display_location,
display_size,
display_timesSeen,
display_Saw,
display_event
] ).draw( false );
});
$('#lbl_status_minor').fadeTo("fast",100).html("<div class='alert alert-success' role='alert'>Loaded (" + CurrentDateTime() + ")</div>");
}
},
parsererror: function(data) {
$('#lbl_status_minor').html("<div class='alert alert-info' role='alert'> Ajax load error. Returned: " + data + "</div>");
},
timeout: function(data) {
$('#lbl_status_minor').html("<div class='alert alert-info' role='alert'>Timeout. Returned: " + data + "</div>");
},
notmodified: function(data) {
$('#lbl_status_minor').html("<div class='alert alert-info' role='alert'> <i aria-hidden='true' class='i-warning'></i> Not Modified. Returned: " + data + "</div>");
},
error: function (xmlHttpRequest, textStatus, errorThrown) {
$('#lbl_status_minor').html("<div class='alert alert-danger' role='alert'>AJAX Error - Data Returned: " + data + ", XHR: " + xmlHttpRequest + ", Status: " + textStatus + ", Error: " + errorThrown + " Stringified: " + JSON.stringify(data) + " (" + CurrentDateTime() + ")</div>");
//alert("Error AJAX - Data Returned: " + data + ", XHR: " + xmlHttpRequest + ", Status: " + textStatus + ", Error: " + errorThrown + " Stringified: " + JSON.stringify(data));
}
}); // end of ajax call
} else {
$('#lbl_status_minor').fadeTo("fast",100).html("<div class='alert alert-danger' role='alert'><img src='https://bit.ly/cgray-img-error' alt='error' /> Please edit the code and enter your CRITS Username and Api Key</div>");
}
}
/* --------------------------------------------------------------------------------------------------------- */
if (localStorage.IS_Refresh) {
setInterval(function(){
//alert("loading crits from timer");
console.log("loading crits from timer");
load_CritsDB();
}, (parseInt(IS_Refresh) * 1000));
}
function CurrentDateTime() {
var currentdate = new Date();
var datetime = "Last Sync: "
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getDate() + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
return datetime;
}
}); /* --- End jQuery --- */
</script>
</body></html>