mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Merge branch 'main' of https://github.com/jokob-sk/NetAlertX
Some checks are pending
docker / docker_dev (push) Waiting to run
Some checks are pending
docker / docker_dev (push) Waiting to run
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"code_name": "mikrotik_scan",
|
"code_name": "mikrotik_scan",
|
||||||
"unique_prefix": "MTSCAN",
|
"unique_prefix": "MTSCAN",
|
||||||
"plugin_type": "device_scanner",
|
"plugin_type": "device_scanner",
|
||||||
"execution_order" : "Layer_4",
|
"execution_order" : "Layer_1",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"data_source": "script",
|
"data_source": "script",
|
||||||
"mapped_to_table": "CurrentScan",
|
"mapped_to_table": "CurrentScan",
|
||||||
@@ -27,12 +27,6 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"params": [
|
"params": [
|
||||||
{
|
|
||||||
"name": "ips",
|
|
||||||
"type": "sql",
|
|
||||||
"value": "SELECT devLastIP from DEVICES order by devMac",
|
|
||||||
"timeoutMultiplier": true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "mt_host",
|
"name": "mt_host",
|
||||||
"type": "setting",
|
"type": "setting",
|
||||||
|
|||||||
@@ -1,27 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import pathlib
|
|
||||||
import argparse
|
|
||||||
import subprocess
|
|
||||||
import sys
|
import sys
|
||||||
import hashlib
|
|
||||||
import csv
|
|
||||||
import sqlite3
|
|
||||||
import re
|
|
||||||
from io import StringIO
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
# Register NetAlertX directories
|
# Register NetAlertX directories
|
||||||
INSTALL_PATH="/app"
|
INSTALL_PATH="/app"
|
||||||
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
sys.path.extend([f"{INSTALL_PATH}/front/plugins", f"{INSTALL_PATH}/server"])
|
||||||
|
|
||||||
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
|
from plugin_helper import Plugin_Objects
|
||||||
from logger import mylog, Logger, append_line_to_file
|
from logger import mylog, Logger
|
||||||
from helper import timeNowTZ, get_setting_value
|
from helper import get_setting_value
|
||||||
from const import logPath, applicationPath, fullDbPath
|
from const import logPath
|
||||||
from database import DB
|
|
||||||
from device import Device_obj
|
|
||||||
import conf
|
import conf
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
from librouteros import connect
|
from librouteros import connect
|
||||||
@@ -81,6 +70,7 @@ def get_entries(plugin_objects: Plugin_Objects) -> Plugin_Objects:
|
|||||||
comment = lease.get('comment')
|
comment = lease.get('comment')
|
||||||
last_seen = lease.get('last-seen')
|
last_seen = lease.get('last-seen')
|
||||||
status = lease.get('status')
|
status = lease.get('status')
|
||||||
|
device_name = comment or host_name or "(unknown)"
|
||||||
|
|
||||||
mylog('verbose', [f"ID: {lease_id}, Address: {address}, MAC Address: {mac_address}, Host Name: {host_name}, Comment: {comment}, Last Seen: {last_seen}, Status: {status}"])
|
mylog('verbose', [f"ID: {lease_id}, Address: {address}, MAC Address: {mac_address}, Host Name: {host_name}, Comment: {comment}, Last Seen: {last_seen}, Status: {status}"])
|
||||||
|
|
||||||
@@ -89,9 +79,9 @@ def get_entries(plugin_objects: Plugin_Objects) -> Plugin_Objects:
|
|||||||
primaryId = mac_address,
|
primaryId = mac_address,
|
||||||
secondaryId = address,
|
secondaryId = address,
|
||||||
watched1 = address,
|
watched1 = address,
|
||||||
watched2 = host_name,
|
watched2 = device_name,
|
||||||
watched3 = last_seen,
|
watched3 = host_name,
|
||||||
watched4 = '',
|
watched4 = last_seen,
|
||||||
extra = '',
|
extra = '',
|
||||||
helpVal1 = comment,
|
helpVal1 = comment,
|
||||||
foreignKey = mac_address)
|
foreignKey = mac_address)
|
||||||
|
|||||||
Reference in New Issue
Block a user