Name cleanup + nbtscan improvements

This commit is contained in:
jokob-sk
2024-07-11 22:35:04 +10:00
parent 3ae0daad3c
commit bf90ee81c7
5 changed files with 54 additions and 37 deletions

View File

@@ -1145,7 +1145,7 @@ input[readonly] {
color: white; 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; height: 1.5em !important;
} }
@@ -1280,6 +1280,21 @@ input[readonly] {
cursor: pointer; 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 */ /* PLUGINS page */

View File

@@ -50,10 +50,10 @@
$decoded_icon = base64_decode($icon); $decoded_icon = base64_decode($icon);
$idFromMac = str_replace(":", "_", $node_mac); $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 <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>'.$node_name.' ' .$str_port.$node_badge. .'<div class="icon">'.$decoded_icon.' </div> <span class="node-name">'.$node_name.'</span>' .$str_port.$node_badge.
'</a> '</a>
</li>'; </li>';
@@ -464,7 +464,7 @@
<script src="lib/treeviz/require.js"></script> <script src="lib/treeviz/require.js"></script>
<script> <script defer>
$.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) { $.get('php/server/devices.php?action=getDevicesList&status=all&forceDefaultOrder', function(data) {
rawData = JSON.parse (data) rawData = JSON.parse (data)
@@ -664,7 +664,7 @@
// nodeHeight = ((emSize*100*0.30).toFixed(0)) // nodeHeight = ((emSize*100*0.30).toFixed(0))
nodeHeight = ((emSize*100*0.30).toFixed(0)) nodeHeight = ((emSize*100*0.30).toFixed(0))
console.log(Treeviz);
myTree = Treeviz.create({ myTree = Treeviz.create({
htmlId: "networkTree", htmlId: "networkTree",

View File

@@ -26,36 +26,37 @@ Device-detecting plugins insert values into the `CurrentScan` database table. T
| ID | Type | Description | Required | Data source | Detailed docs | | ID | Type | Description | Required | Data source | Detailed docs |
|---------------|---------|---------------------------------------------|----------|--------------------|---------------------------------------------------------------| |---------------|---------|---------------------------------------------|----------|--------------------|---------------------------------------------------------------|
| `APPRISE` | ▶️ | Apprise notification proxy | | Script | [📚_publisher_apprise](/front/plugins/_publisher_apprise/) | | `APPRISE` | ▶️ | Apprise notification proxy | | Script | [_publisher_apprise](/front/plugins/_publisher_apprise/) |
| `ARPSCAN` | 🔍 | ARP-scan on current network | | Script | [📚arp_scan](/front/plugins/arp_scan/) | | `ARPSCAN` | 🔍 | ARP-scan on current network | | Script | [arp_scan](/front/plugins/arp_scan/) |
| `CSVBCKP` | ⚙ | CSV devices backup | | Script | [📚csv_backup](/front/plugins/csv_backup/) | | `CSVBCKP` | ⚙ | CSV devices backup | | Script | [csv_backup](/front/plugins/csv_backup/) |
| `DBCLNP` | ⚙ | Database cleanup | Yes* | Script | [📚db_cleanup](/front/plugins/db_cleanup/) | | `DBCLNP` | ⚙ | Database cleanup | Yes* | Script | [db_cleanup](/front/plugins/db_cleanup/) |
| `DDNS` | ⚙ | DDNS update | | Script | [📚ddns_update](/front/plugins/ddns_update/) | | `DDNS` | ⚙ | DDNS update | | Script | [ddns_update](/front/plugins/ddns_update/) |
| `DHCPLSS` | 🔍/📥 | Import devices from DHCP leases | | Script | [📚dhcp_leases](/front/plugins/dhcp_leases/) | | `DHCPLSS` | 🔍/📥 | Import devices from DHCP leases | | Script | [dhcp_leases](/front/plugins/dhcp_leases/) |
| `DHCPSRVS` | ♻ | DHCP servers | | Script | [📚dhcp_servers](/front/plugins/dhcp_servers/) | | `DHCPSRVS` | ♻ | DHCP servers | | Script | [dhcp_servers](/front/plugins/dhcp_servers/) |
| `INTRNT` | 🔍 | Internet IP scanner | | Script | [📚internet_ip](/front/plugins/internet_ip/) | | `INTRNT` | 🔍 | Internet IP scanner | | Script | [internet_ip](/front/plugins/internet_ip/) |
| `INTRSPD` | ♻ | Internet speed test | | Script | [📚internet_speedtest](/front/plugins/internet_speedtest/) | | `INTRSPD` | ♻ | Internet speed test | | Script | [internet_speedtest](/front/plugins/internet_speedtest/) |
| `MAINT` | ⚙ | Maintenance of logs, etc. | | Script | [📚maintenance](/front/plugins/maintenance/) | | `MAINT` | ⚙ | Maintenance of logs, etc. | | Script | [maintenance](/front/plugins/maintenance/) |
| `MQTT` | ▶️ | MQTT for synching to Home Assistant | | Script | [📚_publisher_mqtt](/front/plugins/_publisher_mqtt/) | | `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/) | | `NBTSCAN` | | NSLookup (NetBIOS-based) name resolution | | Script | [nbtscan_scan](/front/plugins/nbtscan_scan/) |
| `NMAP` | | Nmap port scanning & discovery | | Script | [📚nmap_scan](/front/plugins/nmap_scan/) | | `NEWDEV` | | New device template | Yes | Template | [newdev_template](/front/plugins/newdev_template/) |
| `NMAPDEV` | 🔍 | Nmap dev scan on current network | | Script | [📚nmap_dev_scan](/front/plugins/nmap_dev_scan/) | | `NMAP` | | Nmap port scanning & discovery | | Script | [nmap_scan](/front/plugins/nmap_scan/) |
| `NSLOOKUP` | | NSLookup name resolution | | Script | [📚nslookup_scan](/front/plugins/nslookup_scan/) | | `NMAPDEV` | 🔍 | Nmap dev scan on current network | | Script | [nmap_dev_scan](/front/plugins/nmap_dev_scan/) |
| `NTFPRCS` | | Notification processing | Yes | Template | [📚notification_processing](/front/plugins/notification_processing/)| | `NSLOOKUP` | | NSLookup (DNS-based) name resolution | | Script | [nslookup_scan](/front/plugins/nslookup_scan/) |
| `NTFY` | ▶️ | NTFY notifications | | Script | [📚_publisher_ntfy](/front/plugins/_publisher_ntfy/) | | `NTFPRCS` | | Notification processing | Yes | Template | [notification_processing](/front/plugins/notification_processing/)|
| `PHOLUS` | ♻ | Pholus name resolution | | Script | [📚pholus_scan](/front/plugins/pholus_scan/) | | `NTFY` | ▶️ | NTFY notifications | | Script | [_publisher_ntfy](/front/plugins/_publisher_ntfy/) |
| `PIHOLE` | 🔍/📥 | Pi-hole device import & sync | | SQLite DB | [📚pihole_scan](/front/plugins/pihole_scan/) | | `PHOLUS` | | Pholus name resolution | | Script | [pholus_scan](/front/plugins/pholus_scan/) |
| `PUSHSAFER` | ▶️ | Pushsafer notifications | | Script | [📚_publisher_pushsafer](/front/plugins/_publisher_pushsafer/) | | `PIHOLE` | 🔍/📥 | Pi-hole device import & sync | | SQLite DB | [pihole_scan](/front/plugins/pihole_scan/) |
| `PUSHOVER` | ▶️ | Pushover notifications | | Script | [📚_publisher_pushover](/front/plugins/_publisher_pushover/) | | `PUSHSAFER` | ▶️ | Pushsafer notifications | | Script | [_publisher_pushsafer](/front/plugins/_publisher_pushsafer/) |
| `SETPWD` | | Set password | Yes | Template | [📚set_password](/front/plugins/set_password/) | | `PUSHOVER` | ▶️ | Pushover notifications | | Script | [_publisher_pushover](/front/plugins/_publisher_pushover/) |
| `SMTP` | ▶️ | Email notifications | | Script | [📚_publisher_email](/front/plugins/_publisher_email/) | | `SETPWD` | | Set password | Yes | Template | [set_password](/front/plugins/set_password/) |
| `SNMPDSC` | 🔍/📥 | SNMP device import & sync | | Script | [📚snmp_discovery](/front/plugins/snmp_discovery/) | | `SMTP` | ▶️ | Email notifications | | Script | [_publisher_email](/front/plugins/_publisher_email/) |
| `SYNC` | 🔍/⚙/📥| Sync & import from other NetAlertX instances | | Script | [📚snmp_discovery](/front/plugins/snmp_discovery/) | | `SNMPDSC` | 🔍/📥 | SNMP device import & sync | | Script | [snmp_discovery](/front/plugins/snmp_discovery/) |
| `UNDIS` | 🔍/📥 | Create dummy devices | | Script | [📚undiscoverables](/front/plugins/undiscoverables/) | | `SYNC` | 🔍/⚙/📥| Sync & import from other NetAlertX instances | | Script | [sync](/front/plugins/sync/) |
| `UNFIMP` | 🔍/📥 | UniFi device import & sync | | Script | [📚unifi_import](/front/plugins/unifi_import/) | | `UNDIS` | 🔍/📥 | Create dummy devices | | Script | [undiscoverables](/front/plugins/undiscoverables/) |
| `VNDRPDT` | ⚙ | Vendor database update | | Script | [📚vendor_update](/front/plugins/vendor_update/) | | `UNFIMP` | 🔍/📥 | UniFi device import & sync | | Script | [unifi_import](/front/plugins/unifi_import/) |
| `WEBHOOK` | ▶️ | Webhook notifications | | Script | [📚_publisher_webhook](/front/plugins/_publisher_webhook/) | | `VNDRPDT` | | Vendor database update | | Script | [vendor_update](/front/plugins/vendor_update/) |
| `WEBMON` | | Website down monitoring | | Script | [📚website_monitor](/front/plugins/website_monitor/) | `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. > \* The database cleanup plugin (`DBCLNP`) is not _required_ but the app will become unusable after a while if not executed.

View File

@@ -104,7 +104,7 @@ def execute_name_lookup (ip, timeout):
# Look for the first line containing a valid NetBIOS name entry # Look for the first line containing a valid NetBIOS name entry
index = 0 index = 0
for line in lines: 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 # Split the line and extract the primary NetBIOS name
parts = line.split() parts = line.split()
if parts: if parts:

View File

@@ -773,6 +773,7 @@ def cleanDeviceName(str, match_IP):
str = re.sub(r'\.\b', '', str) # trailing dot after words str = re.sub(r'\.\b', '', str) # trailing dot after words
str = re.sub(r'\.$', '', str) # trailing dot at the end of the string 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]) mylog('debug', ["[cleanDeviceName] output: " + str])