ARPSCAN to plugin rewrite
This commit is contained in:
@@ -292,7 +292,6 @@ def passable_string_from_setting(globalSetting):
|
|||||||
setVal = globalSetting[6] # setting value
|
setVal = globalSetting[6] # setting value
|
||||||
setTyp = globalSetting[3] # setting type
|
setTyp = globalSetting[3] # setting type
|
||||||
|
|
||||||
|
|
||||||
noConversion = ['text', 'string', 'integer', 'boolean', 'password', 'readonly', 'integer.select', 'text.select', 'integer.checkbox' ]
|
noConversion = ['text', 'string', 'integer', 'boolean', 'password', 'readonly', 'integer.select', 'text.select', 'integer.checkbox' ]
|
||||||
arrayConversion = ['text.multiselect', 'list']
|
arrayConversion = ['text.multiselect', 'list']
|
||||||
arrayConversionBase64 = ['subnets']
|
arrayConversionBase64 = ['subnets']
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import conf
|
|||||||
from const import pialertPath, logPath, apiPath
|
from const import pialertPath, logPath, apiPath
|
||||||
from helper import noti_struc, generate_mac_links, removeDuplicateNewLines, timeNowTZ, hide_email, updateState, get_file_content, write_file
|
from helper import noti_struc, generate_mac_links, removeDuplicateNewLines, timeNowTZ, hide_email, updateState, get_file_content, write_file
|
||||||
from logger import logResult, mylog, print_log
|
from logger import logResult, mylog, print_log
|
||||||
|
from plugin import execute_plugin
|
||||||
|
|
||||||
|
|
||||||
from publishers.email import (check_config as email_check_config,
|
from publishers.email import (check_config as email_check_config,
|
||||||
@@ -468,15 +469,18 @@ def check_and_run_event(db):
|
|||||||
|
|
||||||
event, param = ['','']
|
event, param = ['','']
|
||||||
if len(rows) > 0 and rows[0]['par_Value'] != 'finished':
|
if len(rows) > 0 and rows[0]['par_Value'] != 'finished':
|
||||||
event = rows[0]['par_Value'].split('|')[0]
|
keyValue = rows[0]['par_Value'].split('|')
|
||||||
param = rows[0]['par_Value'].split('|')[1]
|
|
||||||
|
if len(keyValue) == 2:
|
||||||
|
event = keyValue[0]
|
||||||
|
param = keyValue[1]
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
if event == 'test':
|
if event == 'test':
|
||||||
handle_test(param)
|
handle_test(param)
|
||||||
if event == 'run':
|
if event == 'run':
|
||||||
handle_run(param)
|
handle_run(param, db)
|
||||||
|
|
||||||
# clear event execution flag
|
# clear event execution flag
|
||||||
sql.execute ("UPDATE Parameters SET par_Value='finished' WHERE par_ID='Front_Event'")
|
sql.execute ("UPDATE Parameters SET par_Value='finished' WHERE par_ID='Front_Event'")
|
||||||
@@ -485,16 +489,20 @@ def check_and_run_event(db):
|
|||||||
db.commitDB()
|
db.commitDB()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def handle_run(runType):
|
def handle_run(runType, db):
|
||||||
global last_network_scan
|
|
||||||
|
|
||||||
mylog('minimal', ['[', timeNowTZ(), '] START Run: ', runType])
|
mylog('minimal', ['[', timeNowTZ(), '] START Run: ', runType])
|
||||||
|
|
||||||
if runType == 'ENABLE_ARPSCAN':
|
if runType == 'ENABLE_ARPSCAN':
|
||||||
last_network_scan = conf.time_started - datetime.timedelta(hours = 24)
|
# run the plugin to run
|
||||||
|
for plugin in conf.plugins:
|
||||||
|
if plugin["unique_prefix"] == 'ARPSCAN':
|
||||||
|
execute_plugin(db, plugin)
|
||||||
|
|
||||||
mylog('minimal', ['[', timeNowTZ(), '] END Run: ', runType])
|
mylog('minimal', ['[', timeNowTZ(), '] END Run: ', runType])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
def handle_test(testType):
|
def handle_test(testType):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user