mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
NMAP plugin conversion v0.3
This commit is contained in:
@@ -5,6 +5,7 @@ import datetime
|
||||
|
||||
import conf
|
||||
from const import *
|
||||
# from helper import get_setting_value
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
# duplication from helper to avoid circle
|
||||
@@ -16,6 +17,8 @@ def timeNowTZ():
|
||||
return datetime.datetime.now().replace(microsecond=0)
|
||||
|
||||
|
||||
# conf.LOG_LEVEL = get_setting_value("LOG_LEVEL")
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
debugLevels = [
|
||||
('none', 0), ('minimal', 1), ('verbose', 2), ('debug', 3)
|
||||
|
||||
@@ -37,17 +37,18 @@ class plugin_param:
|
||||
mylog('debug', f'[Plugins] setTyp: {setTyp}')
|
||||
|
||||
if '.select' in setTyp or setTyp in arrayConversion:
|
||||
# store number of returned values
|
||||
paramValuesCount = len(setVal)
|
||||
|
||||
if setTyp in noConversion:
|
||||
resolved = setVal
|
||||
|
||||
|
||||
elif setTyp in arrayConversion:
|
||||
# make them safely passable to a python or linux script
|
||||
resolved = flatten_array(setVal)
|
||||
|
||||
elif setTyp in arrayConversionBase64:
|
||||
|
||||
|
||||
elif setTyp in arrayConversionBase64:
|
||||
# make them safely passable to a python or linux script by converting them to a base64 string if necessary (if the arg contains spaces)
|
||||
resolved = flatten_array(setVal)
|
||||
else:
|
||||
for item in jsonConversion:
|
||||
@@ -60,7 +61,11 @@ class plugin_param:
|
||||
# Get SQL result
|
||||
if param["type"] == "sql":
|
||||
inputValue = db.get_sql_array(param["value"])
|
||||
|
||||
|
||||
# store number of returned values
|
||||
paramValuesCount = len(inputValue)
|
||||
|
||||
# make them safely passable to a python or linux script
|
||||
resolved = flatten_array(inputValue)
|
||||
|
||||
|
||||
|
||||
@@ -467,12 +467,10 @@ def skip_repeated_notifications (db):
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
def check_and_run_event(db, pluginsState):
|
||||
mylog('debug', [f'[MAIN] processScan1: {pluginsState.processScan}'])
|
||||
|
||||
sql = db.sql # TO-DO
|
||||
sql.execute(""" select * from Parameters where par_ID = "Front_Event" """)
|
||||
rows = sql.fetchall()
|
||||
|
||||
mylog('debug', [f'[MAIN] processScan2: {pluginsState.processScan}'])
|
||||
rows = sql.fetchall()
|
||||
|
||||
event, param = ['','']
|
||||
if len(rows) > 0 and rows[0]['par_Value'] != 'finished':
|
||||
|
||||
Reference in New Issue
Block a user