Moving of report templates
This commit is contained in:
@@ -19,7 +19,7 @@ You can access the following files:
|
||||
|----------------------|----------------------|
|
||||
| `notification_text.txt` | The plain text version of the last notification. |
|
||||
| `notification_text.html` | The full HTML of the last email notification. |
|
||||
| `notification_json_final.json` | The json version of the last notification (e.g. used for webhooks - [sample JSON](https://github.com/jokob-sk/NetAlertX/blob/main/back/webhook_json_sample.json)). |
|
||||
| `notification_json_final.json` | The json version of the last notification (e.g. used for webhooks - [sample JSON](https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json)). |
|
||||
| `table_devices.json` | The current (at the time of the last update as mentioned above on this page) state of all of the available Devices detected by the app. |
|
||||
| `table_pholus_scan.json` | The latest state of the [pholus](https://github.com/jokob-sk/NetAlertX/tree/main/pholus) (A multicast DNS and DNS Service Discovery Security Assessment Tool) scan results. |
|
||||
| `table_plugins_events.json` | The list of the unprocessed (pending) notification events (plugins_events DB table). |
|
||||
|
||||
@@ -5,7 +5,7 @@ N8N can be used for more advanced conditional notification use cases. For exampl
|
||||

|
||||
|
||||
### Specify your email template
|
||||
See [sample JSON](https://github.com/jokob-sk/NetAlertX/blob/main/back/webhook_json_sample.json) if you want to see the JSON paths used in the email template below
|
||||
See [sample JSON](https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json) if you want to see the JSON paths used in the email template below
|
||||

|
||||
|
||||
```
|
||||
|
||||
@@ -691,7 +691,7 @@
|
||||
"UI_PRESENCE_name": "Anzeige im Pr\u00e4senzdiagramm",
|
||||
"UI_REFRESH_description": "",
|
||||
"UI_REFRESH_name": "",
|
||||
"WEBHOOK_PAYLOAD_description": "The Webhook payload data format for the <code>body</code> > <code>attachments</code> > <code>text</code> attribute in the payload json. See an example of the payload <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/back/webhook_json_sample.json\">here</a>. (e.g.: for discord use <code>text</code>)",
|
||||
"WEBHOOK_PAYLOAD_description": "The Webhook payload data format for the <code>body</code> > <code>attachments</code> > <code>text</code> attribute in the payload json. See an example of the payload <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json\">here</a>. (e.g.: for discord use <code>text</code>)",
|
||||
"WEBHOOK_PAYLOAD_name": "Payload type",
|
||||
"WEBHOOK_REQUEST_METHOD_description": "The HTTP request method to be used for the webhook call.",
|
||||
"WEBHOOK_REQUEST_METHOD_name": "Request method",
|
||||
|
||||
@@ -691,7 +691,7 @@
|
||||
"UI_PRESENCE_name": "Mostrar en el gr\u00e1fico de presencia",
|
||||
"UI_REFRESH_description": "Ingrese el n\u00famero de segundos despu\u00e9s de los cuales se recarga la interfaz de usuario. Ajustado a <code> 0 </code> para desactivar.",
|
||||
"UI_REFRESH_name": "Actualizaci\u00f3n autom\u00e1tica de la interfaz de usuario",
|
||||
"WEBHOOK_PAYLOAD_description": "El formato de datos de carga de Webhook para el atributo <code>body</code> > <code>attachments</code> > <code>text</code> en el json de carga. Vea un ejemplo de la carga <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/back/webhook_json_sample.json\">aqu\u00ed</a>. (por ejemplo: para discord use <code>text</code>)",
|
||||
"WEBHOOK_PAYLOAD_description": "El formato de datos de carga de Webhook para el atributo <code>body</code> > <code>attachments</code> > <code>text</code> en el json de carga. Vea un ejemplo de la carga <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json\">aqu\u00ed</a>. (por ejemplo: para discord use <code>text</code>)",
|
||||
"WEBHOOK_PAYLOAD_name": "Tipo de carga",
|
||||
"WEBHOOK_REQUEST_METHOD_description": "El m\u00e9todo de solicitud HTTP que se utilizar\u00e1 para la llamada de webhook.",
|
||||
"WEBHOOK_REQUEST_METHOD_name": "M\u00e9todo de solicitud",
|
||||
|
||||
@@ -333,11 +333,11 @@
|
||||
}],
|
||||
"description": [{
|
||||
"language_code": "en_us",
|
||||
"string" : "The Webhook payload data format for the <code>body</code> > <code>attachments</code> > <code>text</code> attribute in the payload json. See an example of the payload <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/back/webhook_json_sample.json\">here</a>. (e.g.: for discord use <code>text</code>)"
|
||||
"string" : "The Webhook payload data format for the <code>body</code> > <code>attachments</code> > <code>text</code> attribute in the payload json. See an example of the payload <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json\">here</a>. (e.g.: for discord use <code>text</code>)"
|
||||
},
|
||||
{
|
||||
"language_code": "es_es",
|
||||
"string" : "El formato de datos de carga de Webhook para el atributo <code>body</code> > <code>attachments</code> > <code>text</code> en el json de carga. Vea un ejemplo de la carga <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/back/webhook_json_sample.json\">aquí</a>. (por ejemplo: para discord use <code>text</code>)"
|
||||
"string" : "El formato de datos de carga de Webhook para el atributo <code>body</code> > <code>attachments</code> > <code>text</code> en el json de carga. Vea un ejemplo de la carga <a target=\"_blank\" href=\"https://github.com/jokob-sk/NetAlertX/blob/main/front/report_templates/webhook_json_sample.json\">aquí</a>. (por ejemplo: para discord use <code>text</code>)"
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -11,12 +11,13 @@ confPath = "/config/" + confFileName
|
||||
dbPath = '/db/' + dbFileName
|
||||
|
||||
|
||||
pluginsPath = applicationPath + '/front/plugins'
|
||||
logPath = applicationPath + '/front/log'
|
||||
apiPath = applicationPath + '/front/api/'
|
||||
fullConfPath = applicationPath + confPath
|
||||
fullDbPath = applicationPath + dbPath
|
||||
vendorsPath = '/usr/share/arp-scan/ieee-oui.txt'
|
||||
pluginsPath = applicationPath + '/front/plugins'
|
||||
logPath = applicationPath + '/front/log'
|
||||
apiPath = applicationPath + '/front/api/'
|
||||
reportTemplatesPath = applicationPath + '/front/report_templates/'
|
||||
fullConfPath = applicationPath + confPath
|
||||
fullDbPath = applicationPath + dbPath
|
||||
vendorsPath = '/usr/share/arp-scan/ieee-oui.txt'
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ from json2table import convert
|
||||
|
||||
# Register NetAlertX modules
|
||||
import conf
|
||||
from const import applicationPath, logPath, apiPath, confFileName
|
||||
from const import applicationPath, logPath, apiPath, confFileName, reportTemplatesPath
|
||||
from logger import logResult, mylog, print_log
|
||||
from helper import generate_mac_links, removeDuplicateNewLines, timeNowTZ, get_file_content, write_file, get_setting_value, get_timezone_offset
|
||||
|
||||
@@ -80,7 +80,7 @@ class Notification_obj:
|
||||
|
||||
# Open text Template
|
||||
mylog('verbose', ['[Notification] Open text Template'])
|
||||
template_file = open(applicationPath + '/back/report_template.txt', 'r')
|
||||
template_file = open(reportTemplatesPath + 'report_template.txt', 'r')
|
||||
mail_text = template_file.read()
|
||||
template_file.close()
|
||||
|
||||
@@ -89,12 +89,12 @@ class Notification_obj:
|
||||
|
||||
# select template type depoending if running latest version or an older one
|
||||
if conf.newVersionAvailable :
|
||||
template_file_path = '/back/report_template_new_version.html'
|
||||
template_file_path = reportTemplatesPath + 'report_template_new_version.html'
|
||||
else:
|
||||
template_file_path = '/back/report_template.html'
|
||||
template_file_path = reportTemplatesPath + 'report_template.html'
|
||||
|
||||
mylog('verbose', ['[Notification] Using template', template_file_path])
|
||||
template_file = open(applicationPath + template_file_path, 'r')
|
||||
template_file = open(template_file_path, 'r')
|
||||
mail_html = template_file.read()
|
||||
template_file.close()
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from collections import namedtuple
|
||||
|
||||
# Register NetAlertX modules
|
||||
import conf
|
||||
from const import pluginsPath, logPath, applicationPath
|
||||
from const import pluginsPath, logPath, applicationPath, reportTemplatesPath
|
||||
from logger import mylog
|
||||
from helper import timeNowTZ, updateState, get_file_content, write_file, get_setting, get_setting_value
|
||||
from api import update_api
|
||||
@@ -783,9 +783,9 @@ def handle_test(runType, db, pluginsState):
|
||||
mylog('minimal', ['[', timeNowTZ(), '] [Test] START Test: ', runType])
|
||||
|
||||
# Prepare test samples
|
||||
sample_txt = get_file_content(applicationPath + '/back/report_sample.txt')
|
||||
sample_html = get_file_content(applicationPath + '/back/report_sample.html')
|
||||
sample_json = json.loads(get_file_content(applicationPath + '/back/webhook_json_sample.json'))[0]["body"]["attachments"][0]["text"]
|
||||
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"]
|
||||
|
||||
# Create fake notification
|
||||
notification = Notification_obj(db)
|
||||
|
||||
Reference in New Issue
Block a user