Reverse DNS docs + NEW status priority #549

This commit is contained in:
Jokob-sk
2024-01-30 21:32:03 +11:00
parent 79f2c4a1b0
commit b2231a592d
7 changed files with 69 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
name: ci-package-cleaner
name: 🤖Automation - ci-package-cleaner
on:

View File

@@ -1,4 +1,4 @@
name: Update Sponsors Table
name: 🤖Automation - Update Sponsors Table
on:
schedule:

View File

@@ -94,7 +94,9 @@ Get visibility of what's going on on your WIFI/LAN network. Scan for devices, po
### ⭐ Sponsors
### ⭐ Sponsors (Work in progress)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/jokob-sk?style=social)](https://github.com/sponsors/jokob-sk)
Thank you to all the wonderful people who have sponsored this project (=prevented my burnout):

View File

@@ -25,6 +25,14 @@ There is also an in-app Help / FAQ section that should be answering frequently a
### 📚 Table of contents
#### 📥 Initial Setup
- [Subnets and VLANs configuration for arp-scan](/docs/SUBNETS.md)
- [SMTP server config](/docs/SMTP.md)
- [Custom Icon configuration and support](/docs/ICONS.md)
- [Better name resolution with Reverse DNS](/docs/REVERSE_DNS.md)
- [Network treemap configuration](/docs/NETWORK_TREE.md)
#### 🐛 Debugging help & tips
- [Debugging tips](/docs/DEBUG_TIPS.md)
@@ -33,9 +41,6 @@ There is also an in-app Help / FAQ section that should be answering frequently a
#### 🔝 Popular/Suggested
- [Network treemap configuration](/docs/NETWORK_TREE.md)
- [SMTP server config](/docs/SMTP.md)
- [Subnets and VLANs configuration for arp-scan](/docs/SUBNETS.md)
- [Home Assistant](/docs/HOME_ASSISTANT.md)
- [Bulk edit devices](/docs/DEVICES_BULK_EDITING.md)
@@ -43,7 +48,7 @@ There is also an in-app Help / FAQ section that should be answering frequently a
- [Manage devices (legacy docs)](/docs/DEVICE_MANAGEMENT.md)
- [Random MAC/MAC icon meaning (legacy docs)](/docs/RANDOM_MAC.md)
- [Custom Icon configuration and support](/docs/ICONS.md)
#### 🔎 Examples

27
docs/REVERSE_DNS.md Executable file
View File

@@ -0,0 +1,27 @@
## Setting up better name discovery with Reverse DNS
If you are running a DNS server, such as AdGuard, set up **Private reverse DNS servers** for a better name resolution on your network. Enabling this setting will enable PiAlert to execute dig and nslookup comamnds to automatically resolve device names based on their IP addresses.
> Example 1: Reverse DNS `disabled`
>
> ```
> jokob@Synology-NAS:/$ nslookup 192.168.1.58
> ** server can't find 58.1.168.192.in-addr.arpa: NXDOMAIN
>
> ```
> Example 2: Reverse DNS `enabled`
>
> ```
> jokob@Synology-NAS:/$ nslookup 192.168.1.58
> 45.1.168.192.in-addr.arpa name = jokob-NUC.localdomain.
> ```
### Enabling reverse DNS in AdGuard
1. Navigate to **Settings** -> **DNS Settings**
2. Locate **Private reverse DNS servers**
3. Enter your router IP address, such as `192.168.1.1`
4. Make sure you have **Use private reverse DNS resolvers** ticked.
5. Click **Apply** to save your settings.

View File

@@ -343,28 +343,29 @@ function filterDataByStatus(data, status) {
// -----------------------------------------------------------------------------
function getDeviceStatus(item)
{
if(item.dev_PresentLastScan === 1)
{
return 'On-line';
}
else if(item.dev_PresentLastScan === 0 && item.dev_AlertDeviceDown !== 0)
{
return 'Down';
}
else if(item.dev_NewDevice === 1)
{
return 'New';
}
else if(item.dev_Archived === 1)
{
return 'Archived';
}
else if(item.dev_PresentLastScan === 0)
{
return 'Off-line';
}
return "Unknown status"
if(item.dev_NewDevice === 1)
{
return 'New';
}
else if(item.dev_PresentLastScan === 1)
{
return 'On-line';
}
else if(item.dev_PresentLastScan === 0 && item.dev_AlertDeviceDown !== 0)
{
return 'Down';
}
else if(item.dev_Archived === 1)
{
return 'Archived';
}
else if(item.dev_PresentLastScan === 0)
{
return 'Off-line';
}
return "Unknown status"
}
// -----------------------------------------------------------------------------

View File

@@ -51,6 +51,8 @@ def main():
# Retrieve devices
unknown_devices = device_handler.getUnknown()
mylog('verbose', [f'[{pluginName}] Unknown devices count: {len(unknown_devices)}'])
for device in unknown_devices:
domain_name, dns_server = execute_nslookup(device['dev_LastIP'], timeout)
@@ -95,9 +97,10 @@ def execute_nslookup (ip, timeout):
mylog('verbose', [f'[{pluginName}] DEBUG OUTPUT : {output}'])
# Parse output using regular expressions
domain_pattern = re.compile(r'Name:\s+(.+)')
server_pattern = re.compile(r'Server:\s+(.+)')
# Parse output using case-insensitive regular expressions
domain_pattern = re.compile(r'name\s*=\s*([^\s]+)', re.IGNORECASE)
server_pattern = re.compile(r'Server:\s+(.+)', re.IGNORECASE)
domain_match = domain_pattern.search(output)
server_match = server_pattern.search(output)