mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
add ntfy support
This commit is contained in:
@@ -27,6 +27,7 @@ import socket
|
||||
import io
|
||||
import smtplib
|
||||
import csv
|
||||
import requests
|
||||
|
||||
|
||||
#===============================================================================
|
||||
@@ -1369,6 +1370,11 @@ def email_reporting ():
|
||||
send_email (mail_text, mail_html)
|
||||
else :
|
||||
print (' Skip mail...')
|
||||
if REPORT_NTFY :
|
||||
print (' Sending report by NTFY...')
|
||||
send_ntfy (mail_text)
|
||||
else :
|
||||
print (' Skip NTFY...')
|
||||
else :
|
||||
print (' No changes to report...')
|
||||
|
||||
@@ -1387,7 +1393,16 @@ def email_reporting ():
|
||||
# Commit changes
|
||||
sql_connection.commit()
|
||||
closeDB()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
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
|
||||
|
||||
@@ -23,6 +23,10 @@ REPORT_FROM = 'Pi.Alert <' + SMTP_USER +'>'
|
||||
REPORT_TO = 'user@gmail.com'
|
||||
REPORT_DEVICE_URL = 'http://pi.alert/deviceDetails.php?mac='
|
||||
|
||||
REPORT_NTFY = False
|
||||
REPORT_DASHBOARD_URL = 'http://pi.alert/'
|
||||
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
|
||||
@@ -36,6 +40,7 @@ PIHOLE_DB = '/etc/pihole/pihole-FTL.db'
|
||||
DHCP_ACTIVE = False
|
||||
DHCP_LEASES = '/etc/pihole/dhcp.leases'
|
||||
|
||||
|
||||
# arp-scan options & samples
|
||||
#
|
||||
# Scan local network (default)
|
||||
|
||||
Reference in New Issue
Block a user