diff --git a/front/network.php b/front/network.php index e5d7ba2a..04c552e0 100755 --- a/front/network.php +++ b/front/network.php @@ -620,7 +620,7 @@ nodeHeight = ((emSize*100*0.30).toFixed(0)) - $("#networkTree").attr('style', "height:"+treeAreaHeight+"px; width:1070px") + $("#networkTree").attr('style', `height:${treeAreaHeight}px; width:${$('.content-header').width()}px`) myTree = Treeviz.create({ htmlId: "networkTree", diff --git a/front/php/templates/header.php b/front/php/templates/header.php index 4958c2e8..1582e641 100755 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -112,7 +112,7 @@ if ($ENABLED_DARKMODE === True) { - onLoad="show_pia_servertime();" > + onLoad="show_pia_servertime();" >
diff --git a/front/plugins/README.md b/front/plugins/README.md index 4dcccb57..20112c32 100755 --- a/front/plugins/README.md +++ b/front/plugins/README.md @@ -313,9 +313,13 @@ The UI will adjust how columns are displayed in the UI based on the definition o ## Full Examples -- Script based plugin: Check the [website_monitor (WEBMON) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/website_monitor/config.json) file for details. -- SQL query nased plugin: Check the [nmap_services (NMAPSERV) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/nmap_services/config.json) file for details. +### Script based plugins +- [website_monitor (WEBMON) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/website_monitor/config.json) +- [dhcp_servers (DHCPSRVS) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/dhcp_servers/config.json) + +### SQL query based plugins +- [nmap_services (NMAPSERV) config.json](https://github.com/jokob-sk/Pi.Alert/blob/main/front/plugins/nmap_services/config.json) ### Screenshots @@ -323,7 +327,7 @@ The UI will adjust how columns are displayed in the UI based on the definition o |----------------------|----------------------| | ![Screen 3][screen3] | ![Screen 4][screen4] | -[screen1]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins.png "Screen 1" -[screen2]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_settings.png "Screen 2" -[screen3]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_json_settings.png "Screen 3" -[screen4]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_json_ui.png "Screen 4" +[screen1]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins.png "Screen 1" +[screen2]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_settings.png "Screen 2" +[screen3]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_json_settings.png "Screen 3" +[screen4]: https://raw.githubusercontent.com/jokob-sk/Pi.Alert/main/docs/img/plugins_json_ui.png "Screen 4" diff --git a/front/plugins/dhcp_servers/README.md b/front/plugins/dhcp_servers/README.md index c5474ad1..6ed96c4d 100755 --- a/front/plugins/dhcp_servers/README.md +++ b/front/plugins/dhcp_servers/README.md @@ -1,12 +1,11 @@ ## Overview -A simple sample plugin allowing for monitoring web services or urls. The status code corresponds to the commonly used [HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status). +A simple sample plugin allowing for detecting rogue DHCP servers on the network. ### Usage -- The user can specify which services (websites) to monitor via the `WEBMON_urls_to_check` setting. +- No specific configuration needed. ### Notes -- Setting `(WEBMON_)SQL_internet_ip` is not used and specified for demonstration purposes only. -- Parameters `macs` and `internet_ip` in the `config.json` file are not used and specified for demonstration purposes only. \ No newline at end of file +- No specific configuration needed. \ No newline at end of file diff --git a/front/plugins/dhcp_servers/script.py b/front/plugins/dhcp_servers/script.py index 947fd1b5..9213433e 100755 --- a/front/plugins/dhcp_servers/script.py +++ b/front/plugins/dhcp_servers/script.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # Based on the work of https://github.com/leiweibau/Pi.Alert -# /home/pi/pialert/front/plugins/website_monitor/script.py urls=http://google.com,http://bing.com from __future__ import unicode_literals from time import sleep, time, strftime import requests @@ -9,14 +8,10 @@ import pathlib import threading import subprocess import socket - import argparse import io -#import smtplib import sys -#from smtp_config import sender, password, receivers, host, port from requests.packages.urllib3.exceptions import InsecureRequestWarning - import pwd import os @@ -43,10 +38,6 @@ def main(): #dhcp_server_list_time = [] for _ in range(dhcp_probes): output = subprocess.check_output (nmapArgs, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(timeoutSec )) - # stream = os.popen('sudo nmap --script broadcast-dhcp-discover 2>/dev/null') - # output = stream.read() - # last_run_logfile.write(output) - newLines = newLines + output.split("\n") # parse output @@ -60,14 +51,10 @@ def main(): else: index = len(newEntries) - 1 - if 'Response ' in line and ' of ' in line: - - newEntries.append(plugin_object_class()) - + if 'Response ' in line and ' of ' in line: + newEntries.append(plugin_object_class()) elif 'Server Identifier' in line : newEntries[index].primaryId = line.split(':')[1].strip() - - elif 'Domain Name' in line : newEntries[index].secondaryId = line.split(':')[1].strip() elif 'Domain Name Server' in line : @@ -80,12 +67,10 @@ def main(): newEntries[index].watched4 = line.split(':')[1].strip() newEntries[index].foreignKey = line.split(':')[1].strip() elif ('IP Address Lease Time' in line or 'Subnet Mask' in line or 'Broadcast Address' in line) : - newEntries[index].extra = newEntries[index].extra + ',' + line.split(':')[1].strip() - + newEntries[index].extra = newEntries[index].extra + ',' + line.split(':')[1].strip() for e in newEntries: - # Insert list into the log - + # Insert list into the log service_monitoring_log(e.primaryId, e.secondaryId, e.created, e.watched1, e.watched2, e.watched3, e.watched4, e.extra, e.foreignKey ) # -----------------------------------------------------------------------------