report cleanup + #960

This commit is contained in:
jokob-sk
2025-01-19 12:56:00 +11:00
parent af1e9b921b
commit 6b390b66de
12 changed files with 105 additions and 390 deletions

View File

@@ -38,7 +38,6 @@ services:
- ${DEV_LOCATION}/back/update_vendors.sh:/app/back/update_vendors.sh - ${DEV_LOCATION}/back/update_vendors.sh:/app/back/update_vendors.sh
- ${DEV_LOCATION}/front/lib:/app/front/lib - ${DEV_LOCATION}/front/lib:/app/front/lib
- ${DEV_LOCATION}/front/js:/app/front/js - ${DEV_LOCATION}/front/js:/app/front/js
- ${DEV_LOCATION}/front/report_templates:/front/report_templates
- ${DEV_LOCATION}/front/php:/app/front/php - ${DEV_LOCATION}/front/php:/app/front/php
- ${DEV_LOCATION}/front/deviceDetails.php:/app/front/deviceDetails.php - ${DEV_LOCATION}/front/deviceDetails.php:/app/front/deviceDetails.php
- ${DEV_LOCATION}/front/deviceDetailsEdit.php:/app/front/deviceDetailsEdit.php - ${DEV_LOCATION}/front/deviceDetailsEdit.php:/app/front/deviceDetailsEdit.php

View File

@@ -32,7 +32,7 @@ function renderList(
// remove first item containing the SQL query // remove first item containing the SQL query
options.shift(); options.shift();
const apiUrl = `php/server/dbHelper.php?action=read&rawSql=${encodeURIComponent(sqlQuery)}`; const apiUrl = `php/server/dbHelper.php?action=read&rawSql=${btoa(encodeURIComponent(sqlQuery))}`;
$.get(apiUrl, function (sqlOptionsData) { $.get(apiUrl, function (sqlOptionsData) {

View File

@@ -63,7 +63,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/php/templates/security.php';
} }
if (isset ($_REQUEST['rawSql'])) { if (isset ($_REQUEST['rawSql'])) {
$rawSql = $_REQUEST['rawSql']; $rawSql = urldecode(base64_decode($_REQUEST['rawSql']));
} }
if (isset ($_REQUEST['dbtable'])) { if (isset ($_REQUEST['dbtable'])) {

0
front/php/templates/language/ca_ca.json Normal file → Executable file
View File

View File

@@ -1,178 +0,0 @@
<!-- ---------------------------------------------------------------------------
# NetAlertX
# Open Source Network Guard / WIFI & LAN intrusion detector
#
# repot_template.html - Back module. Template to email reporting in HTML format
#-------------------------------------------------------------------------------
# Puche 2021 GNU GPLv3
#--------------------------------------------------------------------------- -->
<html>
<head></head>
<body>
<font face=sans-serif>
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
<tr>
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 30px; font-weight: bold; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<img src="https://netalertx.com/favicon.ico" alt="NetAlertX Logo" style="vertical-align: middle;" width="32" height="32" />
Net<b>Alert</b><sup>x</sup>
</td>
</tr>
<tr>
<td bgcolor=#2656f1 width=100% align=center style="padding: 20px 10px 10px 10px; font-size: 20px; font-weight: bold; color:#ffffff; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<a style="color:#ffffff;cursor:pointer;" href="https://github.com/jokob-sk/NetAlertX/releases">🆕 New version available 🆕</a>
</td>
</tr>
<tr>
<td>
<table width=100% border=0 bgcolor=#00c0ef cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#404040">
<tr>
<td width=100%> Report Date: <b>2023-01-30 22:17</b> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor=#F5F5F5 height=200 valign=top style="padding: 10px">
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:blue; font-size: 12px;' bgcolor='#909090' >New devices</th>
</tr>
<tr>
<td>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >MAC</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Datetime</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >IP</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Event Type</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device name</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Comments</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device Vendor</th>
</tr>
<tr>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
<td>2023-01-30 22:15:09</td>
<td>192.168.1.1</td>
<td>New Device</td>
<td>(name not found)</td>
<td></td>
<td></td>
</tr>
<tr>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
<td>2023-01-30 22:17:59</td>
<td>192.168.1.82</td>
<td>New Device</td>
<td>(name not found)</td>
<td></td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:blue; font-size: 12px;' bgcolor='#909090' >Events</th>
</tr>
<tr>
<td>
<ul>
<li>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >MAC</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Datetime</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >IP</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Event Type</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device name</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Comments</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Device Vendor</th>
</tr>
<tr>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
<td>2023-01-30 22:15:09</td>
<td>192.168.1.92</td>
<td>Disconnected</td>
<td>(name not found)</td>
<td></td>
</tr>
</table>
</li>
</ul>
</td>
</tr>
</table>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:blue; font-size: 12px;' bgcolor='#909090' >Changed or new ports</th>
</tr>
<tr>
<td>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th>new</th>
</tr>
<tr>
<td>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Name</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >MAC</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Port</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >State</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Service</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Extra</th>
</tr>
<tr>
<td>New device</td>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
<td>3263/tcp</td>
<td>open</td>
<td>ecolor-imager</td>
<td></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table style="border-collapse: collapse; font-size: 12px; color:#70707" width="100%" cellspacing="0" cellpadding="3px" bordercolor="#C0C0C0" border="1">
<tr>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Name</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >MAC</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Port</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >State</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Service</th>
<th width='120px' style='color:#F0F0F0' bgcolor='#909090' >Extra</th>
</tr>
<tr>
<td>New device</td>
<td><a href="http://192.168.1.1:20211/deviceDetails.php?mac=00:00:00:ef:a5:6c">00:00:00:ef:a5:6c</a></td>
<td>3264/tcp</td>
<td>open</td>
<td>ccmail</td>
<td></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td>
<table width=100% bgcolor=#46802e cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
<tr>
<td width=50% style="text-align:center"> NetAlertX - Synology-NAS</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</body>
</html>

View File

@@ -1,50 +1,46 @@
Report Date: 2021-12-08 12:30
Server: Synology-NAS
New Devices New Devices
---------------------- ----------------------
Name: (name not found) Name: (name not found)
MAC: 2c:2c:2c:2c:2c:2c MAC: 2c:2c:2c:2c:2c:2c
IP: 192.168.1.121 IP: 192.168.1.121
Time: 2021-12-08 12:30 Time: 2021-12-08 12:30
More Info: Micro-Star INTL CO., LTD. More Info: Micro-Star INTL CO., LTD.
Name: (name not found) Name: (name not found)
MAC: 2c:2c:2c:2c:2c:2c MAC: 2c:2c:2c:2c:2c:2c
IP: 192.168.1.151 IP: 192.168.1.151
Time: 2021-12-08 12:30 Time: 2021-12-08 12:30
More Info: Espressif Inc. More Info: Espressif Inc.
Events Events
---------------------- ----------------------
Name: Samsung Name: Samsung
MAC: 2c:2c:2c:2c:2c:2c MAC: 2c:2c:2c:2c:2c:2c
IP: 192.168.1.27 IP: 192.168.1.27
Time: 2021-12-08 12:30 Time: 2021-12-08 12:30
Event: Connected Event: Connected
More Info: More Info:
Name: (name not found) Name: (name not found)
MAC: 2c:2c:2c:2c:2c:2c MAC: 2c:2c:2c:2c:2c:2c
IP: 192.168.1.6 IP: 192.168.1.6
Time: 2021-12-08 12:30 Time: 2021-12-08 12:30
Event: Disconnected Event: Disconnected
More Info: More Info:
Name: Google-Home-Mini Name: Google-Home-Mini
MAC: 2c:2c:2c:2c:2c:2c MAC: 2c:2c:2c:2c:2c:2c
IP: 192.168.1.16 IP: 192.168.1.16
Time: 2021-12-08 12:30 Time: 2021-12-08 12:30
Event: Disconnected Event: Disconnected
More Info: More Info:
Name: (name not found) Name: (name not found)
MAC: 2c:2c:2c:2c:2c:2c MAC: 2c:2c:2c:2c:2c:2c
IP: 192.168.1.119 IP: 192.168.1.119
Time: 2021-12-08 12:30 Time: 2021-12-08 12:30
Event: Disconnected Event: Disconnected
More Info: More Info:
Report Date: 2021-12-08 12:30
Server: Synology-NAS

View File

@@ -8,33 +8,18 @@
--> -->
<html> <html>
<head></head>
<head>
</head>
<body> <body>
<font face=sans-serif> <font face=sans-serif>
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;"> <table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
<tr> <tr>
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 20px; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)"> <td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 20px; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<img src="https://netalertx.com/favicon.ico" alt="NetAlertX Logo" style="vertical-align: middle;" width="32" height="32" /> <img src="https://netalertx.com/NetAlertX_logo.png" alt="NetAlertX Logo" style="vertical-align: middle;" width="32" height="32" />
Net<b>Alert</b><sup>x</sup> Net<b>Alert</b><sup>x</sup>
</td> </td>
</tr> </tr>
<tr>
<td>
<table width=100% border=0 bgcolor=#4b99d3 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#ffffff"> <tr>
<td width=100% bgcolor="#3c8dbc"> Report Date: <b><REPORT_DATE></b> </td>
</tr>
</table>
</td>
</tr>
<tr> <tr>
<td height=200 valign=top style="padding: 10px"> <td height=200 valign=top style="padding: 10px">
<NEW_DEVICES_TABLE> <NEW_DEVICES_TABLE>
<DOWN_DEVICES_TABLE> <DOWN_DEVICES_TABLE>
<DOWN_RECONNECTED_TABLE> <DOWN_RECONNECTED_TABLE>
@@ -46,16 +31,14 @@
<tr> <tr>
<td> <td>
<table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;"> <table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 10px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
<tr> <tr>
<td width=50% style="text-align:center;color: white;" bgcolor="#3c8dbc"> <td width=50% style="text-align:center;color: white;" bgcolor="#3c8dbc">
<a href="https://github.com/jokob-sk/NetAlertX" target="_blank" style="color: white">NetAlertX</a> <NEW_VERSION>
<a href=".." target="_blank" style="color: white"> (<SERVER_NAME>)</a> | Sent: <REPORT_DATE>
<br><span style="display:inline-block;color: white; transform: rotate(180deg)">&copy;</span>2022 | Server: <SERVER_NAME>
<a style="color: white" href="mailto:jokob@duck.com?subject=NetAlertX">jokob-sk</a> | <b>Built on: <BUILD_DATE> </b> | <b> Version: <BUILD_VERSION> </b> | | Built: <BUILD_DATE>
<a href="https://github.com/jokob-sk/NetAlertX/tree/main/docs" target="_blank" style="color: white"> | Version: <BUILD_VERSION>
<span>Docs <i class="fa fa-circle-question"></i>
</a><span>
</td> </td>
</tr> </tr>
</table> </table>

View File

@@ -1,8 +1,9 @@
Report Date: <REPORT_DATE>
Server: <SERVER_NAME>
<NEW_DEVICES_TABLE> <NEW_DEVICES_TABLE>
<DOWN_DEVICES_TABLE> <DOWN_DEVICES_TABLE>
<DOWN_RECONNECTED_TABLE> <DOWN_RECONNECTED_TABLE>
<EVENTS_TABLE> <EVENTS_TABLE>
<PLUGINS_TABLE> <PLUGINS_TABLE>
Report Date: <REPORT_DATE>
Server: <SERVER_NAME>
<NEW_VERSION>

View File

@@ -1,72 +0,0 @@
<!--
#---------------------------------------------------------------------------------#
# NetAlertX #
# Open Source Network Guard / WIFI & LAN intrusion detector #
# #
# report_template.html - Back module. Template to email reporting in HTML format #
#---------------------------------------------------------------------------------#
-->
<html>
<head>
</head>
<body>
<font face=sans-serif>
<table align=center width=100% cellpadding=0 cellspacing=0 style="border-radius: 5px;">
<tr>
<td bgcolor=#3c8dbc align=center style="padding: 20px 10px 10px 10px; font-size: 20px; color:#ffffff; border-top-right-radius: 5px; border-top-left-radius: 5px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<img src="https://netalertx.com/favicon.ico" alt="NetAlertX Logo" style="vertical-align: middle;" width="32" height="32" />
Net<b>Alert</b><sup>x</sup>
</td>
</tr>
<tr>
<td bgcolor=#2656f1 width=100% align=center style="padding: 10px 10px 10px 10px; font-size: 20px; color:#ffffff; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2)">
<a style="color:#ffffff;cursor:pointer;" href="https://github.com/jokob-sk/NetAlertX/releases">New version available</a>
</td>
</tr>
<tr>
<td>
<table width=100% border=0 bgcolor=#4b99d3 cellpadding=5px cellspacing=0 style="border-collapse: collapse; font-size: 15px; text-align:center; color:#ffffff"> <tr>
<td width=100% bgcolor="#3c8dbc"> Report Date: <b><REPORT_DATE></b> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td height=200 valign=top style="padding: 10px">
<NEW_DEVICES_TABLE>
<DOWN_DEVICES_TABLE>
<DOWN_RECONNECTED_TABLE>
<EVENTS_TABLE>
<PLUGINS_TABLE>
</td>
</tr>
<tr>
<td>
<table width=100% bgcolor=#3c8dbc cellpadding=5px cellspacing=0 style="font-size: 13px; font-weight: bold; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px;">
<tr>
<td width=50% style="text-align:center;color: white;" bgcolor="#3c8dbc">
<a href="https://github.com/jokob-sk/NetAlertX" target="_blank" style="color: white">NetAlertX</a>
<a href=".." target="_blank" style="color: white"> (<SERVER_NAME>)</a>
<br><span style="display:inline-block;color: white; transform: rotate(180deg)">&copy;</span>2022
<a style="color: white" href="mailto:jokob@duck.com?subject=NetAlertX">jokob-sk</a> | <b>Built on: <BUILD_DATE> </b> | <b> Version: <BUILD_VERSION> </b> |
<a href="https://github.com/jokob-sk/NetAlertX/tree/main/docs" target="_blank" style="color: white">
<span>Docs <i class="fa fa-circle-question"></i>
</a><span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</font>
</body>
</html>

View File

@@ -18,37 +18,36 @@
"title_link": "", "title_link": "",
"text": { "text": {
"new_devices_meta": { "new_devices_meta": {
"title": "🆕New devices", "title": "🆕 New devices",
"columnNames": [ "columnNames": [
"MAC", "MAC",
"Datetime", "Datetime",
"IP", "IP",
"Event Type", "Event Type",
"Device name", "Device name",
"Comments" "Comments"
] ]
}, },
"new_devices": [ "new_devices": [
{ {
"MAC": "74:ac:74:ac:74:ac", "MAC": "00:1a:76:e3:26:4a",
"Datetime": "2023-01-30 22:15:09", "Datetime": "2025-01-06 11:05:00+11:00",
"IP": "192.168.1.1", "IP": "192.168.1.82",
"Event Type": "New Device", "Event Type": "New Device",
"Device name": "(name not found)", "Device name": "(unknown) TEST",
"Comments": null, "Comments": ""
"Device Vendor": null
} }
], ],
"down_devices_meta": { "down_devices_meta": {
"title": "Down devices", "title": "🔴 Down devices",
"columnNames": [ "columnNames": [
"MAC", "devName",
"Datetime", "eve_MAC",
"IP", "devVendor",
"Event Type", "eve_IP",
"Device name", "eve_DateTime",
"Comments" "eve_EventType"
] ]
}, },
"down_devices": [], "down_devices": [],
"events_meta": { "events_meta": {
@@ -64,12 +63,12 @@
}, },
"down_reconnected": [ "down_reconnected": [
{ {
"devName": "Phone - Pixel", "devName": "Phone - Moto 82",
"eve_MAC": "74:ac:74:ac:74:ac", "eve_MAC": "74:ac:74:ac:74:ac",
"devVendor": "Google", "devVendor": "Motorola Mobility LLC, a Lenovo Company",
"eve_IP": "192.168.1.167", "eve_IP": "192.168.1.167",
"DownTime": "2024-05-26 09:06:56+10:00", "eve_DateTime": "2025-01-11 10:05:01+11:00",
"ConnectedTime": "2024-05-26 09:13:24+10:00" "eve_EventType": "Down Reconnected"
} }
], ],
"down_reconnected_meta": { "down_reconnected_meta": {
@@ -79,8 +78,8 @@
"eve_MAC", "eve_MAC",
"devVendor", "devVendor",
"eve_IP", "eve_IP",
"DownTime", "eve_DateTime",
"ConnectedTime" "eve_EventType"
] ]
}, },
"events": [ "events": [
@@ -90,8 +89,7 @@
"IP": "192.168.1.92", "IP": "192.168.1.92",
"Event Type": "Disconnected", "Event Type": "Disconnected",
"Device name": "(name not found)", "Device name": "(name not found)",
"Comments": null, "Comments": null
"Device Vendor": null
}, },
{ {
"MAC": "74:ac:74:ac:74:ac", "MAC": "74:ac:74:ac:74:ac",
@@ -99,45 +97,34 @@
"IP": "192.168.1.150", "IP": "192.168.1.150",
"Event Type": "Disconnected", "Event Type": "Disconnected",
"Device name": "(name not found)", "Device name": "(name not found)",
"Comments": null, "Comments": null
"Device Vendor": null
} }
], ],
"plugins_meta": { "plugins_meta": {
"title": "Plugins", "title": "🔌 Plugins",
"columnNames": [ "columnNames": [
"Plugin", "Plugin",
"Object_PrimaryID", "Object_PrimaryID",
"Object_SecondaryID", "Object_SecondaryID",
"DateTimeChanged", "DateTimeChanged",
"Watched_Value1", "Watched_Value1",
"Watched_Value2", "Watched_Value2",
"Watched_Value3", "Watched_Value3",
"Watched_Value4", "Watched_Value4",
"Status", "Status"
"Extra",
"UserData",
"ForeignKey",
"SyncHubNodeName"
] ]
}, },
"plugins": [ "plugins": [
{ {
"Index": 138, "Plugin": "ARPSCAN",
"Plugin": "INTRSPD", "Object_PrimaryID": "74:ac:74:ac:74:ac",
"Object_PrimaryID": "Speedtest", "Object_SecondaryID": "192.168.1.114",
"Object_SecondaryID": "2023-10-08 02:01:16+02:00", "DateTimeChanged": "2025-01-11 12:21:00",
"DateTimeCreated": "2023-10-08 02:01:16", "Watched_Value1": "192.168.1.114",
"DateTimeChanged": "2023-10-08 02:32:15", "Watched_Value2": "Microsoft Corporation",
"Watched_Value1": "-1", "Watched_Value3": "192.168.1.0/24 --interface=eth1",
"Watched_Value2": "-1", "Watched_Value4": "",
"Watched_Value3": "null", "Status": "new"
"Watched_Value4": "null",
"Status": "missing-in-last-scan",
"Extra": "null",
"UserData": "null",
"ForeignKey": "null",
"SyncHubNodeName": "null"
} }
] ]
} }

View File

@@ -78,7 +78,8 @@ class Notification_obj:
# mylog('debug', ['[Notification] notiStruc:', json.dumps(notiStruc.__dict__, indent=4)]) # mylog('debug', ['[Notification] notiStruc:', json.dumps(notiStruc.__dict__, indent=4)])
Text = "" Text = ""
HTML = "" HTML = ""
template_file_path = reportTemplatesPath + 'report_template.html'
# Open text Template # Open text Template
@@ -90,17 +91,17 @@ class Notification_obj:
# Open html Template # Open html Template
mylog('verbose', ['[Notification] Open html Template']) mylog('verbose', ['[Notification] Open html Template'])
# select template type depoending if running latest version or an older one
if conf.newVersionAvailable :
template_file_path = reportTemplatesPath + 'report_template_new_version.html'
else:
template_file_path = reportTemplatesPath + 'report_template.html'
mylog('verbose', ['[Notification] Using template', template_file_path])
template_file = open(template_file_path, 'r') template_file = open(template_file_path, 'r')
mail_html = template_file.read() mail_html = template_file.read()
template_file.close() template_file.close()
# prepare new version text
newVersionText = ''
if conf.newVersionAvailable :
newVersionText = '🚀A new version is available.'
mail_text = mail_text.replace ('<NEW_VERSION>', newVersionText)
mail_html = mail_html.replace ('<NEW_VERSION>', newVersionText)
# Report "REPORT_DATE" in Header & footer # Report "REPORT_DATE" in Header & footer
timeFormated = timeNowTZ().strftime ('%Y-%m-%d %H:%M') timeFormated = timeNowTZ().strftime ('%Y-%m-%d %H:%M')

View File

@@ -913,8 +913,6 @@ def handle_test(runType, db, all_plugins, pluginsState):
mylog('minimal', ['[', timeNowTZ(), '] [Test] START Test: ', runType]) mylog('minimal', ['[', timeNowTZ(), '] [Test] START Test: ', runType])
# Prepare test samples # Prepare test samples
sample_txt = get_file_content(reportTemplatesPath + 'report_sample.txt')
sample_html = get_file_content(reportTemplatesPath + 'report_sample.html')
sample_json = json.loads(get_file_content(reportTemplatesPath + 'webhook_json_sample.json'))[0]["body"]["attachments"][0]["text"] sample_json = json.loads(get_file_content(reportTemplatesPath + 'webhook_json_sample.json'))[0]["body"]["attachments"][0]["text"]
# Create fake notification # Create fake notification