Add OUI Vendor to excessive requests data
This commit is contained in:
parent
bad5989601
commit
f9dec38ad9
|
@ -7,7 +7,7 @@ router.get('/', function(req, res, next) {
|
|||
var stat_data = dhcp_requests;
|
||||
|
||||
for (var key in stat_data) {
|
||||
if(stat_data[key].request_count <= 100)
|
||||
if(stat_data[key].request_count <= 10)
|
||||
delete stat_data[key];
|
||||
}
|
||||
|
||||
|
|
57
app.js
57
app.js
|
@ -280,12 +280,12 @@ var tail_dhcp_log = new tail_module(
|
|||
dhcp_requests = {};
|
||||
|
||||
tail_dhcp_log.on("line", function(data) {
|
||||
if(listening_to_log_file) {
|
||||
wss.broadcast_event(data, 'dhcp_log_subscription');
|
||||
}
|
||||
if (listening_to_log_file) {
|
||||
wss.broadcast_event(data, 'dhcp_log_subscription');
|
||||
}
|
||||
|
||||
/* Collect Excessive DHCP Request Data */
|
||||
if(/DHCPREQUEST/i.test(data)){
|
||||
if (/DHCPREQUEST/i.test(data)) {
|
||||
|
||||
var request_from = "";
|
||||
var request_for = "";
|
||||
|
@ -294,31 +294,40 @@ tail_dhcp_log.on("line", function(data) {
|
|||
var request_data = data.split(" ");
|
||||
var length = request_data.length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if(request_data[i] == "from"){
|
||||
request_from = request_data[i + 1];
|
||||
}
|
||||
if(request_data[i] == "for"){
|
||||
request_for = request_data[i + 1];
|
||||
}
|
||||
if(request_data[i] == "via"){
|
||||
request_via = request_data[i + 1];
|
||||
}
|
||||
if (request_data[i] == "from") {
|
||||
request_from = request_data[i + 1];
|
||||
}
|
||||
if (request_data[i] == "for") {
|
||||
request_for = request_data[i + 1];
|
||||
}
|
||||
if (request_data[i] == "via") {
|
||||
request_via = request_data[i + 1];
|
||||
}
|
||||
}
|
||||
|
||||
if(typeof dhcp_requests[request_from] === "undefined")
|
||||
if (typeof dhcp_requests[request_from] === "undefined")
|
||||
dhcp_requests[request_from] = {};
|
||||
|
||||
if(typeof dhcp_requests[request_from].request_for === "undefined")
|
||||
if (typeof dhcp_requests[request_from].request_for === "undefined")
|
||||
dhcp_requests[request_from].request_for = request_for;
|
||||
|
||||
if(typeof dhcp_requests[request_from].request_via === "undefined")
|
||||
if (typeof dhcp_requests[request_from].request_via === "undefined")
|
||||
dhcp_requests[request_from].request_via = request_via;
|
||||
|
||||
if(typeof dhcp_requests[request_from].request_count === "undefined")
|
||||
if (typeof dhcp_requests[request_from].request_count === "undefined")
|
||||
dhcp_requests[request_from].request_count = 0;
|
||||
|
||||
if (typeof request_from !== "undefined") {
|
||||
if (request_from.length == 17 && /:/.test(request_from)) {
|
||||
var mac_oui = request_from.split(":").join("").toUpperCase().slice(0, 6);
|
||||
|
||||
if (typeof dhcp_requests[request_from].request_vendor === "undefined")
|
||||
dhcp_requests[request_from].request_vendor = oui_data[mac_oui];
|
||||
}
|
||||
}
|
||||
|
||||
dhcp_requests[request_from].request_count++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const purge_request_data = setInterval(function() {
|
||||
|
@ -333,15 +342,15 @@ const purge_request_data_hour = setInterval(function() {
|
|||
}, 3600 * 1000); /* 60 Minutes */
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
socket_clients++;
|
||||
console.log("[WS] CLIENT_CONNECT: Socket clients (" + socket_clients + ")");
|
||||
socket_clients++;
|
||||
console.log("[WS] CLIENT_CONNECT: Socket clients (" + socket_clients + ")");
|
||||
|
||||
if (!listening_to_log_file) {
|
||||
if (!listening_to_log_file) {
|
||||
/* Watch log file for new information */
|
||||
var tail_module = require('always-tail2');
|
||||
var tail_module = require('always-tail2');
|
||||
|
||||
listening_to_log_file = 1;
|
||||
}
|
||||
listening_to_log_file = 1;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -22,14 +22,15 @@
|
|||
|
||||
<div class="card hide_me">
|
||||
<div class="header">
|
||||
<h2>Excessive DHCP Requests</h2>
|
||||
<h2>Excessive DHCP Requests (10 Minute Interval)</h2>
|
||||
</div>
|
||||
<div class="body">
|
||||
<small>Usually indicative of a physical error on the network with one-way communication</small>
|
||||
<small>Usually indicative of a physical error on the network with one-way communication</small><br><br>
|
||||
<table id="excessive_requests" class="table table-bordered table-striped table-hover js-basic-example dataTable dashboard-task-infos">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>MAC</th>
|
||||
<th>Vendor</th>
|
||||
<th>Requesting IP</th>
|
||||
<th>Request Via</th>
|
||||
<th>Count</th>
|
||||
|
@ -137,6 +138,7 @@
|
|||
$.each(data, function(k, v) {
|
||||
$('#excessive_requests > tbody:last-child').append('<tr>' +
|
||||
'<td>' + k + '</td>' +
|
||||
'<td>' + data[k].request_vendor + '</td>' +
|
||||
'<td>' + data[k].request_for + '</td>' +
|
||||
'<td>' + data[k].request_via + '</td>' +
|
||||
'<td>' + data[k].request_count.toLocaleString('en') + '</td>' +
|
||||
|
@ -150,7 +152,7 @@
|
|||
responsive: true,
|
||||
"pageLength": 20,
|
||||
"aaSorting": [],
|
||||
"order": [[ 3, "desc" ]]
|
||||
"order": [[ 4, "desc" ]]
|
||||
});
|
||||
|
||||
// $('table').fadeIn(100);
|
||||
|
|
Loading…
Reference in New Issue