diff --git a/back/report_template.html b/back/report_template.html index 4befe628..e5868bd0 100755 --- a/back/report_template.html +++ b/back/report_template.html @@ -1,11 +1,16 @@ - + @@ -23,7 +28,7 @@ - +
Report Date:
@@ -31,7 +36,7 @@ - + @@ -39,14 +44,23 @@ + - +
- +
Pi.Alert - + Pi.Alert + () +
©2020 Puche (2022+ + jokob-sk) | Built on: | Version: | + + Docs + +
@@ -54,4 +68,4 @@ - \ No newline at end of file + diff --git a/back/report_template_new_version.html b/back/report_template_new_version.html index 958a6f25..d7c8585c 100755 --- a/back/report_template_new_version.html +++ b/back/report_template_new_version.html @@ -1,11 +1,16 @@ - + @@ -20,14 +25,10 @@ Pi.Alert Report - - - 🆕 New version available 🆕 - - + - +
Report Date:
@@ -35,27 +36,36 @@ - - - - - - - - + + + + + + + + + + + - +
- +
Pi.Alert - + Pi.Alert + () +
©2020 Puche (2022+ + jokob-sk) | Built on: | Version: | + + Docs + +
- - - \ No newline at end of file + diff --git a/front/php/templates/build.php b/front/php/templates/build.php new file mode 100644 index 00000000..cc72aa7e --- /dev/null +++ b/front/php/templates/build.php @@ -0,0 +1,21 @@ + diff --git a/front/php/templates/version.php b/front/php/templates/version.php new file mode 100644 index 00000000..459faeca --- /dev/null +++ b/front/php/templates/version.php @@ -0,0 +1,21 @@ + diff --git a/pialert/reporting.py b/pialert/reporting.py index 286d47a7..5fce7b39 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -1,4 +1,14 @@ - +#---------------------------------------------------------------------------------# +# Pi.Alert # +# Open Source Network Guard / WIFI & LAN intrusion detector # +# # +# reporting.py - Pialert Back module. Template to email reporting in HTML format # +#---------------------------------------------------------------------------------# +# Puche 2021 pi.alert.application@gmail.com GNU GPLv3 # +# jokob-sk 2022 jokob.sk@gmail.com GNU GPLv3 # +# leiweibau 2022 https://github.com/leiweibau GNU GPLv3 # +# cvc90 2023 https://github.com/cvc90 GNU GPLv3 # +#---------------------------------------------------------------------------------# import datetime import json @@ -11,6 +21,7 @@ from json2table import convert # pialert modules import conf +import const from const import pialertPath, logPath, apiPath from helper import noti_struc, generate_mac_links, removeDuplicateNewLines, timeNowTZ, hide_email, updateState, get_file_content, write_file from logger import logResult, mylog, print_log @@ -47,8 +58,8 @@ def construct_notifications(db, sqlQuery, tableTitle, skipText = False, supplied return noti_struc("", "", "") table_attributes = {"style" : "border-collapse: collapse; font-size: 12px; color:#70707", "width" : "100%", "cellspacing" : 0, "cellpadding" : "3px", "bordercolor" : "#C0C0C0", "border":"1"} - headerProps = "width='120px' style='color:blue; font-size: 16px;' bgcolor='#909090' " - thProps = "width='120px' style='color:#F0F0F0' bgcolor='#909090' " + headerProps = "width='120px' style='color:white; font-size: 16px;' bgcolor='#64a0d6' " + thProps = "width='120px' style='color:#F0F0F0' bgcolor='#64a0d6' " build_direction = "TOP_TO_BOTTOM" text_line = '{}\t{}\n' @@ -139,14 +150,25 @@ def send_notifications (db): mail_html = template_file.read() template_file.close() - # Report Header & footer + # Report "REPORT_DATE" in Header & footer timeFormated = timeNowTZ().strftime ('%Y-%m-%d %H:%M') mail_text = mail_text.replace ('', timeFormated) mail_html = mail_html.replace ('', timeFormated) + # Report "SERVER_NAME" in Header & footer mail_text = mail_text.replace ('', socket.gethostname() ) mail_html = mail_html.replace ('', socket.gethostname() ) + # Report "VERSION" in Header & footer + VERSIONFILE = subprocess.check_output(['php', pialertPath + '/front/php/templates/version.php']).decode('utf-8') + mail_text = mail_text.replace ('', VERSIONFILE) + mail_html = mail_html.replace ('', VERSIONFILE) + + # Report "BUILD" in Header & footer + BUILDFILE = subprocess.check_output(['php', pialertPath + '/front/php/templates/build.php']).decode('utf-8') + mail_text = mail_text.replace ('', BUILDFILE) + mail_html = mail_html.replace ('', BUILDFILE) + mylog('verbose', ['[Notification] included sections: ', conf.INCLUDED_SECTIONS ]) if 'internet' in conf.INCLUDED_SECTIONS : @@ -530,4 +552,4 @@ def handle_test(testType): if testType == 'REPORT_PUSHSAFER': send_pushsafer (sample_msg) - mylog('minimal', ['[Test Publishers] END Test: ', testType]) \ No newline at end of file + mylog('minimal', ['[Test Publishers] END Test: ', testType])