mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
vendor_update plugin
This commit is contained in:
@@ -458,7 +458,7 @@
|
|||||||
"Plugins_Out_of" : "out of",
|
"Plugins_Out_of" : "out of",
|
||||||
"Plugins_no_control" : "No form control was found to render this value.",
|
"Plugins_no_control" : "No form control was found to render this value.",
|
||||||
"Settings_Metadata_Toggle" : "Show/hide metadata for the given setting.",
|
"Settings_Metadata_Toggle" : "Show/hide metadata for the given setting.",
|
||||||
"settings_missing" : "Not all settings loaded, refresh the page! This is probably caused by a high load on the database.",
|
"settings_missing" : "Not all settings loaded, refresh the page! This is probably caused by a high load on the database or app startup sequence.",
|
||||||
"settings_missing_block" : "You can not save your settings without specifying all setting keys. Refresh the page. This is probably caused by a high load on the database.",
|
"settings_missing_block" : "You can not save your settings without specifying all setting keys. Refresh the page. This is probably caused by a high load on the database.",
|
||||||
"settings_old" : "Importing settings and re-initializing...",
|
"settings_old" : "Importing settings and re-initializing...",
|
||||||
"settings_saved" : "<br/>Settings saved to the <code>pialert.conf</code> file.<br/><br/>A time-stamped backup of the previous file created. <br/><br/> Reloading...<br/>",
|
"settings_saved" : "<br/>Settings saved to the <code>pialert.conf</code> file.<br/><br/>A time-stamped backup of the previous file created. <br/><br/> Reloading...<br/>",
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
"enabled": true,
|
"enabled": true,
|
||||||
"data_source": "script",
|
"data_source": "script",
|
||||||
"show_ui": true,
|
"show_ui": true,
|
||||||
"localized": ["display_name", "description", "icon"],
|
"localized": [
|
||||||
|
"display_name",
|
||||||
|
"description",
|
||||||
|
"icon"
|
||||||
|
],
|
||||||
"display_name": [
|
"display_name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -24,39 +27,52 @@
|
|||||||
"string": "A plugin to schedule vendor database updates for mac based vendor resolution."
|
"string": "A plugin to schedule vendor database updates for mac based vendor resolution."
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"params" : [
|
"params": [],
|
||||||
],
|
|
||||||
|
|
||||||
"settings": [
|
"settings": [
|
||||||
{
|
{
|
||||||
"function": "RUN",
|
"function": "RUN",
|
||||||
"type": "text.select",
|
"type": "text.select",
|
||||||
"default_value":"schedule",
|
"default_value": "schedule",
|
||||||
"options": ["disabled", "once", "schedule", "always_after_scan"],
|
"options": [
|
||||||
"localized": ["name", "description"],
|
"disabled",
|
||||||
"name" :[{
|
"once",
|
||||||
"language_code":"en_us",
|
"schedule",
|
||||||
"string" : "When to run"
|
"always_after_scan"
|
||||||
},
|
],
|
||||||
{
|
"localized": [
|
||||||
"language_code":"es_es",
|
"name",
|
||||||
"string" : "Cuándo ejecutar"
|
"description"
|
||||||
},
|
],
|
||||||
{
|
"name": [
|
||||||
"language_code":"de_de",
|
{
|
||||||
"string" : "Wann laufen"
|
"language_code": "en_us",
|
||||||
}],
|
"string": "When to run"
|
||||||
"description": [{
|
},
|
||||||
"language_code":"en_us",
|
{
|
||||||
"string" : "When the cleanup should be performed. An overnight weekly <code>SCHEDULE</code> is recommended."
|
"language_code": "es_es",
|
||||||
}]
|
"string": "Cuándo ejecutar"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"language_code": "de_de",
|
||||||
|
"string": "Wann laufen"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "When the cleanup should be performed. An overnight weekly <code>SCHEDULE</code> is recommended."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"function": "CMD",
|
"function": "CMD",
|
||||||
"type": "readonly",
|
"type": "readonly",
|
||||||
"default_value": "python3 /home/pi/pialert/front/plugins/vendor_update/script.py",
|
"default_value": "python3 /home/pi/pialert/front/plugins/vendor_update/script.py",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -89,40 +105,50 @@
|
|||||||
{
|
{
|
||||||
"function": "RUN_SCHD",
|
"function": "RUN_SCHD",
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"default_value":"0 4 * * *",
|
"default_value": "0 4 * * *",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
"name" : [{
|
"name",
|
||||||
"language_code":"en_us",
|
"description"
|
||||||
"string" : "Schedule"
|
],
|
||||||
},
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code":"es_es",
|
"language_code": "en_us",
|
||||||
"string" : "Schedule"
|
"string": "Schedule"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"language_code":"de_de",
|
"language_code": "es_es",
|
||||||
"string" : "Schedule"
|
"string": "Schedule"
|
||||||
}],
|
},
|
||||||
"description": [{
|
{
|
||||||
"language_code":"en_us",
|
"language_code": "de_de",
|
||||||
"string" : "Only enabled if you select <code>schedule</code> in the <a href=\"#VNDRPDT_RUN\"><code>VNDRPDT_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
"string": "Schedule"
|
||||||
},
|
}
|
||||||
{
|
],
|
||||||
"language_code":"es_es",
|
"description": [
|
||||||
"string" : "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#VNDRPDT_RUN\"><code>VNDRPDT_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutará el escaneo después de las 4 a.m. en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ código> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
|
{
|
||||||
},
|
"language_code": "en_us",
|
||||||
{
|
"string": "Only enabled if you select <code>schedule</code> in the <a href=\"#VNDRPDT_RUN\"><code>VNDRPDT_RUN</code> setting</a>. Make sure you enter the schedule in the correct cron-like format (e.g. validate at <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). For example entering <code>0 4 * * *</code> will run the scan after 4 am in the <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</code> you set above</a>. Will be run NEXT time the time passes."
|
||||||
"language_code":"de_de",
|
},
|
||||||
"string" : "Nur aktiviert, wenn Sie <code>schedule</code> in der <a href=\"#VNDRPDT_RUN\"><code>VNDRPDT_RUN</code>-Einstellung</a> auswählen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-ähnlichen Format eingeben (z. B. validieren unter <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Wenn Sie beispielsweise <code>0 4 * * *</code> eingeben, wird der Scan nach 4 Uhr morgens in der <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ ausgeführt. Code> den Sie oben festgelegt haben</a>. Wird das NÄCHSTE Mal ausgeführt, wenn die Zeit vergeht."
|
{
|
||||||
}]
|
"language_code": "es_es",
|
||||||
},
|
"string": "Solo está habilitado si selecciona <code>schedule</code> en la configuración <a href=\"#VNDRPDT_RUN\"><code>VNDRPDT_RUN</code></a>. Asegúrese de ingresar la programación en el formato similar a cron correcto (por ejemplo, valide en <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Por ejemplo, ingresar <code>0 4 * * *</code> ejecutará el escaneo después de las 4 a.m. en el <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ código> que configuró arriba</a>. Se ejecutará la PRÓXIMA vez que pase el tiempo."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "de_de",
|
||||||
|
"string": "Nur aktiviert, wenn Sie <code>schedule</code> in der <a href=\"#VNDRPDT_RUN\"><code>VNDRPDT_RUN</code>-Einstellung</a> auswählen. Stellen Sie sicher, dass Sie den Zeitplan im richtigen Cron-ähnlichen Format eingeben (z. B. validieren unter <a href=\"https://crontab.guru/\" target=\"_blank\">crontab.guru</a>). Wenn Sie beispielsweise <code>0 4 * * *</code> eingeben, wird der Scan nach 4 Uhr morgens in der <a onclick=\"toggleAllSettings()\" href=\"#TIMEZONE\"><code>TIMEZONE</ ausgeführt. Code> den Sie oben festgelegt haben</a>. Wird das NÄCHSTE Mal ausgeführt, wenn die Zeit vergeht."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"function": "RUN_TIMEOUT",
|
"function": "RUN_TIMEOUT",
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"default_value": 300,
|
"default_value": 600,
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name", "description"],
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
"name": [
|
"name": [
|
||||||
{
|
{
|
||||||
"language_code": "en_us",
|
"language_code": "en_us",
|
||||||
@@ -151,115 +177,212 @@
|
|||||||
"string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen."
|
"string": "Maximale Zeit in Sekunden, die auf den Abschluss des Skripts gewartet werden soll. Bei Überschreitung dieser Zeit wird das Skript abgebrochen."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "WATCH",
|
||||||
|
"type": "text.multiselect",
|
||||||
|
"default_value": [
|
||||||
|
"Watched_Value1"
|
||||||
|
],
|
||||||
|
"options": [
|
||||||
|
"Watched_Value1",
|
||||||
|
"Watched_Value2",
|
||||||
|
"Watched_Value3",
|
||||||
|
"Watched_Value4"
|
||||||
|
],
|
||||||
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Watched"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Visto"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Send a notification if selected values change. Use <code>CTRL + Click</code> to select/deselect. <ul> <li><code>Watched_Value1</code> is response status code (e.g.: 200, 404)</li><li><code>Watched_Value2</code> is Latency (not recommended)</li><li><code>Watched_Value3</code> unused </li><li><code>Watched_Value4</code> unused </li></ul>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Envíe una notificación si los valores seleccionados cambian. Use <code>CTRL + Click</code> para seleccionar/deseleccionar. <ul> <li><code>Watched_Value1</code> es un código de estado de respuesta (por ejemplo: 200, 404) </li><li><code>Valor_observado2</code> es Latencia (no recomendado)</li><li><code>Valor_observado3</code> no utilizado </li><li><code>Valor_observado4 </ code> sin usar </li></ul>"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"function": "REPORT_ON",
|
||||||
|
"type": "text.multiselect",
|
||||||
|
"default_value": [
|
||||||
|
"new",
|
||||||
|
"watched-changed"
|
||||||
|
],
|
||||||
|
"options": [
|
||||||
|
"new",
|
||||||
|
"watched-changed",
|
||||||
|
"watched-not-changed",
|
||||||
|
"missing-in-last-scan"
|
||||||
|
],
|
||||||
|
"localized": [
|
||||||
|
"name",
|
||||||
|
"description"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Report on"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Informar sobre"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Send a notification only on these statuses. <code>new</code> means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. <code>watched-changed</code> means that selected <code>Watched_ValueN</code> columns changed."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Envíe una notificación solo en estos estados. <code>new</code> significa que se descubrió un nuevo objeto único (combinación única de PrimaryId y SecondaryId). <code>watched-changed</code> significa que seleccionó <code>Watched_ValueN Las columnas </code> cambiaron."
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"database_column_definitions": [
|
||||||
"database_column_definitions":
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"column": "Index",
|
"column": "Index",
|
||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": false,
|
"show": false,
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value":"",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
"language_code":"en_us",
|
],
|
||||||
"string" : "N/A"
|
"name": [
|
||||||
},
|
{
|
||||||
{
|
"language_code": "en_us",
|
||||||
"language_code":"es_es",
|
"string": "N/A"
|
||||||
"string" : "N/A"
|
},
|
||||||
}]
|
{
|
||||||
} ,
|
"language_code": "es_es",
|
||||||
{
|
"string": "N/A"
|
||||||
"column": "Plugin",
|
}
|
||||||
"css_classes": "col-sm-2",
|
]
|
||||||
"show": false,
|
|
||||||
"type": "label",
|
|
||||||
"default_value":"",
|
|
||||||
"options": [],
|
|
||||||
"localized": ["name"],
|
|
||||||
"name":[{
|
|
||||||
"language_code":"en_us",
|
|
||||||
"string" : "N/A"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"language_code":"es_es",
|
|
||||||
"string" : "N/A"
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Object_PrimaryID",
|
"column": "Plugin",
|
||||||
"mapped_to_column": "cur_MAC",
|
"css_classes": "col-sm-2",
|
||||||
"css_classes": "col-sm-2",
|
"show": false,
|
||||||
"show": true,
|
"type": "label",
|
||||||
"type": "device_mac",
|
"default_value": "",
|
||||||
"default_value":"",
|
"options": [],
|
||||||
"options": [],
|
"localized": [
|
||||||
"localized": ["name"],
|
"name"
|
||||||
"name":[{
|
],
|
||||||
"language_code":"en_us",
|
"name": [
|
||||||
"string" : "MAC address"
|
{
|
||||||
},
|
"language_code": "en_us",
|
||||||
{
|
"string": "N/A"
|
||||||
"language_code":"es_es",
|
},
|
||||||
"string" : "Dirección MAC"
|
{
|
||||||
}]
|
"language_code": "es_es",
|
||||||
|
"string": "N/A"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Object_SecondaryID",
|
"column": "Object_PrimaryID",
|
||||||
"mapped_to_column": "cur_IP",
|
"mapped_to_column": "cur_MAC",
|
||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": true,
|
||||||
"type": "device_ip",
|
"type": "device_mac",
|
||||||
"default_value":"",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
"language_code":"en_us",
|
],
|
||||||
"string" : "IP"
|
"name": [
|
||||||
},
|
{
|
||||||
{
|
"language_code": "en_us",
|
||||||
"language_code":"es_es",
|
"string": "MAC address"
|
||||||
"string" : "IP"
|
},
|
||||||
}]
|
{
|
||||||
} ,
|
"language_code": "es_es",
|
||||||
{
|
"string": "Dirección MAC"
|
||||||
"column": "DateTimeCreated",
|
}
|
||||||
"css_classes": "col-sm-2",
|
]
|
||||||
"show": true,
|
|
||||||
"type": "label",
|
|
||||||
"default_value":"",
|
|
||||||
"options": [],
|
|
||||||
"localized": ["name"],
|
|
||||||
"name":[{
|
|
||||||
"language_code":"en_us",
|
|
||||||
"string" : "Created"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"language_code":"es_es",
|
|
||||||
"string" : "Creado"
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "DateTimeChanged",
|
"column": "Object_SecondaryID",
|
||||||
"mapped_to_column": "cur_DateTime",
|
"mapped_to_column": "cur_IP",
|
||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": true,
|
||||||
"type": "label",
|
"type": "device_ip",
|
||||||
"default_value":"",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
"language_code":"en_us",
|
],
|
||||||
"string" : "Changed"
|
"name": [
|
||||||
},
|
{
|
||||||
{
|
"language_code": "en_us",
|
||||||
"language_code":"es_es",
|
"string": "IP"
|
||||||
"string" : "Cambiado"
|
},
|
||||||
}]
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "IP"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "DateTimeCreated",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": true,
|
||||||
|
"type": "label",
|
||||||
|
"default_value": "",
|
||||||
|
"options": [],
|
||||||
|
"localized": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Created"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Creado"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "DateTimeChanged",
|
||||||
|
"mapped_to_column": "cur_DateTime",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": true,
|
||||||
|
"type": "label",
|
||||||
|
"default_value": "",
|
||||||
|
"options": [],
|
||||||
|
"localized": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Changed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Cambiado"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Dummy",
|
"column": "Dummy",
|
||||||
@@ -270,139 +393,171 @@
|
|||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": true,
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value":"",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
"language_code":"en_us",
|
],
|
||||||
"string" : "Scan method"
|
"name": [
|
||||||
},
|
|
||||||
{
|
|
||||||
"language_code":"es_es",
|
|
||||||
"string" : "Método de escaneo"
|
|
||||||
}]
|
|
||||||
} ,
|
|
||||||
{
|
|
||||||
"column": "Watched_Value1",
|
|
||||||
"mapped_to_column": "cur_Vendor",
|
|
||||||
"css_classes": "col-sm-2",
|
|
||||||
"show": true,
|
|
||||||
"type": "label",
|
|
||||||
"default_value":"",
|
|
||||||
"options": [],
|
|
||||||
"localized": ["name"],
|
|
||||||
"name":[{
|
|
||||||
"language_code":"en_us",
|
|
||||||
"string" : "Vendor"
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"column": "Watched_Value2",
|
|
||||||
"mapped_to_column": "cur_Name",
|
|
||||||
"css_classes": "col-sm-2",
|
|
||||||
"show": true,
|
|
||||||
"type": "label",
|
|
||||||
"default_value":"",
|
|
||||||
"options": [],
|
|
||||||
"localized": ["name"],
|
|
||||||
"name":[{
|
|
||||||
"language_code":"en_us",
|
|
||||||
"string" : "Hostname"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"language_code":"es_es",
|
"language_code": "en_us",
|
||||||
"string" : "Nombre de host"
|
"string": "Scan method"
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Método de escaneo"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Watched_Value3",
|
"column": "Watched_Value1",
|
||||||
"css_classes": "col-sm-2",
|
"mapped_to_column": "cur_Vendor",
|
||||||
"show": false,
|
"css_classes": "col-sm-2",
|
||||||
"type": "label",
|
"show": true,
|
||||||
"default_value":"",
|
"type": "label",
|
||||||
"options": [],
|
"default_value": "",
|
||||||
"localized": ["name"],
|
"options": [],
|
||||||
"name":[{
|
"localized": [
|
||||||
"language_code":"en_us",
|
"name"
|
||||||
"string" : "N/A"
|
],
|
||||||
}]
|
"name": [
|
||||||
} ,
|
{
|
||||||
{
|
"language_code": "en_us",
|
||||||
"column": "Watched_Value4",
|
"string": "Vendor"
|
||||||
"css_classes": "col-sm-2",
|
}
|
||||||
"show": false,
|
]
|
||||||
"type": "label",
|
|
||||||
"default_value":"",
|
|
||||||
"options": [],
|
|
||||||
"localized": ["name"],
|
|
||||||
"name":[{
|
|
||||||
"language_code":"en_us",
|
|
||||||
"string" : "N/A"
|
|
||||||
}]
|
|
||||||
} ,
|
|
||||||
{
|
|
||||||
"column": "UserData",
|
|
||||||
"css_classes": "col-sm-2",
|
|
||||||
"show": false,
|
|
||||||
"type": "textbox_save",
|
|
||||||
"default_value":"",
|
|
||||||
"options": [],
|
|
||||||
"localized": ["name"],
|
|
||||||
"name":[{
|
|
||||||
"language_code":"en_us",
|
|
||||||
"string" : "Comments"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"language_code":"es_es",
|
|
||||||
"string" : "Comentarios"
|
|
||||||
}]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Extra",
|
"column": "Watched_Value2",
|
||||||
"css_classes": "col-sm-3",
|
"mapped_to_column": "cur_Name",
|
||||||
"show": false,
|
"css_classes": "col-sm-2",
|
||||||
"type": "label",
|
"show": true,
|
||||||
"default_value":"",
|
"type": "label",
|
||||||
"options": [],
|
"default_value": "",
|
||||||
"localized": ["name"],
|
"options": [],
|
||||||
"name":[{
|
"localized": [
|
||||||
"language_code":"en_us",
|
"name"
|
||||||
"string" : "N/A"
|
],
|
||||||
}]
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Hostname"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Nombre de host"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"column": "Status",
|
"column": "Watched_Value3",
|
||||||
"css_classes": "col-sm-1",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": false,
|
||||||
"type": "replace",
|
"type": "label",
|
||||||
"default_value":"",
|
"default_value": "",
|
||||||
"options": [
|
"options": [],
|
||||||
{
|
"localized": [
|
||||||
"equals": "watched-not-changed",
|
"name"
|
||||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
|
],
|
||||||
},
|
"name": [
|
||||||
{
|
{
|
||||||
"equals": "watched-changed",
|
"language_code": "en_us",
|
||||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
|
"string": "N/A"
|
||||||
},
|
}
|
||||||
{
|
]
|
||||||
"equals": "new",
|
},
|
||||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
|
{
|
||||||
},
|
"column": "Watched_Value4",
|
||||||
{
|
"css_classes": "col-sm-2",
|
||||||
"equals": "missing-in-last-scan",
|
"show": false,
|
||||||
"replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
|
"type": "label",
|
||||||
}
|
"default_value": "",
|
||||||
],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": [
|
||||||
"name":[{
|
"name"
|
||||||
"language_code":"en_us",
|
],
|
||||||
"string" : "Status"
|
"name": [
|
||||||
},
|
{
|
||||||
{
|
"language_code": "en_us",
|
||||||
"language_code":"es_es",
|
"string": "N/A"
|
||||||
"string" : "Estado"
|
}
|
||||||
}]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "UserData",
|
||||||
|
"css_classes": "col-sm-2",
|
||||||
|
"show": false,
|
||||||
|
"type": "textbox_save",
|
||||||
|
"default_value": "",
|
||||||
|
"options": [],
|
||||||
|
"localized": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Comments"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Comentarios"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Extra",
|
||||||
|
"css_classes": "col-sm-3",
|
||||||
|
"show": false,
|
||||||
|
"type": "label",
|
||||||
|
"default_value": "",
|
||||||
|
"options": [],
|
||||||
|
"localized": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "N/A"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"column": "Status",
|
||||||
|
"css_classes": "col-sm-1",
|
||||||
|
"show": true,
|
||||||
|
"type": "replace",
|
||||||
|
"default_value": "",
|
||||||
|
"options": [
|
||||||
|
{
|
||||||
|
"equals": "watched-not-changed",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-square-check'></i><div></div>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equals": "watched-changed",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-triangle-exclamation'></i></div>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equals": "new",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-circle-plus'></i></div>"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"equals": "missing-in-last-scan",
|
||||||
|
"replacement": "<div style='text-align:center'><i class='fa-solid fa-question'></i></div>"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"localized": [
|
||||||
|
"name"
|
||||||
|
],
|
||||||
|
"name": [
|
||||||
|
{
|
||||||
|
"language_code": "en_us",
|
||||||
|
"string": "Status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"language_code": "es_es",
|
||||||
|
"string": "Estado"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -32,7 +32,7 @@ def main():
|
|||||||
mylog('verbose', ['[VNDRPDT] In script'])
|
mylog('verbose', ['[VNDRPDT] In script'])
|
||||||
|
|
||||||
# Get newest DB
|
# Get newest DB
|
||||||
update_vendor_database()
|
# update_vendor_database() TODOz
|
||||||
|
|
||||||
# Resolve missing vendors
|
# Resolve missing vendors
|
||||||
plugin_objects = Plugin_Objects(RESULT_FILE)
|
plugin_objects = Plugin_Objects(RESULT_FILE)
|
||||||
@@ -63,52 +63,65 @@ def update_vendor_database():
|
|||||||
mylog('none', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info'])
|
mylog('none', [' FAILED: Updating vendors DB, set LOG_LEVEL=debug for more info'])
|
||||||
mylog('none', [e.output])
|
mylog('none', [e.output])
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
# resolve missing vendors
|
# resolve missing vendors
|
||||||
def update_vendors (dbPath, plugin_objects):
|
def update_vendors (dbPath, plugin_objects):
|
||||||
|
|
||||||
# Connect to the PiAlert SQLite database
|
# Connect to the PiAlert SQLite database
|
||||||
conn = sqlite3.connect(dbPath)
|
conn = sqlite3.connect(dbPath)
|
||||||
cursor = conn.cursor()
|
sql = conn.cursor()
|
||||||
|
|
||||||
# Initialize variables
|
# Initialize variables
|
||||||
recordsToUpdate = []
|
recordsToUpdate = []
|
||||||
ignored = 0
|
ignored = 0
|
||||||
notFound = 0
|
notFound = 0
|
||||||
|
|
||||||
# All devices loop
|
|
||||||
mylog('verbose', [' Searching devices vendor'])
|
mylog('verbose', [' Searching devices vendor'])
|
||||||
|
|
||||||
for device in cursor.execute ("""SELECT * FROM Devices
|
# Get devices without a vendor
|
||||||
WHERE dev_Vendor = '(unknown)'
|
sql.execute ("""SELECT
|
||||||
OR dev_Vendor =''
|
dev_MAC,
|
||||||
OR dev_Vendor IS NULL""") :
|
dev_LastIP,
|
||||||
|
dev_Name,
|
||||||
|
dev_Vendor
|
||||||
|
FROM Devices
|
||||||
|
WHERE dev_Vendor = '(unknown)'
|
||||||
|
OR dev_Vendor = ''
|
||||||
|
OR dev_Vendor IS NULL
|
||||||
|
""")
|
||||||
|
devices = sql.fetchall()
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
# Close the database connection
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
# All devices loop
|
||||||
|
for device in devices:
|
||||||
# Search vendor in HW Vendors DB
|
# Search vendor in HW Vendors DB
|
||||||
vendor = query_MAC_vendor (device['dev_MAC'])
|
vendor = query_MAC_vendor (device[0])
|
||||||
if vendor == -1 :
|
if vendor == -1 :
|
||||||
notFound += 1
|
notFound += 1
|
||||||
elif vendor == -2 :
|
elif vendor == -2 :
|
||||||
ignored += 1
|
ignored += 1
|
||||||
else :
|
else :
|
||||||
plugin_objects.add_object(
|
plugin_objects.add_object(
|
||||||
primaryId = device['dev_MAC'], # MAC (Device Name)
|
primaryId = device[0], # MAC (Device Name)
|
||||||
secondaryId = device['dev_LastIP'], # IP Address (always 0.0.0.0)
|
secondaryId = device[1], # IP Address (always 0.0.0.0)
|
||||||
watched1 = vendor,
|
watched1 = vendor,
|
||||||
watched2 = device['dev_Name'],
|
watched2 = device[2],
|
||||||
watched3 = "",
|
watched3 = "",
|
||||||
watched4 = "",
|
watched4 = "",
|
||||||
extra = "",
|
extra = "",
|
||||||
foreignKey = device['dev_MAC']
|
foreignKey = device[0]
|
||||||
)
|
)
|
||||||
|
|
||||||
# Print log
|
# Print log
|
||||||
mylog('verbose', [" Devices Ignored: ", ignored])
|
mylog('verbose', [" Devices Ignored : ", ignored])
|
||||||
mylog('verbose', [" Vendors Not Found:", notFound])
|
mylog('verbose', [" Devices with missing vendor : ", len(devices)])
|
||||||
mylog('verbose', [" Vendors updated: ", len(plugin_objects) ])
|
mylog('verbose', [" Vendors Not Found : ", notFound])
|
||||||
|
mylog('verbose', [" Vendors updated : ", len(plugin_objects) ])
|
||||||
|
|
||||||
conn.commit()
|
|
||||||
# Close the database connection
|
|
||||||
conn.close()
|
|
||||||
|
|
||||||
return plugin_objects
|
return plugin_objects
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,7 @@ logPath = pialertPath + '/front/log'
|
|||||||
apiPath = pialertPath + '/front/api/'
|
apiPath = pialertPath + '/front/api/'
|
||||||
fullConfPath = pialertPath + confPath
|
fullConfPath = pialertPath + confPath
|
||||||
fullDbPath = pialertPath + dbPath
|
fullDbPath = pialertPath + dbPath
|
||||||
|
vendorsPath = '/usr/share/arp-scan/ieee-oui.txt'
|
||||||
|
|
||||||
|
|
||||||
vendorsDB = '/usr/share/arp-scan/ieee-oui.txt'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import re
|
|||||||
from helper import timeNowTZ, get_setting, get_setting_value,resolve_device_name_dig, resolve_device_name_pholus
|
from helper import timeNowTZ, get_setting, get_setting_value,resolve_device_name_dig, resolve_device_name_pholus
|
||||||
from scanners.internet import check_IP_format, get_internet_IP
|
from scanners.internet import check_IP_format, get_internet_IP
|
||||||
from logger import mylog, print_log
|
from logger import mylog, print_log
|
||||||
from const import vendorsDB
|
from const import vendorsPath
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -319,37 +319,27 @@ def check_mac_or_internet(input_str):
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def query_MAC_vendor (pMAC):
|
def query_MAC_vendor (pMAC):
|
||||||
try :
|
|
||||||
# BUGFIX #6 - Fix pMAC parameter as numbers
|
|
||||||
pMACstr = str(pMAC)
|
|
||||||
|
|
||||||
# Check MAC parameter
|
pMACstr = str(pMAC)
|
||||||
mac = pMACstr.replace (':','')
|
|
||||||
if len(pMACstr) != 17 or len(mac) != 12 :
|
|
||||||
return -2
|
|
||||||
|
|
||||||
# Search vendor in HW Vendors DB
|
# Check MAC parameter
|
||||||
mac = mac[0:6]
|
mac = pMACstr.replace (':','')
|
||||||
grep_args = ['grep', '-i', mac, vendorsDB]
|
if len(pMACstr) != 17 or len(mac) != 12 :
|
||||||
|
return -2 # return -2 if ignored MAC
|
||||||
|
|
||||||
# Execute command
|
# Search vendor in HW Vendors DB
|
||||||
if conf.LOG_LEVEL == 'debug':
|
mac_start_string = mac[0:6]
|
||||||
# try runnning a subprocess
|
|
||||||
grep_output = subprocess.check_output (grep_args)
|
|
||||||
else:
|
|
||||||
try:
|
|
||||||
# try runnning a subprocess
|
|
||||||
grep_output = subprocess.check_output (grep_args)
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
# An error occured, handle it
|
|
||||||
mylog('none', ["[Mac Vendor Check] Error: ", e.output])
|
|
||||||
grep_output = " There was an error, check logs for details"
|
|
||||||
|
|
||||||
# Return Vendor
|
try:
|
||||||
vendor = grep_output[7:]
|
with open(vendorsPath, 'r') as f:
|
||||||
vendor = vendor.rstrip()
|
for line in f:
|
||||||
return vendor
|
if line.startswith(mac_start_string):
|
||||||
|
vendor = line.split(' ', 1)[1].strip()
|
||||||
|
mylog('debug', [f"[Vendor Check] Found '{vendor}' for '{pMAC}'"])
|
||||||
|
return vendor
|
||||||
|
|
||||||
# not Found
|
return -1 # MAC address not found in the database
|
||||||
except subprocess.CalledProcessError :
|
except FileNotFoundError:
|
||||||
|
mylog('none', [f"[Vendor Check] Error: Vendors file {vendorsPath} not found."])
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user