mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Compare commits
4 Commits
8e7e0afb1e
...
d6125ef4e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d6125ef4e2 | ||
|
|
bf90ee81c7 | ||
|
|
ae74f1f538 | ||
|
|
3ae0daad3c |
@@ -240,6 +240,7 @@
|
||||
display: grid;
|
||||
}
|
||||
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.main-header .logo {
|
||||
width: 100%;
|
||||
@@ -254,6 +255,15 @@
|
||||
.main-footer {
|
||||
margin-left: 0px;
|
||||
}
|
||||
.fixed .content-wrapper, .fixed .right-side {
|
||||
padding-top: 50px;
|
||||
}
|
||||
.main-sidebar {
|
||||
padding-top: 50px;
|
||||
}
|
||||
.content-header {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.sidebar-open .content-wrapper,
|
||||
@@ -1135,7 +1145,7 @@ input[readonly] {
|
||||
color: white;
|
||||
}
|
||||
|
||||
#dropdownIcon li svg, #dropdownIcon li i{
|
||||
#dropdownIcon li svg, #dropdownIcon li i, .dropdownIcon li svg, .dropdownIcon li i, .icon-maxsize svg, .icon-maxsize i{
|
||||
height: 1.5em !important;
|
||||
}
|
||||
|
||||
@@ -1270,6 +1280,21 @@ input[readonly] {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.networkNodeTabHeaders
|
||||
{
|
||||
max-width: 200px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
text-wrap: nowrap;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
|
||||
.networkNodeTabHeaders .node-name
|
||||
{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/* PLUGINS page */
|
||||
|
||||
@@ -379,55 +379,84 @@ function initListInteractionOptions(element) {
|
||||
// -------------------------------------------------------------------
|
||||
// Function to filter rows based on input text
|
||||
function filterRows(inputText) {
|
||||
|
||||
// open everything if input text is empty
|
||||
if (!inputText) {
|
||||
inputText = "";
|
||||
}
|
||||
|
||||
$(".panel").each(function () {
|
||||
var $panel = $(this);
|
||||
var $panelHeader = $panel.find('.panel-heading');
|
||||
var $panelBody = $panel.find('.panel-collapse');
|
||||
$(".panel").each(function () {
|
||||
var $panel = $(this);
|
||||
var $panelHeader = $panel.find('.panel-heading');
|
||||
var $panelBody = $panel.find('.panel-collapse');
|
||||
|
||||
var anyVisible = false; // Flag to check if any row is visible
|
||||
$panel.show()
|
||||
$panelHeader.show()
|
||||
$panelBody.collapse('show');
|
||||
|
||||
$panelBody.find(".table_row:not(.docs)").each(function () {
|
||||
var $row = $(this);
|
||||
$panelBody.find(".table_row:not(.docs)").each(function () {
|
||||
var $row = $(this)
|
||||
var rowId = $row.attr("id");
|
||||
var isMetadataRow = rowId && rowId.endsWith("__metadata");
|
||||
if (!isMetadataRow) {
|
||||
$row.show()
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} else{
|
||||
// filter
|
||||
|
||||
// Check if the row ID ends with "__metadata"
|
||||
var rowId = $row.attr("id");
|
||||
var isMetadataRow = rowId && rowId.endsWith("__metadata");
|
||||
|
||||
// Always hide metadata rows
|
||||
if (isMetadataRow) {
|
||||
$row.hide();
|
||||
return; // Skip further processing for metadata rows
|
||||
}
|
||||
|
||||
var description = $row.find(".setting_description").text().toLowerCase();
|
||||
var codeName = $row.find(".setting_name code").text().toLowerCase();
|
||||
|
||||
if (
|
||||
description.includes(inputText.toLowerCase()) ||
|
||||
codeName.includes(inputText.toLowerCase())
|
||||
) {
|
||||
$row.show();
|
||||
anyVisible = true; // Set the flag to true if at least one row is visible
|
||||
$(".panel").each(function () {
|
||||
var $panel = $(this);
|
||||
var $panelHeader = $panel.find('.panel-heading');
|
||||
var $panelBody = $panel.find('.panel-collapse');
|
||||
|
||||
var anyVisible = false; // Flag to check if any row is visible
|
||||
|
||||
$panelBody.find(".table_row:not(.docs)").each(function () {
|
||||
var $row = $(this);
|
||||
|
||||
// Check if the row ID ends with "__metadata"
|
||||
var rowId = $row.attr("id");
|
||||
var isMetadataRow = rowId && rowId.endsWith("__metadata");
|
||||
|
||||
// Always hide metadata rows
|
||||
if (isMetadataRow) {
|
||||
$row.hide();
|
||||
return; // Skip further processing for metadata rows
|
||||
}
|
||||
|
||||
var description = $row.find(".setting_description").text().toLowerCase();
|
||||
var codeName = $row.find(".setting_name code").text().toLowerCase();
|
||||
|
||||
if (
|
||||
description.includes(inputText.toLowerCase()) ||
|
||||
codeName.includes(inputText.toLowerCase())
|
||||
) {
|
||||
$row.show();
|
||||
anyVisible = true; // Set the flag to true if at least one row is visible
|
||||
} else {
|
||||
$row.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Determine whether to hide or show the panel based on visibility of rows
|
||||
if (anyVisible) {
|
||||
$panelBody.collapse('show'); // Ensure the panel body is shown if there are visible rows
|
||||
$panelHeader.show(); // Show the panel header
|
||||
$panel.show(); // Show the entire panel if there are visible rows
|
||||
} else {
|
||||
$row.hide();
|
||||
$panelBody.collapse('hide'); // Hide the panel body if no rows are visible
|
||||
$panelHeader.hide(); // Hide the panel header if no rows are visible
|
||||
$panel.hide(); // Hide the entire panel if no rows are visible
|
||||
}
|
||||
});
|
||||
|
||||
// Determine whether to hide or show the panel based on visibility of rows
|
||||
if (anyVisible) {
|
||||
$panelBody.collapse('show'); // Ensure the panel body is shown if there are visible rows
|
||||
$panelHeader.show(); // Show the panel header
|
||||
$panel.show(); // Show the entire panel if there are visible rows
|
||||
} else {
|
||||
$panelBody.collapse('hide'); // Hide the panel body if no rows are visible
|
||||
$panelHeader.hide(); // Hide the panel header if no rows are visible
|
||||
$panel.hide(); // Hide the entire panel if no rows are visible
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@
|
||||
|
||||
$decoded_icon = base64_decode($icon);
|
||||
$idFromMac = str_replace(":", "_", $node_mac);
|
||||
$str_tab_header = '<li class="'.$activetab.'">
|
||||
$str_tab_header = '<li class="networkNodeTabHeaders '.$activetab.' " >
|
||||
|
||||
<a href="#'.$idFromMac.'" data-mytabmac="'.$node_mac.'" id="'.$idFromMac.'_id" data-toggle="tab" >' // _id is added so it doesn't conflict with AdminLTE tab behavior
|
||||
.'<div class="icon">'.$decoded_icon.' </div>'.$node_name.' ' .$str_port.$node_badge.
|
||||
<a href="#'.$idFromMac.'" data-mytabmac="'.$node_mac.'" id="'.$idFromMac.'_id" data-toggle="tab" title="'.$node_name.' ">' // _id is added so it doesn't conflict with AdminLTE tab behavior
|
||||
.'<div class="icon">'.$decoded_icon.' </div> <span class="node-name">'.$node_name.'</span>' .$str_port.$node_badge.
|
||||
'</a>
|
||||
</li>';
|
||||
|
||||
@@ -464,7 +464,7 @@
|
||||
<script src="lib/treeviz/require.js"></script>
|
||||
|
||||
|
||||
<script>
|
||||
<script defer>
|
||||
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
|
||||
|
||||
rawData = JSON.parse (data)
|
||||
@@ -548,7 +548,6 @@
|
||||
{
|
||||
parentNodesCount++
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
name: node.name,
|
||||
@@ -616,7 +615,7 @@
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Handle network node click - select correct tab in teh bottom table
|
||||
// Handle network node click - select correct tab in the bottom table
|
||||
function handleNodeClick(event)
|
||||
{
|
||||
// console.log(event.target.offsetParent.offsetParent)
|
||||
@@ -631,14 +630,24 @@
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
var myTree;
|
||||
var visibleTreeArea = $(window).height()-135;
|
||||
var treeAreaHeight = visibleTreeArea > 800 ? 800 : visibleTreeArea;
|
||||
var visibleTreeArea = $(window).height()-155;
|
||||
var nodeWidth = 160;
|
||||
var emSize;
|
||||
var nodeHeight;
|
||||
var sizeCoefficient = 1
|
||||
|
||||
function initTree(myHierarchy)
|
||||
{
|
||||
console.log(myHierarchy)
|
||||
|
||||
// calculate the drawing area based on teh tree width and available screen size
|
||||
var treeAreaHeight = visibleTreeArea > 800 ? 800 : visibleTreeArea;
|
||||
let screenWidth = $('.content-header').width();
|
||||
let treeWidth = (nodeWidth + 20) * parentNodesCount;
|
||||
let treeAreaWidth = screenWidth < treeWidth ? treeWidth : screenWidth;
|
||||
|
||||
// init the drawing area size
|
||||
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${treeAreaWidth}px`)
|
||||
|
||||
if(myHierarchy.type == "")
|
||||
{
|
||||
@@ -655,7 +664,7 @@
|
||||
// nodeHeight = ((emSize*100*0.30).toFixed(0))
|
||||
nodeHeight = ((emSize*100*0.30).toFixed(0))
|
||||
|
||||
$("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${$('.content-header').width()}px`)
|
||||
console.log(Treeviz);
|
||||
|
||||
myTree = Treeviz.create({
|
||||
htmlId: "networkTree",
|
||||
@@ -704,7 +713,7 @@
|
||||
>
|
||||
<div class="netNodeText">
|
||||
<strong>${devicePort} ${deviceIcon}
|
||||
<span class="spanNetworkTree anonymizeDev">${nodeData.data.name}</span>
|
||||
<span class="spanNetworkTree anonymizeDev" >${nodeData.data.name}</span>
|
||||
</strong>
|
||||
${collapseExpandHtml}
|
||||
</div>
|
||||
@@ -719,8 +728,8 @@
|
||||
secondaryAxisNodeSpacing: 0.3,
|
||||
nodeHeight: nodeHeight.toString(),
|
||||
marginTop: '5',
|
||||
hasZoom: false,
|
||||
hasPan: false,
|
||||
hasZoom: true,
|
||||
hasPan: true,
|
||||
// marginLeft: '15',
|
||||
idKey: "id",
|
||||
hasFlatData: false,
|
||||
@@ -730,7 +739,7 @@
|
||||
relationnalField: "children",
|
||||
});
|
||||
|
||||
console.log(myHierarchy)
|
||||
|
||||
|
||||
myTree.refresh(myHierarchy);
|
||||
|
||||
|
||||
@@ -26,36 +26,37 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
|
||||
|
||||
| ID | Type | Description | Required | Data source | Detailed docs |
|
||||
|---------------|---------|---------------------------------------------|----------|--------------------|---------------------------------------------------------------|
|
||||
| `APPRISE` | ▶️ | Apprise notification proxy | | Script | [📚_publisher_apprise](/front/plugins/_publisher_apprise/) |
|
||||
| `ARPSCAN` | 🔍 | ARP-scan on current network | | Script | [📚arp_scan](/front/plugins/arp_scan/) |
|
||||
| `CSVBCKP` | ⚙ | CSV devices backup | | Script | [📚csv_backup](/front/plugins/csv_backup/) |
|
||||
| `DBCLNP` | ⚙ | Database cleanup | Yes* | Script | [📚db_cleanup](/front/plugins/db_cleanup/) |
|
||||
| `DDNS` | ⚙ | DDNS update | | Script | [📚ddns_update](/front/plugins/ddns_update/) |
|
||||
| `DHCPLSS` | 🔍/📥 | Import devices from DHCP leases | | Script | [📚dhcp_leases](/front/plugins/dhcp_leases/) |
|
||||
| `DHCPSRVS` | ♻ | DHCP servers | | Script | [📚dhcp_servers](/front/plugins/dhcp_servers/) |
|
||||
| `INTRNT` | 🔍 | Internet IP scanner | | Script | [📚internet_ip](/front/plugins/internet_ip/) |
|
||||
| `INTRSPD` | ♻ | Internet speed test | | Script | [📚internet_speedtest](/front/plugins/internet_speedtest/) |
|
||||
| `MAINT` | ⚙ | Maintenance of logs, etc. | | Script | [📚maintenance](/front/plugins/maintenance/) |
|
||||
| `MQTT` | ▶️ | MQTT for synching to Home Assistant | | Script | [📚_publisher_mqtt](/front/plugins/_publisher_mqtt/) |
|
||||
| `NEWDEV` | ⚙ | New device template | Yes | Template | [📚newdev_template](/front/plugins/newdev_template/) |
|
||||
| `NMAP` | ♻ | Nmap port scanning & discovery | | Script | [📚nmap_scan](/front/plugins/nmap_scan/) |
|
||||
| `NMAPDEV` | 🔍 | Nmap dev scan on current network | | Script | [📚nmap_dev_scan](/front/plugins/nmap_dev_scan/) |
|
||||
| `NSLOOKUP` | ♻ | NSLookup name resolution | | Script | [📚nslookup_scan](/front/plugins/nslookup_scan/) |
|
||||
| `NTFPRCS` | ⚙ | Notification processing | Yes | Template | [📚notification_processing](/front/plugins/notification_processing/)|
|
||||
| `NTFY` | ▶️ | NTFY notifications | | Script | [📚_publisher_ntfy](/front/plugins/_publisher_ntfy/) |
|
||||
| `PHOLUS` | ♻ | Pholus name resolution | | Script | [📚pholus_scan](/front/plugins/pholus_scan/) |
|
||||
| `PIHOLE` | 🔍/📥 | Pi-hole device import & sync | | SQLite DB | [📚pihole_scan](/front/plugins/pihole_scan/) |
|
||||
| `PUSHSAFER` | ▶️ | Pushsafer notifications | | Script | [📚_publisher_pushsafer](/front/plugins/_publisher_pushsafer/) |
|
||||
| `PUSHOVER` | ▶️ | Pushover notifications | | Script | [📚_publisher_pushover](/front/plugins/_publisher_pushover/) |
|
||||
| `SETPWD` | ⚙ | Set password | Yes | Template | [📚set_password](/front/plugins/set_password/) |
|
||||
| `SMTP` | ▶️ | Email notifications | | Script | [📚_publisher_email](/front/plugins/_publisher_email/) |
|
||||
| `SNMPDSC` | 🔍/📥 | SNMP device import & sync | | Script | [📚snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||
| `SYNC` | 🔍/⚙/📥| Sync & import from other NetAlertX instances | | Script | [📚snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||
| `UNDIS` | 🔍/📥 | Create dummy devices | | Script | [📚undiscoverables](/front/plugins/undiscoverables/) |
|
||||
| `UNFIMP` | 🔍/📥 | UniFi device import & sync | | Script | [📚unifi_import](/front/plugins/unifi_import/) |
|
||||
| `VNDRPDT` | ⚙ | Vendor database update | | Script | [📚vendor_update](/front/plugins/vendor_update/) |
|
||||
| `WEBHOOK` | ▶️ | Webhook notifications | | Script | [📚_publisher_webhook](/front/plugins/_publisher_webhook/) |
|
||||
| `WEBMON` | ♻ | Website down monitoring | | Script | [📚website_monitor](/front/plugins/website_monitor/)
|
||||
| `APPRISE` | ▶️ | Apprise notification proxy | | Script | [_publisher_apprise](/front/plugins/_publisher_apprise/) |
|
||||
| `ARPSCAN` | 🔍 | ARP-scan on current network | | Script | [arp_scan](/front/plugins/arp_scan/) |
|
||||
| `CSVBCKP` | ⚙ | CSV devices backup | | Script | [csv_backup](/front/plugins/csv_backup/) |
|
||||
| `DBCLNP` | ⚙ | Database cleanup | Yes* | Script | [db_cleanup](/front/plugins/db_cleanup/) |
|
||||
| `DDNS` | ⚙ | DDNS update | | Script | [ddns_update](/front/plugins/ddns_update/) |
|
||||
| `DHCPLSS` | 🔍/📥 | Import devices from DHCP leases | | Script | [dhcp_leases](/front/plugins/dhcp_leases/) |
|
||||
| `DHCPSRVS` | ♻ | DHCP servers | | Script | [dhcp_servers](/front/plugins/dhcp_servers/) |
|
||||
| `INTRNT` | 🔍 | Internet IP scanner | | Script | [internet_ip](/front/plugins/internet_ip/) |
|
||||
| `INTRSPD` | ♻ | Internet speed test | | Script | [internet_speedtest](/front/plugins/internet_speedtest/) |
|
||||
| `MAINT` | ⚙ | Maintenance of logs, etc. | | Script | [maintenance](/front/plugins/maintenance/) |
|
||||
| `MQTT` | ▶️ | MQTT for synching to Home Assistant | | Script | [_publisher_mqtt](/front/plugins/_publisher_mqtt/) |
|
||||
| `NBTSCAN` | ♻ | NSLookup (NetBIOS-based) name resolution | | Script | [nbtscan_scan](/front/plugins/nbtscan_scan/) |
|
||||
| `NEWDEV` | ⚙ | New device template | Yes | Template | [newdev_template](/front/plugins/newdev_template/) |
|
||||
| `NMAP` | ♻ | Nmap port scanning & discovery | | Script | [nmap_scan](/front/plugins/nmap_scan/) |
|
||||
| `NMAPDEV` | 🔍 | Nmap dev scan on current network | | Script | [nmap_dev_scan](/front/plugins/nmap_dev_scan/) |
|
||||
| `NSLOOKUP` | ♻ | NSLookup (DNS-based) name resolution | | Script | [nslookup_scan](/front/plugins/nslookup_scan/) |
|
||||
| `NTFPRCS` | ⚙ | Notification processing | Yes | Template | [notification_processing](/front/plugins/notification_processing/)|
|
||||
| `NTFY` | ▶️ | NTFY notifications | | Script | [_publisher_ntfy](/front/plugins/_publisher_ntfy/) |
|
||||
| `PHOLUS` | ♻ | Pholus name resolution | | Script | [pholus_scan](/front/plugins/pholus_scan/) |
|
||||
| `PIHOLE` | 🔍/📥 | Pi-hole device import & sync | | SQLite DB | [pihole_scan](/front/plugins/pihole_scan/) |
|
||||
| `PUSHSAFER` | ▶️ | Pushsafer notifications | | Script | [_publisher_pushsafer](/front/plugins/_publisher_pushsafer/) |
|
||||
| `PUSHOVER` | ▶️ | Pushover notifications | | Script | [_publisher_pushover](/front/plugins/_publisher_pushover/) |
|
||||
| `SETPWD` | ⚙ | Set password | Yes | Template | [set_password](/front/plugins/set_password/) |
|
||||
| `SMTP` | ▶️ | Email notifications | | Script | [_publisher_email](/front/plugins/_publisher_email/) |
|
||||
| `SNMPDSC` | 🔍/📥 | SNMP device import & sync | | Script | [snmp_discovery](/front/plugins/snmp_discovery/) |
|
||||
| `SYNC` | 🔍/⚙/📥| Sync & import from other NetAlertX instances | | Script | [sync](/front/plugins/sync/) |
|
||||
| `UNDIS` | 🔍/📥 | Create dummy devices | | Script | [undiscoverables](/front/plugins/undiscoverables/) |
|
||||
| `UNFIMP` | 🔍/📥 | UniFi device import & sync | | Script | [unifi_import](/front/plugins/unifi_import/) |
|
||||
| `VNDRPDT` | ⚙ | Vendor database update | | Script | [vendor_update](/front/plugins/vendor_update/) |
|
||||
| `WEBHOOK` | ▶️ | Webhook notifications | | Script | [_publisher_webhook](/front/plugins/_publisher_webhook/) |
|
||||
| `WEBMON` | ♻ | Website down monitoring | | Script | [website_monitor](/front/plugins/website_monitor/) |
|
||||
|
||||
|
||||
> \* The database cleanup plugin (`DBCLNP`) is not _required_ but the app will become unusable after a while if not executed.
|
||||
|
||||
@@ -104,7 +104,7 @@ def execute_name_lookup (ip, timeout):
|
||||
# Look for the first line containing a valid NetBIOS name entry
|
||||
index = 0
|
||||
for line in lines:
|
||||
if ip in line:
|
||||
if 'Doing NBT name scan' not in line and ip in line:
|
||||
# Split the line and extract the primary NetBIOS name
|
||||
parts = line.split()
|
||||
if parts:
|
||||
|
||||
@@ -502,7 +502,7 @@ def update_devices_names (db):
|
||||
recordsToUpdate.append ([newName, device['dev_MAC']])
|
||||
|
||||
# Print log
|
||||
mylog('verbose', ['[Update Device Name] Names Found (DiG/NSLOOKUP/Pholus): ', len(recordsToUpdate), " (",foundDig,"/",foundNsLookup,"/",foundPholus ,")"] )
|
||||
mylog('verbose', ['[Update Device Name] Names Found (DiG/NSLOOKUP/NBTSCAN/Pholus): ', len(recordsToUpdate), " (",foundDig,"/",foundNsLookup,"/",foundNbtLookup,"/", foundPholus ,")"] )
|
||||
mylog('verbose', ['[Update Device Name] Names Not Found : ', notFound] )
|
||||
|
||||
# update not found devices with (name not found)
|
||||
|
||||
@@ -773,6 +773,7 @@ def cleanDeviceName(str, match_IP):
|
||||
|
||||
str = re.sub(r'\.\b', '', str) # trailing dot after words
|
||||
str = re.sub(r'\.$', '', str) # trailing dot at the end of the string
|
||||
str = str.replace(". (IP match)", " (IP match)") # Remove dot if (IP match) is added
|
||||
|
||||
mylog('debug', ["[cleanDeviceName] output: " + str])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user