From d9761e771f6ede563864f4c9f8b5f911130c7f72 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Sun, 6 Aug 2023 10:07:18 +0200 Subject: [PATCH 01/13] Create and Update report_template.html Modified creator banner url repot_template.html --> report_template.html Modified the creators banner adding to cvc90 Removed several white spaces between banner and tag Changed the background color in the table (bgcolor=#00c0ef --> bgcolor=#4b99d3) Changed the color of the text to white in the table (bgcolor=#4b99d3 --> bgcolor=#ffffff) Changed the background color in td (bgcolor=#F5F5F5 --> bgcolor=#F1F5F5) Changed the background color in the footer table (bgcolor=#46802e --> bgcolor=#3c8dbc) Added in the footer table the color of the text to white (color: white) Changed footer text --- back/report_template.html | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/back/report_template.html b/back/report_template.html index 4befe628..3328aec5 100755 --- a/back/report_template.html +++ b/back/report_template.html @@ -1,11 +1,14 @@ - +#---------------------------------------------------------------------------------# +# Pi.Alert # +# Open Source Network Guard / WIFI & LAN intrusion detector # +# # +# report_template.html - 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 # +#---------------------------------------------------------------------------------# @@ -23,7 +26,7 @@ - +
Report Date:
@@ -31,7 +34,7 @@ - + @@ -39,14 +42,23 @@ + - +
- +
Pi.Alert - + Pi.Alert + () +
©2020 Puche (2022+ + jokob-sk) | Built on: | Version: | + + Docs + +
@@ -54,4 +66,4 @@ - \ No newline at end of file + From 42ebb687f814c7d28c0d45a2d378cff9a1c07e0f Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Sun, 6 Aug 2023 10:13:32 +0200 Subject: [PATCH 02/13] Create and update report_template_new_version.html Modified creator banner url (repot_template.html --> report_template_new_version.html) Modified the creators banner adding to cvc90 Removed several white spaces between banner and tag Changed the background color in the table (bgcolor=#00c0ef --> bgcolor=#4b99d3) Changed the color of the text to white in the table ( bgcolor=#4b99d3 --> bgcolor=#ffffff) Changed the background color in td (bgcolor=#F5F5F5 --> bgcolor=#F1F5F5) Changed the background color in the footer table (bgcolor=#46802e --> bgcolor=#3c8dbc) Added in the footer table the color of the text to white (color: white) Changed footer text --- back/report_template_new_version.html | 62 +++++++++++++++------------ 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/back/report_template_new_version.html b/back/report_template_new_version.html index 958a6f25..3328aec5 100755 --- a/back/report_template_new_version.html +++ b/back/report_template_new_version.html @@ -1,11 +1,14 @@ - +#---------------------------------------------------------------------------------# +# Pi.Alert # +# Open Source Network Guard / WIFI & LAN intrusion detector # +# # +# report_template.html - 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 # +#---------------------------------------------------------------------------------# @@ -20,14 +23,10 @@ Pi.Alert Report - - - 🆕 New version available 🆕 - - + - +
Report Date:
@@ -35,27 +34,36 @@ - - - - - - - - + + + + + + + + + + + - +
- +
Pi.Alert - + Pi.Alert + () +
©2020 Puche (2022+ + jokob-sk) | Built on: | Version: | + + Docs + +
- - - \ No newline at end of file + From 6c166908a1236f48d6902520b2133930b6d23ee3 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Sun, 6 Aug 2023 10:18:32 +0200 Subject: [PATCH 03/13] Create and update reporting.py Added creator banner Added import const Changed color in headerProps variable (color:blue --> color:white) Modified bgcolor in headerProps variable (bgcolor=#909090 --> bgcolor=#64a0d6) Modified bgcolor in the thProps variable (bgcolor=#909090 --> bgcolor=#64a0d6) --- pialert/reporting.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/pialert/reporting.py b/pialert/reporting.py index c3f6abaa..405de198 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, timeNow, hide_email, updateState, get_file_content, write_file from logger import logResult, mylog, print_log @@ -46,8 +57,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' @@ -522,4 +533,4 @@ def handle_test(testType): if testType == 'REPORT_PUSHSAFER': send_pushsafer (sample_msg) - mylog('info', ['[Test Publishers] END Test: ', testType]) \ No newline at end of file + mylog('info', ['[Test Publishers] END Test: ', testType]) From e119d51d081145656ac38aee4d5e6c1347f4d651 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:49:52 +0200 Subject: [PATCH 04/13] Update report_template.html Fix banner creators --- back/report_template.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/back/report_template.html b/back/report_template.html index 3328aec5..e5868bd0 100755 --- a/back/report_template.html +++ b/back/report_template.html @@ -1,3 +1,4 @@ + From 40e94e45a26afc29f18af9faf43c394ee1de4351 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:51:02 +0200 Subject: [PATCH 05/13] Update report_template_new_version.html Fix banner creators --- back/report_template_new_version.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/back/report_template_new_version.html b/back/report_template_new_version.html index 3328aec5..d7c8585c 100755 --- a/back/report_template_new_version.html +++ b/back/report_template_new_version.html @@ -1,3 +1,4 @@ + From fa7582135e6909b1740c8f26fa0dc482a63afe2a Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:09:01 +0200 Subject: [PATCH 06/13] Update reporting.py Added new code "VERSION" to report version in report file Added new code "BUILD" to report version in report file Updated "REPORT_DATE" comment tag Updated "SERVER_NAME" comment tag --- pialert/reporting.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pialert/reporting.py b/pialert/reporting.py index 761512df..6a1f24ab 100755 --- a/pialert/reporting.py +++ b/pialert/reporting.py @@ -150,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 : @@ -541,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]) From 25bdc3618302a89ddf54361034c05bf50dacd5b4 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:12:10 +0200 Subject: [PATCH 07/13] Create version.php Created file version.php Added new php code to search for version file and if it doesn't find it, it shows the file not found error. --- front/php/templates/version.php | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 front/php/templates/version.php diff --git a/front/php/templates/version.php b/front/php/templates/version.php new file mode 100644 index 00000000..379fb53c --- /dev/null +++ b/front/php/templates/version.php @@ -0,0 +1,10 @@ + From 56604f702f6a674493aa6e0ced775d02856b6e03 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:16:20 +0200 Subject: [PATCH 08/13] Create build.php Created build.php file Added new php code to search for build file and if it doesn't find it, it shows the file not found error --- front/php/templates/build.php | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 front/php/templates/build.php diff --git a/front/php/templates/build.php b/front/php/templates/build.php new file mode 100644 index 00000000..26240fab --- /dev/null +++ b/front/php/templates/build.php @@ -0,0 +1,8 @@ + From 9bdac0edbf41e4775fc724ac0483ef7bc26be675 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:44:40 +0200 Subject: [PATCH 09/13] Update version.php Created creators banner --- front/php/templates/version.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/front/php/templates/version.php b/front/php/templates/version.php index 379fb53c..efc8669f 100644 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -1,4 +1,16 @@ - Date: Mon, 7 Aug 2023 18:14:21 +0200 Subject: [PATCH 10/13] Update build.php Added the creators banner Updated blank spaces --- front/php/templates/build.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/front/php/templates/build.php b/front/php/templates/build.php index 26240fab..137f8751 100644 --- a/front/php/templates/build.php +++ b/front/php/templates/build.php @@ -1,8 +1,21 @@ From 0b3b1e4ed4e44b81c431d08511b6f160b8a0bc4d Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:15:08 +0200 Subject: [PATCH 11/13] Update build.php Updated the creators banner --- front/php/templates/build.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/build.php b/front/php/templates/build.php index 137f8751..cc72aa7e 100644 --- a/front/php/templates/build.php +++ b/front/php/templates/build.php @@ -3,7 +3,7 @@ # Pi.Alert # # Open Source Network Guard / WIFI & LAN intrusion detector # # # -# version.php - Templates module Template to display the current version # +# build.php - Templates module Template to display the current build version # #---------------------------------------------------------------------------------# # Puche 2021 pi.alert.application@gmail.com GNU GPLv3 # # jokob-sk 2022 jokob.sk@gmail.com GNU GPLv3 # From 3ca4e191990a724fef48412f460b721fa24ccf86 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 18:18:57 +0200 Subject: [PATCH 12/13] Update version.php Updated blank spaces --- front/php/templates/version.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/front/php/templates/version.php b/front/php/templates/version.php index efc8669f..19f630ab 100644 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -1,4 +1,4 @@ - From a38d25487750da38405c1b64fda77e8111b3f6d6 Mon Sep 17 00:00:00 2001 From: Carlos V <76731844+cvc90@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:30:41 +0200 Subject: [PATCH 13/13] Update version.php Update path file --- front/php/templates/version.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/front/php/templates/version.php b/front/php/templates/version.php index 19f630ab..459faeca 100644 --- a/front/php/templates/version.php +++ b/front/php/templates/version.php @@ -11,7 +11,7 @@ # cvc90 2023 https://github.com/cvc90 GNU GPLv3 # #---------------------------------------------------------------------------------# - $filename = "/.VERSION"; + $filename = "/home/pi/pialert/.VERSION"; if(file_exists($filename)) { echo file_get_contents($filename); }