IP Dump supports flow filtering

Every packet is assigned a "flow id", and the UI allows you to
filter displayed packet data by flow id.
This commit is contained in:
Herbert Wolverson 2023-03-27 16:21:46 +00:00
parent ebfcde2618
commit da0489b638

View File

@ -80,8 +80,6 @@
var capacity = [];
var activeFilter = null;
var activeSet = null;
var activeChart = 0;
var activePage = 0;
function filter(newFilter) {
activeFilter = newFilter;
@ -95,12 +93,6 @@
viewPage(0);
}
function setChart(n) {
activeChart = n;
paginator(activePage);
viewPage(activePage);
}
function proto(n) {
switch (n) {
case 6: return "TCP"
@ -165,7 +157,7 @@ if (hdr->cwr) flags |= 128;
paginator += "<option onclick='viewPage(" + i + ");'>" + i + "</option> ";
}
}
paginator += "</select> | ";
paginator += "</select><br />";
// Offer flow filtering
paginator += "<strong>Filter Flows</strong>: ";
@ -182,28 +174,7 @@ if (hdr->cwr) flags |= 128;
paginator += "<option onclick='filter(\"" + key + "\");'>" + key + "</option>";
}
});
paginator += "</select> | ";
// Offer graph choices
paginator += "<strong>Graph</strong>: ";
paginator += "<select>";
if (activeChart == 0) {
paginator += "<option selected>Packet-Size Chart</option>";
} else {
paginator += "<option onclick='setChart(0);'>Packet-Size Chart</option>";
}
if (activeChart == 1) {
paginator += "<option selected>Piano Roll Flow Chart</option>";
} else {
paginator += "<option onclick='setChart(1);'>Piano Roll Flow Chart</option>";
}
if (activeChart == 2) {
paginator += "<option selected>TCP Window Chart</option>";
} else {
paginator += "<option onclick='setChart(2);'>TCP Window Chart</option>";
}
paginator += "</select>";
paginator += "</div>";
$("#pages").html(paginator);
}
@ -343,7 +314,6 @@ if (hdr->cwr) flags |= 128;
data.forEach(packet => packet.timestamp -= min_ts);
// Divide the packets into flows and append the flow_id
let flowCounter = 0;
data.forEach(packet => {
let flow_id = proto(packet.ip_protocol) + " " + packet.src + ":" + packet.src_port + " <-> " + packet.dst + ":" + packet.dst_port;
let reverse_flow_id = proto(packet.ip_protocol) + " " + packet.dst + ":" + packet.dst_port + " <-> " + packet.src + ":" + packet.src_port;
@ -352,11 +322,11 @@ if (hdr->cwr) flags |= 128;
} else if (flows.hasOwnProperty(reverse_flow_id)) {
packet.flow_id = reverse_flow_id;
} else {
flows[flow_id] = { flowCounter };
flows[flow_id] = {};
packet.flow_id = flow_id;
flowCounter++;
}
});
console.log(flows);
packets = data;
activeSet = packets;