diff --git a/back/pialert.py b/back/pialert.py index bb9771e2..284c9e34 100755 --- a/back/pialert.py +++ b/back/pialert.py @@ -1013,8 +1013,7 @@ def scan_network (): updateState("Scan: Network") mylog('verbose', ['[', startTime, '] Scan Devices:' ]) - # # Query ScanCycle properties - print_log ('Query ScanCycle confinguration') + # Query ScanCycle properties scanCycle_data = query_ScanCycle_Data (True) if scanCycle_data is None: mylog('none', ['\n*************** ERROR ***************']) @@ -3790,12 +3789,12 @@ def execute_plugin(plugin): # prepare command from plugin settings, custom parameters command = resolve_wildcards(set_CMD, params).split() - # Execute command - mylog('verbose', [' [Plugins] Executing: ', set_CMD]) - # python-script if plugin['data_source'] == 'python-script': + # Execute command + mylog('verbose', [' [Plugins] Executing: ', set_CMD]) + try: # try runnning a subprocess with a forced timeout in case the subprocess hangs output = subprocess.check_output (command, universal_newlines=True, stderr=subprocess.STDOUT, timeout=(set_RUN_TIMEOUT)) @@ -3815,8 +3814,6 @@ def execute_plugin(plugin): # cleanup - select only lines containing a separator to filter out unnecessary data newLines = list(filter(lambda x: '|' in x, newLines)) - pluginEventCount = len(newLines) - # # regular logging # for line in newLines: # append_line_to_file (pluginsPath + '/plugin.log', line +'\n') @@ -3834,11 +3831,17 @@ def execute_plugin(plugin): # pialert-db-query if plugin['data_source'] == 'pialert-db-query': + # replace single quotes wildcards + q = set_CMD.replace("{s-quote}", '\'') + + # Execute command + mylog('verbose', [' [Plugins] Executing: ', q]) + # build SQL query parameters to insert into the DB sqlParams = [] # set_CMD should contain a SQL query - arr = get_sql_array (set_CMD.replace("{s-quote}", '\'')) + arr = get_sql_array (q) for row in arr: # There has to be always 8 columns @@ -3853,7 +3856,7 @@ def execute_plugin(plugin): mylog('none', [' [Plugins] No output received from the plugin ', plugin["unique_prefix"], ' - enable LOG_LEVEL=debug and check logs']) return else: - mylog('verbose', ['[', timeNow(), '] [Plugins]: SUCCESS, received ', pluginEventCount, ' entries']) + mylog('verbose', ['[', timeNow(), '] [Plugins]: SUCCESS, received ', len(sqlParams), ' entries']) # process results if any if len(sqlParams) > 0: diff --git a/front/plugins.php b/front/plugins.php index 65fab492..10dd2baf 100755 --- a/front/plugins.php +++ b/front/plugins.php @@ -44,7 +44,7 @@ function getFormControl(dbColumnDef, value, index) { switch(dbColumnDef.type) { - case 'label': + case 'label': result = `${value}`; break; case 'textboxsave': @@ -97,7 +97,7 @@ function saveData (id) { $.get(`php/server/dbHelper.php?action=update&dbtable=Plugins_Objects&key=Index&id=${index}&columns=UserData&values=${columnValue}`, function(data) { // var result = JSON.parse(data); - console.log(data) + console.log(data) // if (result) { // period = result; @@ -211,8 +211,6 @@ function generateTabs() } }); - - // Generate the event rows for(i=0;i' - } + } obRows += '' + clm + '' } } diff --git a/front/plugins/nmap_services/config.json b/front/plugins/nmap_services/config.json index a3e16431..3f4f77a4 100755 --- a/front/plugins/nmap_services/config.json +++ b/front/plugins/nmap_services/config.json @@ -55,7 +55,7 @@ }] }, { - "column": "Object_SecondaryD", + "column": "Object_SecondaryID", "show": true, "type": "label", "default_value":"",