diff --git a/README.md b/README.md index 4d3016f3..3f036037 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ WIFI / LAN intruder detector. Scan the devices connected to your WIFI / LAN and alert you the connection of -unknown devices. It also warns the disconnection of "always connected" devices. +unknown devices. It also warns if a "always connected" devices disconnects. ![Main screen][main] *(Apologies for my English and my limited knowledge of Python, php and @@ -43,14 +43,16 @@ In charge of: - Scan the network searching connected devices using the scanning methods described - Store the information in the DB - - Report the changes detected by e-mail + - Report the changes detected by e-mail and/or other services (Pushsafer, NTFY, Gotify) - Optional speedtest for Device "Internet" | ![Report 1][report1] | ![Report 2][report2] | | -------------------- | -------------------- | ### Front -A web frontal that allows: +There is a configurable login to prevent unauthorized use. The default password is "123456" + +A web frontend that allows: - Manage the devices inventory and the characteristics - Display in a visual way all the information collected by the back - Sessions @@ -61,8 +63,8 @@ A web frontal that allows: - Concurrent devices - Down alerts - IP's - - manuel nmap scans - - Optional speedtest for Device "Internet" + - Manuel Nmap scans + - Optional speedtest for Device "Internet" in the details view - ... | ![Screen 1][screen1] | ![Screen 2][screen2] | @@ -148,6 +150,15 @@ Linux distributions. ***Suggestions and comments are welcome*** +### Special thanks 🥇 + + This code is a collaborative body of work, with special thanks to: + + - [leiweibau](https://github.com/leiweibau/Pi.Alert): Dark mode (and Last X scans activity chart) + - [Macleykun](https://github.com/Macleykun): Help with Dockerfile clean-up + - [Final-Hawk](https://github.com/Final-Hawk): Help with NTFY, styling and other fixes + - [terorero](https://github.com/terorero): Spanish translation + - [jokob-sk/Pi.Alert](https://github.com/jokob-sk/Pi.Alert): DB Maintenance tools [main]: ./docs/img/1_devices.jpg "Main screen" diff --git a/back/pialert.py b/back/pialert.py index 7b8308f7..1dd6278d 100644 --- a/back/pialert.py +++ b/back/pialert.py @@ -1363,6 +1363,11 @@ def email_reporting (): send_pushsafer (mail_text) else : print (' Skip PUSHSAFER...') + if REPORT_NTFY : + print (' Sending report by NTFY...') + send_ntfy (mail_text) + else : + print (' Skip NTFY...') else : print (' No changes to report...') @@ -1404,6 +1409,18 @@ def send_pushsafer (_Text): json = urlopen(request).read().decode() # print(json) +#------------------------------------------------------------------------------- + +def send_ntfy (_Text): + requests.post("https://ntfy.sh/{}".format(NTFY_TOPIC), + data=_Text, + headers={ + "Title": "Pi.Alert Notification", + "Click": REPORT_DASHBOARD_URL, + "Priority": "urgent", + "Tags": "warning" + }) + #------------------------------------------------------------------------------- def format_report_section (pActive, pSection, pTable, pText, pHTML): global mail_text diff --git a/config/pialert.conf b/config/pialert.conf index fb917f36..42f82997 100644 --- a/config/pialert.conf +++ b/config/pialert.conf @@ -12,6 +12,7 @@ DB_PATH = PIALERT_PATH + '/db/pialert.db' LOG_PATH = PIALERT_PATH + '/log' VENDORS_DB = '/usr/share/arp-scan/ieee-oui.txt' PRINT_LOG = False +TIMEZONE = 'Europe/Berlin' PIALERT_WEB_PROTECTION = False PIALERT_WEB_PASSWORD = '8d969eef6ecad3c29a3a629280e686cf0c3f5d5a86aff3ca12020c923adc6c92' @@ -26,11 +27,14 @@ REPORT_MAIL = False REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>' REPORT_TO = 'user@gmail.com' REPORT_DEVICE_URL = 'http://pi.alert/deviceDetails.php?mac=' +REPORT_DASHBOARD_URL = 'http://pi.alert/' REPORT_PUSHSAFER = False -REPORT_DASHBOARD_URL = '' PUSHSAFER_TOKEN = 'ApiKey' +REPORT_NTFY = False +NTFY_TOPIC = 'replace_my_secure_topicname_91h889f28' + # QUERY_MYIP_SERVER = 'https://diagnostic.opendns.com/myip' QUERY_MYIP_SERVER = 'http://ipv4.icanhazip.com' DDNS_ACTIVE = False diff --git a/front/php/templates/header.php b/front/php/templates/header.php index cc4395cb..392aac1e 100644 --- a/front/php/templates/header.php +++ b/front/php/templates/header.php @@ -8,7 +8,23 @@ #--------------------------------------------------------------------------- -->