mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
BETA - Table ascii for ntfy
This commit is contained in:
@@ -8,7 +8,7 @@ ENV USER=pi USER_ID=1000 USER_GID=1000 TZ=Europe/London PORT=20211
|
|||||||
|
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install --no-install-recommends ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 nmap python-pip -y \
|
&& apt-get install --no-install-recommends ca-certificates curl libwww-perl arp-scan perl apt-utils cron sudo lighttpd php php-cgi php-fpm php-sqlite3 sqlite3 dnsutils net-tools python iproute2 nmap python-pip -y \
|
||||||
&& pip install requests \
|
&& pip install requests prettytable \
|
||||||
&& apt-get clean autoclean \
|
&& apt-get clean autoclean \
|
||||||
&& apt-get autoremove \
|
&& apt-get autoremove \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import io
|
|||||||
import smtplib
|
import smtplib
|
||||||
import csv
|
import csv
|
||||||
import requests
|
import requests
|
||||||
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
# CONFIG CONSTANTS
|
# CONFIG CONSTANTS
|
||||||
@@ -1284,7 +1284,8 @@ def email_reporting ():
|
|||||||
WHERE eve_PendingAlertEmail = 1
|
WHERE eve_PendingAlertEmail = 1
|
||||||
AND eve_EventType = 'New Device'
|
AND eve_EventType = 'New Device'
|
||||||
ORDER BY eve_DateTime""")
|
ORDER BY eve_DateTime""")
|
||||||
|
mail_text_table = PrettyTable()
|
||||||
|
mail_text_table.field_names = ["MAC", "Time", "IP", "Name", "Additional Info"]
|
||||||
for eventAlert in sql :
|
for eventAlert in sql :
|
||||||
mail_section_new_devices = True
|
mail_section_new_devices = True
|
||||||
mail_text_new_devices += text_line_template.format (
|
mail_text_new_devices += text_line_template.format (
|
||||||
@@ -1295,7 +1296,9 @@ def email_reporting ():
|
|||||||
REPORT_DEVICE_URL, eventAlert['eve_MAC'], eventAlert['eve_MAC'],
|
REPORT_DEVICE_URL, eventAlert['eve_MAC'], eventAlert['eve_MAC'],
|
||||||
eventAlert['eve_DateTime'], eventAlert['eve_IP'],
|
eventAlert['eve_DateTime'], eventAlert['eve_IP'],
|
||||||
eventAlert['dev_Name'], eventAlert['eve_AdditionalInfo'])
|
eventAlert['dev_Name'], eventAlert['eve_AdditionalInfo'])
|
||||||
|
mail_text_table.add_row([eventAlert['eve_MAC'], eventAlert['eve_DateTime'], eventAlert['eve_IP'], eventAlert['dev_Name'],eventAlert['eve_AdditionalInfo']])
|
||||||
|
|
||||||
|
mail_text_new_devices = mail_text_table
|
||||||
format_report_section (mail_section_new_devices, 'SECTION_NEW_DEVICES',
|
format_report_section (mail_section_new_devices, 'SECTION_NEW_DEVICES',
|
||||||
'TABLE_NEW_DEVICES', mail_text_new_devices, mail_html_new_devices)
|
'TABLE_NEW_DEVICES', mail_text_new_devices, mail_html_new_devices)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user