diff --git a/docs/API.md b/docs/API.md index 8f734d5f..69dbf5a8 100755 --- a/docs/API.md +++ b/docs/API.md @@ -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). | diff --git a/docs/WEBHOOK_N8N.md b/docs/WEBHOOK_N8N.md index 7c633e5a..fc941682 100755 --- a/docs/WEBHOOK_N8N.md +++ b/docs/WEBHOOK_N8N.md @@ -5,7 +5,7 @@ N8N can be used for more advanced conditional notification use cases. For exampl ![n8n workflow](/docs/img/WEBHOOK_N8N/n8n_workflow.png) ### 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 ![Email template](/docs/img/WEBHOOK_N8N/n8n_send_email_settings.png) ``` diff --git a/front/php/templates/language/de_de.json b/front/php/templates/language/de_de.json index 0a5880d3..7b27c1b0 100755 --- a/front/php/templates/language/de_de.json +++ b/front/php/templates/language/de_de.json @@ -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 body > attachments > text attribute in the payload json. See an example of the payload here. (e.g.: for discord use text)", + "WEBHOOK_PAYLOAD_description": "The Webhook payload data format for the body > attachments > text attribute in the payload json. See an example of the payload here. (e.g.: for discord use text)", "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", diff --git a/front/php/templates/language/es_es.json b/front/php/templates/language/es_es.json index 74984e16..fa0241a7 100755 --- a/front/php/templates/language/es_es.json +++ b/front/php/templates/language/es_es.json @@ -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 0 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 body > attachments > text en el json de carga. Vea un ejemplo de la carga aqu\u00ed. (por ejemplo: para discord use text)", + "WEBHOOK_PAYLOAD_description": "El formato de datos de carga de Webhook para el atributo body > attachments > text en el json de carga. Vea un ejemplo de la carga aqu\u00ed. (por ejemplo: para discord use text)", "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", diff --git a/front/plugins/_publisher_webhook/config.json b/front/plugins/_publisher_webhook/config.json index 17a319fc..b04f79b9 100755 --- a/front/plugins/_publisher_webhook/config.json +++ b/front/plugins/_publisher_webhook/config.json @@ -333,11 +333,11 @@ }], "description": [{ "language_code": "en_us", - "string" : "The Webhook payload data format for the body > attachments > text attribute in the payload json. See an example of the payload here. (e.g.: for discord use text)" + "string" : "The Webhook payload data format for the body > attachments > text attribute in the payload json. See an example of the payload here. (e.g.: for discord use text)" }, { "language_code": "es_es", - "string" : "El formato de datos de carga de Webhook para el atributo body > attachments > text en el json de carga. Vea un ejemplo de la carga aquí. (por ejemplo: para discord use text)" + "string" : "El formato de datos de carga de Webhook para el atributo body > attachments > text en el json de carga. Vea un ejemplo de la carga aquí. (por ejemplo: para discord use text)" }] }, { diff --git a/back/report_sample.html b/front/report_templates/report_sample.html similarity index 100% rename from back/report_sample.html rename to front/report_templates/report_sample.html diff --git a/back/report_sample.txt b/front/report_templates/report_sample.txt similarity index 100% rename from back/report_sample.txt rename to front/report_templates/report_sample.txt diff --git a/back/report_template.html b/front/report_templates/report_template.html similarity index 100% rename from back/report_template.html rename to front/report_templates/report_template.html diff --git a/back/report_template.txt b/front/report_templates/report_template.txt similarity index 100% rename from back/report_template.txt rename to front/report_templates/report_template.txt diff --git a/back/report_template_new_version.html b/front/report_templates/report_template_new_version.html similarity index 100% rename from back/report_template_new_version.html rename to front/report_templates/report_template_new_version.html diff --git a/back/webhook_json_sample.json b/front/report_templates/webhook_json_sample.json similarity index 100% rename from back/webhook_json_sample.json rename to front/report_templates/webhook_json_sample.json diff --git a/server/const.py b/server/const.py index b4a30413..68f955ec 100755 --- a/server/const.py +++ b/server/const.py @@ -11,14 +11,15 @@ 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' + #=============================================================================== diff --git a/server/notification.py b/server/notification.py index a7d4ee1f..e7362fbc 100755 --- a/server/notification.py +++ b/server/notification.py @@ -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() diff --git a/server/plugin.py b/server/plugin.py index 5d94ae7b..2bb1eb06 100755 --- a/server/plugin.py +++ b/server/plugin.py @@ -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)