mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Network diagram - Infinite recursion detection #857
This commit is contained in:
@@ -550,10 +550,10 @@ function initializeDatatable (status) {
|
|||||||
'createdCell': function (td, cellData, rowData, row, col) {
|
'createdCell': function (td, cellData, rowData, row, col) {
|
||||||
if (!emptyArr.includes(cellData)){
|
if (!emptyArr.includes(cellData)){
|
||||||
$(td).html (`<span class="anonymizeIp">
|
$(td).html (`<span class="anonymizeIp">
|
||||||
<a href="http://${cellData}" target="_blank">
|
<a href="http://${cellData}" class="pointer" target="_blank">
|
||||||
${cellData}
|
${cellData}
|
||||||
</a>
|
</a>
|
||||||
<a href="https://${cellData}" target="_blank">
|
<a href="https://${cellData}" class="pointer" target="_blank">
|
||||||
<i class="fa fa-lock "></i>
|
<i class="fa fa-lock "></i>
|
||||||
</a>
|
</a>
|
||||||
<span>`);
|
<span>`);
|
||||||
|
|||||||
@@ -525,33 +525,37 @@
|
|||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
function getChildren(node, list, path)
|
// Recursively get children nodes and build a tree
|
||||||
|
function getChildren(node, list, path, visited = [])
|
||||||
{
|
{
|
||||||
var children = [];
|
var children = [];
|
||||||
|
|
||||||
// loop thru all items and find childern...
|
// Check for infinite recursion by seeing if the node has been visited before
|
||||||
for(var i in list)
|
if (visited.includes(node.mac.toLowerCase())) {
|
||||||
{
|
console.error("Infinite recursion detected at node:", node.mac);
|
||||||
//... of the current node
|
write_notification("[ERROR] ⚠ Infinite recursion detected. You probably have assigned the Internet node to another children node or to itself. Please open a new issue on GitHub and describe how you did it.", 'interrupt')
|
||||||
|
return { error: "Infinite recursion detected", node: node.mac };
|
||||||
|
}
|
||||||
|
|
||||||
if(list[i].parentMac.toLowerCase() == node.mac.toLowerCase() && !hiddenMacs.includes(list[i].parentMac))
|
// Add current node to visited list
|
||||||
{
|
visited.push(node.mac.toLowerCase());
|
||||||
|
|
||||||
visibleNodesCount++
|
// Loop through all items to find children of the current node
|
||||||
|
for (var i in list) {
|
||||||
|
if (list[i].parentMac.toLowerCase() == node.mac.toLowerCase() && !hiddenMacs.includes(list[i].parentMac)) {
|
||||||
|
|
||||||
// and process them
|
visibleNodesCount++;
|
||||||
children.push(getChildren(list[i], list, path + ((path == "") ? "" : '|') + list[i].parentMac, hiddenMacs))
|
|
||||||
|
|
||||||
|
// Process children recursively, passing a copy of the visited list
|
||||||
|
children.push(getChildren(list[i], list, path + ((path == "") ? "" : '|') + list[i].parentMac, visited));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// note the total number of leaf nodes to calculate the font scaling
|
// Track leaf and parent node counts
|
||||||
if(children.length == 0)
|
if (children.length == 0) {
|
||||||
{
|
leafNodesCount++;
|
||||||
leafNodesCount++
|
} else {
|
||||||
} else
|
parentNodesCount++;
|
||||||
{
|
|
||||||
parentNodesCount++
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -569,9 +573,9 @@
|
|||||||
qty: children.length,
|
qty: children.length,
|
||||||
children: children
|
children: children
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
function getHierarchy()
|
function getHierarchy()
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
|
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
|
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
|
||||||
Net Alert<sup>x</sup>
|
Net<b>Alert</b><sup>x</sup>
|
||||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" height="24pt" viewBox="0 0 30 30" width="24pt">
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" height="24pt" viewBox="0 0 30 30" width="24pt">
|
||||||
<g fill="#000000" stroke="none" transform="translate(0.000000,30) scale(0.02,-0.02)">
|
<g fill="#000000" stroke="none" transform="translate(0.000000,30) scale(0.02,-0.02)">
|
||||||
<path d="M605 1473 c-16 -3 -34 -9 -39 -14 -6 -5 -20 -9 -33 -9 -13 0 -23 -5 -23 -10 0 -5 -3 -9 -7 -8 -14 4 -53 -13 -53 -22 0 -5 -6 -7 -14 -4 -7 3 -27 -6 -44 -20 -16 -15 -34 -26 -39 -26 -6 0 -18 -10 -29 -21 -10 -12 -29 -25 -42 -30 -13 -5 -21 -13 -18 -18 3 -5 -4 -11 -15 -14 -12 -3 -18 -10 -15 -15 3 -5 -6 -14 -19 -20 -14 -7 -25 -18 -25 -27 0 -8 -5 -15 -12 -15 -9 0 -9 -3 -1 -11 9 -9 29 4 80 51 37 34 87 75 110 90 44 30 167 90 184 90 18 0 89 40 89 50 0 6 -1 9 -2 9 -2 -1 -16 -4 -33 -6z"></path>
|
<path d="M605 1473 c-16 -3 -34 -9 -39 -14 -6 -5 -20 -9 -33 -9 -13 0 -23 -5 -23 -10 0 -5 -3 -9 -7 -8 -14 4 -53 -13 -53 -22 0 -5 -6 -7 -14 -4 -7 3 -27 -6 -44 -20 -16 -15 -34 -26 -39 -26 -6 0 -18 -10 -29 -21 -10 -12 -29 -25 -42 -30 -13 -5 -21 -13 -18 -18 3 -5 -4 -11 -15 -14 -12 -3 -18 -10 -15 -15 3 -5 -6 -14 -19 -20 -14 -7 -25 -18 -25 -27 0 -8 -5 -15 -12 -15 -9 0 -9 -3 -1 -11 9 -9 29 4 80 51 37 34 87 75 110 90 44 30 167 90 184 90 18 0 89 40 89 50 0 6 -1 9 -2 9 -2 -1 -16 -4 -33 -6z"></path>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
|
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
|
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
|
||||||
Net Alert<sup>x</sup>
|
Net<b>Alert</b><sup>x</sup>
|
||||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" height="24pt" viewBox="0 0 30 30" width="24pt">
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" height="24pt" viewBox="0 0 30 30" width="24pt">
|
||||||
<g fill="#000000" stroke="none" transform="translate(0.000000,30) scale(0.02,-0.02)">
|
<g fill="#000000" stroke="none" transform="translate(0.000000,30) scale(0.02,-0.02)">
|
||||||
<path d="M605 1473 c-16 -3 -34 -9 -39 -14 -6 -5 -20 -9 -33 -9 -13 0 -23 -5 -23 -10 0 -5 -3 -9 -7 -8 -14 4 -53 -13 -53 -22 0 -5 -6 -7 -14 -4 -7 3 -27 -6 -44 -20 -16 -15 -34 -26 -39 -26 -6 0 -18 -10 -29 -21 -10 -12 -29 -25 -42 -30 -13 -5 -21 -13 -18 -18 3 -5 -4 -11 -15 -14 -12 -3 -18 -10 -15 -15 3 -5 -6 -14 -19 -20 -14 -7 -25 -18 -25 -27 0 -8 -5 -15 -12 -15 -9 0 -9 -3 -1 -11 9 -9 29 4 80 51 37 34 87 75 110 90 44 30 167 90 184 90 18 0 89 40 89 50 0 6 -1 9 -2 9 -2 -1 -16 -4 -33 -6z"></path>
|
<path d="M605 1473 c-16 -3 -34 -9 -39 -14 -6 -5 -20 -9 -33 -9 -13 0 -23 -5 -23 -10 0 -5 -3 -9 -7 -8 -14 4 -53 -13 -53 -22 0 -5 -6 -7 -14 -4 -7 3 -27 -6 -44 -20 -16 -15 -34 -26 -39 -26 -6 0 -18 -10 -29 -21 -10 -12 -29 -25 -42 -30 -13 -5 -21 -13 -18 -18 3 -5 -4 -11 -15 -14 -12 -3 -18 -10 -15 -15 3 -5 -6 -14 -19 -20 -14 -7 -25 -18 -25 -27 0 -8 -5 -15 -12 -15 -9 0 -9 -3 -1 -11 9 -9 29 4 80 51 37 34 87 75 110 90 44 30 167 90 184 90 18 0 89 40 89 50 0 6 -1 9 -2 9 -2 -1 -16 -4 -33 -6z"></path>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
|
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
|
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
|
||||||
Net Alert<sup>x</sup>
|
Net<b>Alert</b><sup>x</sup>
|
||||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" height="24pt" viewBox="0 0 30 30" width="24pt">
|
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid meet" height="24pt" viewBox="0 0 30 30" width="24pt">
|
||||||
<g fill="#000000" stroke="none" transform="translate(0.000000,30) scale(0.02,-0.02)">
|
<g fill="#000000" stroke="none" transform="translate(0.000000,30) scale(0.02,-0.02)">
|
||||||
<path d="M605 1473 c-16 -3 -34 -9 -39 -14 -6 -5 -20 -9 -33 -9 -13 0 -23 -5 -23 -10 0 -5 -3 -9 -7 -8 -14 4 -53 -13 -53 -22 0 -5 -6 -7 -14 -4 -7 3 -27 -6 -44 -20 -16 -15 -34 -26 -39 -26 -6 0 -18 -10 -29 -21 -10 -12 -29 -25 -42 -30 -13 -5 -21 -13 -18 -18 3 -5 -4 -11 -15 -14 -12 -3 -18 -10 -15 -15 3 -5 -6 -14 -19 -20 -14 -7 -25 -18 -25 -27 0 -8 -5 -15 -12 -15 -9 0 -9 -3 -1 -11 9 -9 29 4 80 51 37 34 87 75 110 90 44 30 167 90 184 90 18 0 89 40 89 50 0 6 -1 9 -2 9 -2 -1 -16 -4 -33 -6z"></path>
|
<path d="M605 1473 c-16 -3 -34 -9 -39 -14 -6 -5 -20 -9 -33 -9 -13 0 -23 -5 -23 -10 0 -5 -3 -9 -7 -8 -14 4 -53 -13 -53 -22 0 -5 -6 -7 -14 -4 -7 3 -27 -6 -44 -20 -16 -15 -34 -26 -39 -26 -6 0 -18 -10 -29 -21 -10 -12 -29 -25 -42 -30 -13 -5 -21 -13 -18 -18 3 -5 -4 -11 -15 -14 -12 -3 -18 -10 -15 -15 3 -5 -6 -14 -19 -20 -14 -7 -25 -18 -25 -27 0 -8 -5 -15 -12 -15 -9 0 -9 -3 -1 -11 9 -9 29 4 80 51 37 34 87 75 110 90 44 30 167 90 184 90 18 0 89 40 89 50 0 6 -1 9 -2 9 -2 -1 -16 -4 -33 -6z"></path>
|
||||||
|
|||||||
Reference in New Issue
Block a user