Skip to content

Commit

Permalink
Reverse DNS docs + NEW status priority #549
Browse files Browse the repository at this point in the history
  • Loading branch information
jokob-sk committed Jan 30, 2024
1 parent 79f2c4a commit b2231a5
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker_cache-cleaner.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci-package-cleaner
name: 🤖Automation - ci-package-cleaner

on:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update_sponsors_table.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Sponsors Table
name: 🤖Automation - Update Sponsors Table

on:
schedule:
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
13 changes: 9 additions & 4 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -33,17 +41,14 @@ 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)

#### ⚙ System Management

- [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

Expand Down
27 changes: 27 additions & 0 deletions docs/REVERSE_DNS.md
Original file line number Diff line number Diff line change
@@ -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.
43 changes: 22 additions & 21 deletions front/devices.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

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"
return "Unknown status"
}

// -----------------------------------------------------------------------------
Expand Down
9 changes: 6 additions & 3 deletions front/plugins/nslookup_scan/nslookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b2231a5

Please sign in to comment.