- merged timezone configuration with pialert.conf as the settings file
- merged NTFY support
- the variable REPORT_DASHBOARD_URL was merged (duplication in Pushsafer and NTFY)
- update README
This commit is contained in:
leiweibau
2022-07-23 21:19:30 +02:00
parent 6bfa7d5816
commit 3f304a02ff
4 changed files with 57 additions and 7 deletions

View File

@@ -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"

View File

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

View File

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

View File

@@ -8,7 +8,23 @@
#--------------------------------------------------------------------------- -->
<?php
###################################
## TimeZone processing start
###################################
$config_file = "../config/pialert.conf";
$config_file_lines = file($config_file);
$config_file_lines_timezone = array_values(preg_grep('/^TIMEZONE\s.*/', $config_file_lines));
$timezone_line = explode("'", $config_file_lines_timezone[0]);
$Pia_TimeZone = $timezone_line[1];
date_default_timezone_set($Pia_TimeZone);
###################################
## TimeZone processing end
###################################
###################################
## GUI settings processing start
###################################
if (file_exists('../db/setting_darkmode')) {
$ENABLED_DARKMODE = True;
}
@@ -22,7 +38,9 @@ foreach (glob("../db/setting_language*") as $filename) {
}
if (strlen($pia_lang_selected) == 0) {$pia_lang_selected = 'en_us';}
require 'php/templates/language/'.$pia_lang_selected.'.php';
###################################
## GUI settings processing end
###################################
?>
<!DOCTYPE html>