Add OUI Vendor to excessive requests data

This commit is contained in:
Akkadius 2017-09-21 13:23:35 -05:00
parent bad5989601
commit f9dec38ad9
4 changed files with 39 additions and 28 deletions

View File

@ -7,7 +7,7 @@ router.get('/', function(req, res, next) {
var stat_data = dhcp_requests; var stat_data = dhcp_requests;
for (var key in stat_data) { for (var key in stat_data) {
if(stat_data[key].request_count <= 100) if(stat_data[key].request_count <= 10)
delete stat_data[key]; delete stat_data[key];
} }

27
app.js
View File

@ -280,12 +280,12 @@ var tail_dhcp_log = new tail_module(
dhcp_requests = {}; dhcp_requests = {};
tail_dhcp_log.on("line", function(data) { tail_dhcp_log.on("line", function(data) {
if(listening_to_log_file) { if (listening_to_log_file) {
wss.broadcast_event(data, 'dhcp_log_subscription'); wss.broadcast_event(data, 'dhcp_log_subscription');
} }
/* Collect Excessive DHCP Request Data */ /* Collect Excessive DHCP Request Data */
if(/DHCPREQUEST/i.test(data)){ if (/DHCPREQUEST/i.test(data)) {
var request_from = ""; var request_from = "";
var request_for = ""; var request_for = "";
@ -294,29 +294,38 @@ tail_dhcp_log.on("line", function(data) {
var request_data = data.split(" "); var request_data = data.split(" ");
var length = request_data.length; var length = request_data.length;
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
if(request_data[i] == "from"){ if (request_data[i] == "from") {
request_from = request_data[i + 1]; request_from = request_data[i + 1];
} }
if(request_data[i] == "for"){ if (request_data[i] == "for") {
request_for = request_data[i + 1]; request_for = request_data[i + 1];
} }
if(request_data[i] == "via"){ if (request_data[i] == "via") {
request_via = request_data[i + 1]; request_via = request_data[i + 1];
} }
} }
if(typeof dhcp_requests[request_from] === "undefined") if (typeof dhcp_requests[request_from] === "undefined")
dhcp_requests[request_from] = {}; 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; 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; 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; 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++; dhcp_requests[request_from].request_count++;
} }
}); });

View File

@ -22,14 +22,15 @@
<div class="card hide_me"> <div class="card hide_me">
<div class="header"> <div class="header">
<h2>Excessive DHCP Requests</h2> <h2>Excessive DHCP Requests (10 Minute Interval)</h2>
</div> </div>
<div class="body"> <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"> <table id="excessive_requests" class="table table-bordered table-striped table-hover js-basic-example dataTable dashboard-task-infos">
<thead> <thead>
<tr> <tr>
<th>MAC</th> <th>MAC</th>
<th>Vendor</th>
<th>Requesting IP</th> <th>Requesting IP</th>
<th>Request Via</th> <th>Request Via</th>
<th>Count</th> <th>Count</th>
@ -137,6 +138,7 @@
$.each(data, function(k, v) { $.each(data, function(k, v) {
$('#excessive_requests > tbody:last-child').append('<tr>' + $('#excessive_requests > tbody:last-child').append('<tr>' +
'<td>' + k + '</td>' + '<td>' + k + '</td>' +
'<td>' + data[k].request_vendor + '</td>' +
'<td>' + data[k].request_for + '</td>' + '<td>' + data[k].request_for + '</td>' +
'<td>' + data[k].request_via + '</td>' + '<td>' + data[k].request_via + '</td>' +
'<td>' + data[k].request_count.toLocaleString('en') + '</td>' + '<td>' + data[k].request_count.toLocaleString('en') + '</td>' +
@ -150,7 +152,7 @@
responsive: true, responsive: true,
"pageLength": 20, "pageLength": 20,
"aaSorting": [], "aaSorting": [],
"order": [[ 3, "desc" ]] "order": [[ 4, "desc" ]]
}); });
// $('table').fadeIn(100); // $('table').fadeIn(100);

View File