diff --git a/front/php/templates/version.php b/front/php/templates/version.php index bb6aed1c..946a507b 100755 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -11,11 +11,16 @@ # cvc90 2023 https://github.com/cvc90 GNU GPLv3 # #---------------------------------------------------------------------------------# - $filename = "/app/.VERSION"; - if(file_exists($filename)) { - echo file_get_contents($filename); +$filename = "/app/.VERSION"; +if(file_exists($filename)) { + $fileContents = file_get_contents($filename); + if(trim($fileContents) === 'Dev') { + echo date('H:i:s') . " - " . $fileContents; + } else { + echo $fileContents; } - else{ - echo date('Y-m-d H:i:s') . " - N/A"; - } +} +else { + echo date('H:i:s') . " - N/A"; +} ?> diff --git a/front/plugins/dhcp_leases/script.py b/front/plugins/dhcp_leases/script.py index 26e6b1e5..60432166 100755 --- a/front/plugins/dhcp_leases/script.py +++ b/front/plugins/dhcp_leases/script.py @@ -56,6 +56,7 @@ def get_entries(path, plugin_objects): # Use the detected encoding encoding = result['encoding'] + # Order: MAC, IP, IsActive, NAME, Hardware # Handle pihole-specific dhcp.leases files if 'pihole' in path: with open(path, 'r', encoding=encoding, errors='replace') as f: @@ -72,6 +73,24 @@ def get_entries(path, plugin_objects): extra = handleEmpty(path), foreignKey = handleEmpty(row[1]) ) + elif 'dnsmasq' in path: + # [Lease expiry time] [mac address] [ip address] [hostname] [client id, if known] + # e.g. + # 1715932537 01:5c:5c:5c:5c:5c:5c 192.168.1.115 ryans-laptop 01:5c:5c:5c:5c:5c:5c + with open(path, 'r', encoding=encoding, errors='replace') as f: + for line in f: + row = line.rstrip().split() + if len(row) > 3: + plugin_objects.add_object( + primaryId = handleEmpty(row[1]), + secondaryId = handleEmpty(row[2]), + watched1 = handleEmpty('True'), + watched2 = handleEmpty(row[3]), + watched3 = '', + watched4 = handleEmpty('True'), + extra = handleEmpty(path), + foreignKey = handleEmpty(row[1]) + ) else: # Handle generic dhcp.leases files leases = DhcpLeases(path)