BETA - Table ascii for ntfy

This commit is contained in:
Joshua
2022-07-21 15:47:56 +10:00
parent 6b4c0db79a
commit 7e6c53f7b8
2 changed files with 6 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ ENV USER=pi USER_ID=1000 USER_GID=1000 TZ=Europe/London PORT=20211
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 \
&& pip install requests \
&& pip install requests prettytable \
&& apt-get clean autoclean \
&& apt-get autoremove \
&& rm -rf /var/lib/apt/lists/* \

View File

@@ -28,7 +28,7 @@ import io
import smtplib
import csv
import requests
from prettytable import PrettyTable
#===============================================================================
# CONFIG CONSTANTS
@@ -1284,7 +1284,8 @@ def email_reporting ():
WHERE eve_PendingAlertEmail = 1
AND eve_EventType = 'New Device'
ORDER BY eve_DateTime""")
mail_text_table = PrettyTable()
mail_text_table.field_names = ["MAC", "Time", "IP", "Name", "Additional Info"]
for eventAlert in sql :
mail_section_new_devices = True
mail_text_new_devices += text_line_template.format (
@@ -1295,7 +1296,9 @@ def email_reporting ():
REPORT_DEVICE_URL, eventAlert['eve_MAC'], eventAlert['eve_MAC'],
eventAlert['eve_DateTime'], eventAlert['eve_IP'],
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',
'TABLE_NEW_DEVICES', mail_text_new_devices, mail_html_new_devices)