NMAP plugin conversion v0.2

This commit is contained in:
Jokob-sk
2023-08-28 06:44:19 +10:00
parent c4adb03c50
commit a1b17a238b
2 changed files with 7 additions and 6 deletions

View File

@@ -389,7 +389,7 @@
{ {
"function": "RUN_TIMEOUT", "function": "RUN_TIMEOUT",
"type": "integer", "type": "integer",
"default_value": 300, "default_value": 30,
"options": [], "options": [],
"localized": ["name", "description"], "localized": ["name", "description"],
"name": [ "name": [

View File

@@ -156,7 +156,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
# handle missing "function":"CMD" setting # handle missing "function":"CMD" setting
if set == None: if set == None:
return return pluginsState
set_CMD = set["value"] set_CMD = set["value"]
@@ -168,7 +168,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
else: else:
set_RUN_TIMEOUT = set["value"] set_RUN_TIMEOUT = set["value"]
mylog('debug', ['[Plugins] Timeout: ', set_RUN_TIMEOUT])
# Prepare custom params # Prepare custom params
params = [] params = []
@@ -191,6 +191,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
mylog('debug', [f'[Plugins] The parameter "name":"{param["name"]}" will multiply the timeout {tempParam.paramValuesCount} times. Total timeout: {set_RUN_TIMEOUT}s']) mylog('debug', [f'[Plugins] The parameter "name":"{param["name"]}" will multiply the timeout {tempParam.paramValuesCount} times. Total timeout: {set_RUN_TIMEOUT}s'])
mylog('debug', ['[Plugins] Timeout: ', set_RUN_TIMEOUT])
# build SQL query parameters to insert into the DB # build SQL query parameters to insert into the DB
sqlParams = [] sqlParams = []
@@ -316,7 +317,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
# handle missing "function":"DB_PATH" setting # handle missing "function":"DB_PATH" setting
if set == None: if set == None:
mylog('none', ['[Plugins] Error: DB_PATH setting for plugin type sqlite-db-query missing.']) mylog('none', ['[Plugins] Error: DB_PATH setting for plugin type sqlite-db-query missing.'])
return return pluginsState
fullSqlitePath = set["value"] fullSqlitePath = set["value"]
@@ -356,7 +357,7 @@ def execute_plugin(db, plugin, pluginsState = plugins_state() ):
# check if the subprocess / SQL query failed / there was no valid output # check if the subprocess / SQL query failed / there was no valid output
if len(sqlParams) == 0: if len(sqlParams) == 0:
mylog('none', ['[Plugins] No output received from the plugin ', plugin["unique_prefix"], ' - enable LOG_LEVEL=debug and check logs']) mylog('none', ['[Plugins] No output received from the plugin ', plugin["unique_prefix"], ' - enable LOG_LEVEL=debug and check logs'])
return return pluginsState
else: else:
mylog('verbose', ['[Plugins] SUCCESS, received ', len(sqlParams), ' entries']) mylog('verbose', ['[Plugins] SUCCESS, received ', len(sqlParams), ' entries'])