From 162fb44dd7140925449b0fedb1ce126499accf0d Mon Sep 17 00:00:00 2001 From: "ismael.moreno" Date: Tue, 10 Sep 2019 14:26:50 +0200 Subject: [PATCH 01/73] SFTP support and custom port added --- pandora_plugins/FTP/ftp_plugin/ftp.conf | 22 ++++++---- pandora_plugins/FTP/ftp_plugin/plugin_ftp.pl | 43 ++++++++++++++++---- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/pandora_plugins/FTP/ftp_plugin/ftp.conf b/pandora_plugins/FTP/ftp_plugin/ftp.conf index ff418cdcfb..2d0099b3be 100644 --- a/pandora_plugins/FTP/ftp_plugin/ftp.conf +++ b/pandora_plugins/FTP/ftp_plugin/ftp.conf @@ -5,25 +5,31 @@ #====================================================================== # User and password for FTP connection -conf_ftp_user mario +conf_ftp_user root # Use "" if your password is in blank -conf_ftp_pass pulido +conf_ftp_pass Password + +#Port for FTP/SFTP connection +#conf_ftp_port 22 + +#Set this parameter to 1 if you want stablish an SFTP connection +conf_ftp_sftp 1 # Configure complete name of ftp file --> upload (Local) -conf_ftp_putfile /home/mariopc/Descargas/ejemplo.zip +conf_ftp_putfile /tmp/test_upload.zip # Configure name of ftp file --> upload (FTP server) -conf_ftp_putname prueba.zip +conf_ftp_putname /tmp/test.zip # Configure Ip for FTP Connection conf_ftp_host localhost # Configure name of ftp file --> download (FTP server) -conf_ftp_getfile prueba.zip +conf_ftp_getfile /tmp/test.zip # Configure complete name os ftp file --> download (Local) -conf_ftp_getname prueba.zip +conf_ftp_getname /tmp/test.zip # Configure Operating System (Unix or Windows) conf_operating_system Unix @@ -34,10 +40,10 @@ conf_operating_system Unix conf_ftp_compare write -conf_ftp_compare_file prueba.zip +conf_ftp_compare_file /tmp/prueba.zip -conf_local_comp_file prueba.zip +conf_local_comp_file /tmp/prueba.zip conf_local_downcomp_file /tmp/prueba.zip diff --git a/pandora_plugins/FTP/ftp_plugin/plugin_ftp.pl b/pandora_plugins/FTP/ftp_plugin/plugin_ftp.pl index 0aa463e597..e464c42057 100644 --- a/pandora_plugins/FTP/ftp_plugin/plugin_ftp.pl +++ b/pandora_plugins/FTP/ftp_plugin/plugin_ftp.pl @@ -8,6 +8,7 @@ use strict; use warnings; use Data::Dumper; use Net::FTP; +use Net::SFTP::Foreign; use Time::HiRes qw ( gettimeofday ); my $archivo_cfg = $ARGV[0]; @@ -115,6 +116,14 @@ sub load_external_setup ($) if ($parametro =~ m/^conf\_ftp\_host\s(.*)/i) { $plugin_setup{"conf_ftp_host"} = $1; } + + if ($parametro =~ m/^conf\_ftp\_port\s(.*)/i) { + $plugin_setup{"conf_ftp_port"} = $1; + } + + if ($parametro =~ m/^conf\_ftp\_sftp\s(.*)/i) { + $plugin_setup{"conf_ftp_sftp"} = $1; + } if ($parametro =~ m/^conf\_ftp\_putfile\s(.*)/i) { $plugin_setup{"conf_ftp_putfile"} = $1; @@ -184,20 +193,38 @@ load_external_setup ($archivo_cfg); #------------------------------------------------------------------------- # Start session in FTP server #-------------------------------------------------------------------------- - -my $ftp = Net::FTP->new($plugin_setup{"conf_ftp_host"}) or die("Unable to connect to server: $!");#Connect FTP server -$ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or die("Failed Login: $!");# Login at FTP server +my $ftp; +if (($plugin_setup{"conf_ftp_sftp"}) && ( $plugin_setup{"conf_ftp_sftp"} == 1)){ + if ($plugin_setup{"conf_ftp_port"}){ + #port => $plugin_setup{"port"}, + $ftp = Net::SFTP::Foreign->new(host => $plugin_setup{"conf_ftp_host"}, port => $plugin_setup{"conf_ftp_port"}, stderr_discard => 1, user => $plugin_setup{"conf_ftp_user"} , password => $plugin_setup{"conf_ftp_pass"},expect_log_user => 'false'); + if($ftp->error){ + die($ftp->error); + } + }else{ + $ftp = Net::SFTP::Foreign->new(host => $plugin_setup{"conf_ftp_host"}, stderr_discard => 1, user => $plugin_setup{"conf_ftp_user"} , password => $plugin_setup{"conf_ftp_pass"},expect_log_user => 'false'); + if($ftp->error){ + die($ftp->error); + } + } +} else { + if ($plugin_setup{"conf_ftp_port"}){ + $ftp = Net::FTP->new(host => $plugin_setup{"conf_ftp_host"},port => $plugin_setup{"conf_ftp_port"}) or die("Unable to connect to server: $!");#Connect FTP server + }else{ + $ftp = Net::FTP->new($plugin_setup{"conf_ftp_host"}) or die("Unable to connect to server: $!");#Connect FTP server + } + $ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or die("Failed Login: $!");# Login at FTP server #print_module ( "Disp_FTP_$plugin_setup{conf_ftp_host}" , "generic_proc", 1, " Determines whether FTP login to $plugin_setup{conf_ftp_host} has been successful or not" ); +} #------------------------------------------------------------------------- # Returns the module that shows the time and transfer rate.(Upload a file) #-------------------------------------------------------------------------- my $clock0 = gettimeofday(); - $ftp->put($plugin_setup{"conf_ftp_putfile"},$plugin_setup{"conf_ftp_putname"});# Upload file at FTP server + $ftp->put($plugin_setup{"conf_ftp_putfile"},$plugin_setup{"conf_ftp_putname"}) or die("Cannot upload file to server");# Upload file at FTP server my $clock1 = gettimeofday(); my $clockd = $clock1 - $clock0;# Calculate upload transfer time - $ftp->size($plugin_setup{"conf_ftp_putname"});# File size - my $putrate = $ftp->size($plugin_setup{"conf_ftp_putname"})/$clockd;# Calculate rate transfer + my $putrate = $ftp->stat($plugin_setup{"conf_ftp_putname"})->size/$clockd;# Calculate rate transfer my $time_puftp=sprintf("%.2f",$clockd); my $rate_puftp=sprintf("%.2f",$putrate); @@ -212,8 +239,8 @@ $ftp->login($plugin_setup{"conf_ftp_user"},$plugin_setup{"conf_ftp_pass"}) or di $ftp->get($plugin_setup{"conf_ftp_getfile"},$plugin_setup{"conf_ftp_getname"}); my $clock3 = gettimeofday(); my $clockg = $clock3 - $clock2; - $ftp->size($plugin_setup{"conf_ftp_getname"}); - my $getrate = $ftp->size($plugin_setup{"conf_ftp_getname"})/$clockg; + #$ftp->stat($plugin_setup{"conf_ftp_getname"})->size; + my $getrate = $ftp->stat($plugin_setup{"conf_ftp_getname"})->size/$clockg; my $time_getftp=sprintf("%.2f",$clockg); my $rate_getftp=sprintf("%.2f",$getrate); From 80191263671d8af741aa7f493ece2aea1e9e8289 Mon Sep 17 00:00:00 2001 From: Calvo Date: Thu, 20 May 2021 17:15:27 +0200 Subject: [PATCH 02/73] Fixed group icon on agent creation --- pandora_console/godmode/agentes/agent_manager.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index d486be0e7b..3f87d978cd 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -349,7 +349,14 @@ if (isset($groups[$grupo]) || $new_agent) { } $table_primary_group .= '
'; -$table_primary_group .= ui_print_group_icon($grupo, true); +if ($id_agente === 0) { + $hidden = 'display: none;'; +} else { + $hidden = ''; +} + +$table_primary_group .= ui_print_group_icon($grupo, true, 'groups_small', $hidden); + $table_primary_group .= '
'; $table_interval = '

'.__('Interval').'

'; @@ -1243,6 +1250,9 @@ ui_require_jquery_file('bgiframe'); }); $("select#id_os").pandoraSelectOS (); + $('select#grupo').pandoraSelectGroupIcon (); + + var checked = $("#checkbox-cascade_protection").is(":checked"); if (checked) { From d3bd24fc181743fa0e801ba2abbecb0d1f9d9b7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Mon, 24 May 2021 11:01:50 +0200 Subject: [PATCH 03/73] Fixed some errors and fixed issue finding policies --- .../operation/search_agents.getdata.php | 6 +- .../operation/search_policies.getdata.php | 73 +++++++++++++------ 2 files changed, 55 insertions(+), 24 deletions(-) diff --git a/pandora_console/operation/search_agents.getdata.php b/pandora_console/operation/search_agents.getdata.php index dede18d3f1..5b86af6f2a 100644 --- a/pandora_console/operation/search_agents.getdata.php +++ b/pandora_console/operation/search_agents.getdata.php @@ -195,8 +195,10 @@ if ($searchAgents) { t1.comentarios COLLATE utf8_general_ci LIKE '%%".$stringSearchSQL."%%' OR t1.id_agente = $aux"; - if (count($id) >= 2) { - for ($i = 1; $i < count($id); $i++) { + $idCount = count($id); + + if ($idCount >= 2) { + for ($i = 1; $i < $idCount; $i++) { $aux = $id[$i]['id_agent']; $search_sql .= " OR t1.id_agente = $aux"; } diff --git a/pandora_console/operation/search_policies.getdata.php b/pandora_console/operation/search_policies.getdata.php index 078ebb7be5..c338e4b19d 100644 --- a/pandora_console/operation/search_policies.getdata.php +++ b/pandora_console/operation/search_policies.getdata.php @@ -1,24 +1,39 @@ 'id', @@ -58,6 +74,7 @@ switch ($sortField) { case 'name': switch ($sort) { case 'up': + default: $selectNameUp = $selected; $order = [ 'field' => 'name', @@ -78,6 +95,7 @@ switch ($sortField) { case 'description': switch ($sort) { case 'up': + default: $selectId_groupUp = $selected; $order = [ 'field' => 'description', @@ -98,6 +116,7 @@ switch ($sortField) { case 'last_contact': switch ($sort) { case 'up': + default: $selectId_groupUp = $selected; $order = [ 'field' => 'last_connect', @@ -118,6 +137,7 @@ switch ($sortField) { case 'id_group': switch ($sort) { case 'up': + default: $selectId_groupUp = $selected; $order = [ 'field' => 'last_connect', @@ -138,6 +158,7 @@ switch ($sortField) { case 'status': switch ($sort) { case 'up': + default: $selectStatusUp = $selected; $order = [ 'field' => 'is_admin', @@ -174,31 +195,39 @@ switch ($sortField) { break; } -if ($searchpolicies) { +if ($searchpolicies === true) { /* We take the user groups to get policies that meet the requirements of the search and which the user have permission on this groups */ + $user_groups = users_get_groups($config['id_user'], 'AR', false); $id_user_groups = array_keys($user_groups); $id_user_groups_str = implode(',', $id_user_groups); - $sql = "SELECT id, name, description, id_group, status - FROM tpolicies - WHERE name LIKE '$stringSearchSQL' - AND id_group IN ($id_user_groups_str)"; + $sql = "SELECT id, name, description, id_group, status + FROM tpolicies + WHERE name LIKE '$stringSearchSQL' + AND + (id_group IN ($id_user_groups_str) + OR 1 = ( + SELECT is_admin + FROM tusuario + WHERE id_user = 'admin' + ) + ) + "; } - $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); + $sql .= ' LIMIT '.$config['block_size'].' OFFSET '.get_parameter('offset', 0); $policies = db_process_sql($sql); - if ($policies !== false) { $totalPolicies = count($policies); - if ($only_count) { + if ($only_count === true) { unset($policies); } } else { From 62272a1f3fc8cc7e0ebb8754da538c189b829483 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 28 May 2021 12:45:39 +0200 Subject: [PATCH 04/73] Unset field tcp send when snmp remote component selected --- .../godmode/modules/manage_network_components_form.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 940f155f2d..6776316d54 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -182,6 +182,7 @@ if (isset($id)) { $snmp3_privacy_pass = io_output_password( $component['custom_string_2'] ); + unset($tcp_send); $snmp3_security_level = $component['custom_string_3']; } else if ($type >= MODULE_TYPE_REMOTE_CMD && $type <= MODULE_TYPE_REMOTE_CMD_INC) { $command_text = $component['tcp_send']; From 275c6d321bc42adefeddcdc03b8d9371cb73b082 Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 28 May 2021 14:29:53 +0200 Subject: [PATCH 05/73] Fixed alert command hide on update --- pandora_console/godmode/alerts/configure_alert_command.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/alerts/configure_alert_command.php b/pandora_console/godmode/alerts/configure_alert_command.php index 88da3e5abf..b1b3c8a75b 100644 --- a/pandora_console/godmode/alerts/configure_alert_command.php +++ b/pandora_console/godmode/alerts/configure_alert_command.php @@ -105,6 +105,7 @@ if ($update_command) { $alert['command'] = $command; $alert['description'] = $description; $alert['id_group'] = $id_group; + $alert['fields_hidden'] = io_json_mb_encode($fields_hidden); } } From 2f3cae8d61642f297105f7435c1d474b790b7d8f Mon Sep 17 00:00:00 2001 From: Calvo Date: Fri, 4 Jun 2021 13:36:32 +0200 Subject: [PATCH 06/73] Fixedd XSS on load filter event name --- pandora_console/operation/events/events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 9dab979e38..a4840ee92b 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1472,7 +1472,7 @@ try { $active_filters_div .= '
'.__('Current filter').'
'; $active_filters_div .= '
'; if ($loaded_filter !== false) { - $active_filters_div .= io_safe_output($loaded_filter['id_name']); + $active_filters_div .= htmlentities(io_safe_output($loaded_filter['id_name'])); } else { $active_filters_div .= __('Not set.'); } From b48651c31ecb7766bb4efd98003ab4021de42a79 Mon Sep 17 00:00:00 2001 From: "rafael.ameijeiras" Date: Tue, 8 Jun 2021 15:27:05 +0200 Subject: [PATCH 07/73] improbe telegram bot to send module graphs --- .../telegram-bot-cli/pandora-telegram-cli.py | 148 +++++++++++++++++- .../telegram-bot-cli/test_exec.txt | 3 + 2 files changed, 146 insertions(+), 5 deletions(-) diff --git a/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py b/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py index bcba8b65b0..f08e1126a4 100644 --- a/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py +++ b/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py @@ -1,27 +1,165 @@ import requests, argparse, json, sys, os +from datetime import datetime +from base64 import b64decode + +__version__='080621' ### Variables and arg parser ### -parser = argparse.ArgumentParser(description='Bot telegram cli') +parser = argparse.ArgumentParser(description=f'Bot telegram cli, Version: {__version__}') parser.add_argument('-m', '--message', help='Message to be send', required=True) parser.add_argument('-t', '--token', help='Bot token', required=True) parser.add_argument('-c', '--chat_id', help='chat id to send messages', required=True) +parser.add_argument('--api_conf', help='Api configuration parameters in coma separate keypairs. EX "user=admin,pass=pandora,api_pass=1234,api_url=http://test.artica.es/pandora_console/include/api.php"') +parser.add_argument('--module_graph', help='Uses pandora API to generate a module graph and attach it to the alert needs module_id and interval parameters in coma separate keypairs. EX "module_id=55,interval=3600"') +parser.add_argument('--tmp_dir', help='Temporary path to store graph images', default='/tmp') args = parser.parse_args() +def parse_dic(cValues): + """convert coma separate keypairs into a dic. EX "test=5,house=8,market=2" wil return "{'test': '5', 'casa': '8', 'mercado': '2'}" """ + data={} + try : + for kv in cValues.split(","): + k,v = kv.strip().split("=") + data[k.strip()]=v.strip() + except Exception as e : + print(f"Warning, error parsing keypairs values: {e}") + return data + + +def parse_api_conf(cConf): + """Check apiconfiguration parameters """ + if args.api_conf : + # Parse Api config + print ("Api config enable", file=sys.stderr) + apid = parse_dic(cConf) + + if apid.get("user") is None: + print ("Warning. no user defined in api_conf keypairs, skiping graph generation.") + return None + + if apid.get("pass") is None: + print ("Warning. no password defined in api_conf keypairs, skiping graph generation.") + return None + + if apid.get("api_pass") is None: + print ("Warning. no api pass defined in api_conf keypairs, skiping graph generation.") + return None + + if apid.get("api_url") is None: + apid['api_url'] = "http://127.0.0.1/pandora_console/include/api.php" + #print(f"api_url: {apid['api_url']}") + + return apid + else: + return None + +def parse_graph_conf(cGraph): + """Check module graph parameters """ + if cGraph : + # Parse Api config + graphd = parse_dic(cGraph) + if graphd.get("module_id") is None: + print ("Warning. no module_id defined in module_graph keypairs, skiping graph generation.") + return + + if graphd.get("interval") is None: + graphd["interval"] = 3600 + + return graphd + else: + print("Warning. no module_graph keypairs defined, skiping graph generation") + return None + +def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval, sep="url_encode_separator_%7C") : + """Call Pandorafms api to get graph""" + try: + url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}" + graph = requests.get(url) + if graph.status_code != 200: + print (f"Error requested api url, status code: {graph.status_code}. Skiping graph generation") + return None + if graph.text == "auth error": + print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") + return None + if graph.text == "Id does not exist in database.": + print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") + return None + + except: + print("Error requested api url. Skiping graph generation") + return None + return graph def send(mssg, chatId, token): url = f"https://api.telegram.org/bot{token}/sendMessage" headers = {'content-type': 'application/json'} - data = { "chat_id": chatId, "text": mssg } - response = requests.get(url, data=json.dumps(data), headers=headers) + try: + response = requests.get(url, data=json.dumps(data), headers=headers) + r = response.json() + print(r) + except Exception as e : + r = None + exit(f"Error requesting telegram api: {e}") - r = response.json() - print(r) +def sendMedia(mssg, chatId, token, filepath): + url = f"https://api.telegram.org/bot{token}/sendPhoto" + data = { + "chat_id": chatId, + "caption": mssg + } + try: + with open(filepath, "rb") as photog: + request = requests.post(url, data=data, files={'photo': (filepath, photog)}) + r = request.json() + except Exception as e : + r = None + print(f"Error, cant add graph file: {e}") + + if r is not None: + r = request.json() + print(r) + +# Parse api config +if args.api_conf : + api = parse_api_conf(args.api_conf) + # Parse graph config + if api is not None: + graph_cfg = parse_graph_conf(args.module_graph) + + ## Generate graph + if graph_cfg is not None : + graph = get_graph_by_moduleid (api["api_url"],api["user"], api["pass"], api["api_pass"], graph_cfg["module_id"], graph_cfg["interval"]) + if graph is not None: + try: + filename = f"{args.tmp_dir}/graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png" + with open(filename, "wb") as f: + f.write(b64decode(graph.text)) + f.close + print (f"Graph generated on temporary file {filename}", file=sys.stderr) + except Exception as e : + print(f"Error, cant generate graph file: {e}", file=sys.stderr) + filename = None + else: filename = None + + if filename is not None: + filecap=f"graph_{graph_cfg['module_id']}.{datetime.now().strftime('%s')}.png" + else: + filecap=None + +# Send message send(mssg=args.message, chatId=args.chat_id, token=args.token) + +if filecap is not None: + sendMedia(mssg=filecap, chatId=args.chat_id, token=args.token, filepath=filename) + try: + os.remove(filename) + except Exception as e: + exit('Error: {e}') \ No newline at end of file diff --git a/pandora_plugins/message_app_connectors/telegram-bot-cli/test_exec.txt b/pandora_plugins/message_app_connectors/telegram-bot-cli/test_exec.txt index 86844d04c2..c108b7a684 100644 --- a/pandora_plugins/message_app_connectors/telegram-bot-cli/test_exec.txt +++ b/pandora_plugins/message_app_connectors/telegram-bot-cli/test_exec.txt @@ -4,3 +4,6 @@ python3 pandora-telegram-cli.py -t 1412764845:AAG-OxOKISOXwhITLFFNm6oq5YD2KI72fT # Pandora FMS command definition example python3 pandora-telegram-cli.py -t _field1_ -c _field2_ -m" _field3_" + +# New +python3 pandora-telegram-cli.py -m 'test message for telegram new bot script' -t 1874294647:AAHRBk4YDf1QZXh_WuZ8m7ONrAQoKbTW6eQ -c -261593656 --api_conf "user=admin,pass=pandora,api_pass=pandora,api_url=http://192.168.80.44:8080/pandora_console/include/api.php" --module_graph "module_id=402, interval=3600" --tmp_dir /tmp From c707a5763436a5cba282eb56f1a8f5cd3d7e70c4 Mon Sep 17 00:00:00 2001 From: "rafael.ameijeiras" Date: Wed, 9 Jun 2021 13:16:27 +0200 Subject: [PATCH 08/73] handeling user with not enougth permissions --- .../telegram-bot-cli/pandora-telegram-cli.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py b/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py index f08e1126a4..f733add6ae 100644 --- a/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py +++ b/pandora_plugins/message_app_connectors/telegram-bot-cli/pandora-telegram-cli.py @@ -74,6 +74,7 @@ def parse_graph_conf(cGraph): def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterval, sep="url_encode_separator_%7C") : """Call Pandorafms api to get graph""" + try: url = f"{baseUrl}?op=get&op2=module_graph&id={moduleId}&other={graphInterval}%7C1&other_mode={sep}&apipass={apiPass}&api=1&user={pUser}&pass={pPass}" graph = requests.get(url) @@ -86,6 +87,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva if graph.text == "Id does not exist in database.": print (f"Error requested Pandora api url, status code: {graph.text}. Skiping graph generation") return None + if graph.text == "The user has not enough permissions for perform this action.": + print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation") + return None except: print("Error requested api url. Skiping graph generation") From 0cf63c3aa031bb90db35f1dd711515c46ebe1373 Mon Sep 17 00:00:00 2001 From: "rafael.ameijeiras" Date: Wed, 9 Jun 2021 13:23:01 +0200 Subject: [PATCH 09/73] handeling user with not enougth permissions on the other scripts --- .../message_app_connectors/discord/pandora_discord_cli.py | 3 +++ .../message_app_connectors/slack/pandora-slack-cli.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py b/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py index 522f5fb75e..715657da28 100644 --- a/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py +++ b/pandora_plugins/message_app_connectors/discord/pandora_discord_cli.py @@ -102,6 +102,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva if graph.text == "Id does not exist in database.": print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") return None + if graph.text == "The user has not enough permissions for perform this action.": + print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation") + return None except: print("Error requested api url. skipping graph generation") return None diff --git a/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py b/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py index b09938b885..5eb24fc865 100644 --- a/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py +++ b/pandora_plugins/message_app_connectors/slack/pandora-slack-cli.py @@ -106,6 +106,9 @@ def get_graph_by_moduleid (baseUrl,pUser, pPass, apiPass, moduleId, graphInterva if graph.text == "Id does not exist in database.": print (f"Error requested Pandora api url, status code: {graph.text}. skipping graph generation") return None + if graph.text == "The user has not enough permissions for perform this action.": + print (f"Error requested Pandora api url, status code: {graph.text} Skiping graph generation") + return None except: print("Error requested api url. skipping graph generation") From cb5905b00099614f5f976cd106de045af70002f1 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 11 Jun 2021 08:52:10 +0200 Subject: [PATCH 10/73] fixed xss vulnerability --- .../godmode/agentes/configurar_agente.php | 4 +- .../agentes/module_manager_editor_common.php | 2 +- pandora_console/include/javascript/pandora.js | 38 ++++++++++++------- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 23f3437bd8..018409c8a0 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -2368,7 +2368,7 @@ switch ($tab) { var aget_id_os = ''; - if('' != $('#text-name').val() && + if('' != $('#text-name').val() && '' == 19){ event.preventDefault(); @@ -2402,7 +2402,7 @@ switch ($tab) { var module_type_snmp = ''; - if('' != $('#text-name').val() && ( + if('' != $('#text-name').val() && ( module_type_snmp == 15 || module_type_snmp == 16 || module_type_snmp == 17 || module_type_snmp == 18)){ event.preventDefault(); diff --git a/pandora_console/godmode/agentes/module_manager_editor_common.php b/pandora_console/godmode/agentes/module_manager_editor_common.php index dc0a0e4259..6e544c2395 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_common.php +++ b/pandora_console/godmode/agentes/module_manager_editor_common.php @@ -214,7 +214,7 @@ $table_simple->colspan[3][1] = 3; $table_simple->data[0][0] = __('Name'); $table_simple->data[0][1] = html_print_input_text_extended( 'name', - io_safe_input(html_entity_decode($name, ENT_QUOTES, 'UTF-8')), + $name, 'text-name', '', 45, diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index a9a742f0cd..83c1c20b34 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -281,11 +281,11 @@ function agent_changed_by_multiple_agents(event, id_agent, selected) { $.each(data, function(i, val) { var s = js_html_entity_decode(val); + s = s.replace(/"/g, """).replace(/'/g, "'"); + i = i.replace(/"/g, """).replace(/'/g, "'"); + $("#module").append( - $("") - .html(s) - .attr("value", i) - .attr("title", s) + $('').text(val) ); all_common_modules.push(i); @@ -385,12 +385,11 @@ function agent_changed_by_multiple_agents_with_alerts( } } jQuery.each(data, function(i, val) { - s = js_html_entity_decode(val); - $("#module").append( - $("") - .html(s) - .attr("value", val) - ); + var s = js_html_entity_decode(val); + + s = s.replace(/"/g, """).replace(/'/g, "'"); + + $("#module").append($('').text(val)); $("#module").fadeIn("normal"); }); if (selected != undefined) $("#module").attr("value", selected); @@ -481,12 +480,23 @@ function alert_templates_changed_by_multiple_agents_with_alerts( } } jQuery.each(data, function(i, val) { - s = js_html_entity_decode(val); + var decoded_val = js_html_entity_decode(val); + console.log("161616"); + + decoded_val = decoded_val + .replace(/"/g, """) + .replace(/'/g, "'"); + $("#module").append( - $("") - .html(s) - .attr("value", val) + $( + '' + ).text(val) ); + $("#module").fadeIn("normal"); }); if (selected != undefined) $("#module").attr("value", selected); From 98f0bc9facad25859f941a9ce044fae732eebd65 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Fri, 11 Jun 2021 08:54:00 +0200 Subject: [PATCH 11/73] fixed xss vulnerability --- pandora_console/include/javascript/pandora.js | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 83c1c20b34..9f54c5f7c5 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -481,7 +481,6 @@ function alert_templates_changed_by_multiple_agents_with_alerts( } jQuery.each(data, function(i, val) { var decoded_val = js_html_entity_decode(val); - console.log("161616"); decoded_val = decoded_val .replace(/"/g, """) From afa1eef63c9703f56b49d5a5cd850bea84e28704 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 14 Jun 2021 14:10:16 +0200 Subject: [PATCH 12/73] fixed sql error without profile --- pandora_console/extensions/users_connected.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 884285dd28..6ac2aa105a 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -83,8 +83,16 @@ function users_extension_main_god($god=true) break; } - $rows = db_get_all_rows_sql($sql); + $check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up'); + if ($check_profile === false) { + return ui_print_error_message( + __('This user does not have any associated profile'), + '', + false + ); + } + $rows = db_get_all_rows_sql($sql); if (empty($rows)) { $rows = []; echo "
".__('No other users connected').'
'; From 0521ffb7bfa4f36f2d2945d44cff34ec7bc61ce3 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 14 Jun 2021 14:46:41 +0200 Subject: [PATCH 13/73] fixed sql error without profile --- .../extensions/users_connected.php | 139 +++++++++++------- 1 file changed, 89 insertions(+), 50 deletions(-) diff --git a/pandora_console/extensions/users_connected.php b/pandora_console/extensions/users_connected.php index 6ac2aa105a..32be153e69 100644 --- a/pandora_console/extensions/users_connected.php +++ b/pandora_console/extensions/users_connected.php @@ -33,58 +33,11 @@ function users_extension_main_god($god=true) $image = 'images/user.png'; } - // Header + // Header. ui_print_page_header(__('Users connected'), $image, false, '', $god); - // Get groups user has permission - $group_um = users_get_groups_UM($config['id_user']); - // Is admin or has group permissions all. - $groups = implode(',', array_keys($group_um, 1)); - - // Get user conected last 5 minutes.Show only those on which the user has permission. - switch ($config['dbtype']) { - case 'mysql': - $sql = sprintf( - 'SELECT tusuario.id_user, tusuario.last_connect - FROM tusuario - INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user - AND tusuario_perfil.id_grupo IN (%s) - WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') - GROUP BY tusuario.id_user - ORDER BY last_connect DESC', - $groups - ); - break; - - case 'postgresql': - $sql = sprintf( - "SELECT tusuario.id_user, tusuario.last_connect - FROM tusuario - INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user - AND tusuario_perfil.id_grupo IN (%s) - WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') - GROUP BY tusuario.id_user - ORDER BY last_connect DESC', - $groups - ); - break; - - case 'oracle': - $sql = sprintf( - "SELECT tusuario.id_user, tusuario.last_connect - FROM tusuario - INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user - AND tusuario_perfil.id_grupo IN (%s) - WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') - GROUP BY tusuario.id_user - ORDER BY last_connect DESC', - $groups - ); - break; - } - $check_profile = db_get_row('tusuario_perfil', 'id_usuario', $config['id_user'], 'id_up'); - if ($check_profile === false) { + if ($check_profile === false && !users_is_admin()) { return ui_print_error_message( __('This user does not have any associated profile'), '', @@ -92,11 +45,93 @@ function users_extension_main_god($god=true) ); } + // Get groups user has permission. + $group_um = users_get_groups_UM($config['id_user']); + // Is admin or has group permissions all. + $groups = implode(',', array_keys($group_um, 1)); + + // Get user conected last 5 minutes.Show only those on which the user has permission. + switch ($config['dbtype']) { + case 'mysql': + if (users_is_admin()) { + $sql = sprintf( + 'SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC' + ); + } else { + $sql = sprintf( + 'SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo IN (%s) + WHERE last_connect > (UNIX_TIMESTAMP(NOW()) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC', + $groups + ); + } + break; + + case 'postgresql': + if (users_is_admin()) { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC' + ); + } else { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo IN (%s) + WHERE last_connect > (ceil(date_part('epoch', CURRENT_TIMESTAMP)) - ".SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC', + $groups + ); + } + break; + + case 'oracle': + if (users_is_admin()) { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC' + ); + } else { + $sql = sprintf( + "SELECT tusuario.id_user, tusuario.last_connect + FROM tusuario + INNER JOIN tusuario_perfil ON tusuario_perfil.id_usuario = tusuario.id_user + AND tusuario_perfil.id_grupo IN (%s) + WHERE last_connect > (ceil((sysdate - to_date('19700101000000','YYYYMMDDHH24MISS')) * (".SECONDS_1DAY.')) - '.SECONDS_5MINUTES.') + GROUP BY tusuario.id_user + ORDER BY last_connect DESC', + $groups + ); + } + break; + + default: + // Nothing to do. + break; + } + $rows = db_get_all_rows_sql($sql); if (empty($rows)) { $rows = []; echo "
".__('No other users connected').'
'; } else { + $table = new StdClass(); $table->cellpadding = 0; $table->cellspacing = 0; $table->width = '100%'; @@ -113,7 +148,7 @@ function users_extension_main_god($god=true) $rowPair = true; $iterator = 0; - // Get data + // Get data. foreach ($rows as $row) { // Get data of user's last login. switch ($config['dbtype']) { @@ -143,6 +178,10 @@ function users_extension_main_god($god=true) ) ); break; + + default: + // Nothing to do. + break; } if ($rowPair) { From e8b62561b77a11a05b72fd4360fbe934f4afed3c Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Tue, 15 Jun 2021 14:53:00 +0200 Subject: [PATCH 14/73] fixed entities --- pandora_console/include/functions_integriaims.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_integriaims.php b/pandora_console/include/functions_integriaims.php index c0bc3dfe8e..f9e387c6de 100644 --- a/pandora_console/include/functions_integriaims.php +++ b/pandora_console/include/functions_integriaims.php @@ -199,7 +199,7 @@ function integria_api_call($api_hostname=null, $user=null, $user_pass=null, $api 'user_pass' => $user_pass, 'pass' => $api_pass, 'op' => $operation, - 'params' => html_entity_decode($params), + 'params' => io_safe_output($params), ]; if ($return_type !== '') { From 9ed895d45786aaaff792c55396fa8948728e9b8a Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 16 Jun 2021 11:41:57 +0200 Subject: [PATCH 15/73] Fixes in pie coauth: daniel --- pandora_console/include/graphs/pandora.d3.js | 2 +- pandora_console/include/styles/pandora.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/graphs/pandora.d3.js b/pandora_console/include/graphs/pandora.d3.js index 6c4185a215..8912ae673b 100644 --- a/pandora_console/include/graphs/pandora.d3.js +++ b/pandora_console/include/graphs/pandora.d3.js @@ -2784,7 +2784,7 @@ function donutNarrowGraph( arc = d3.svg .arc() .outerRadius(radius) - .innerRadius(radius - radius / 2.5); + .innerRadius(radius - radius / 6); svg = donutbody .append("svg") diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 32d559abce..4952d9cdbc 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -5565,7 +5565,7 @@ div#bullets_modules div { /* Agent details in agent view */ div#status_pie path { - stroke-width: 8px; + stroke-width: 0px; } div#status_pie { margin-bottom: 2em; From 493047ae40bd19813d9aebd9c05a43f43ce6af2d Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 16 Jun 2021 14:17:45 +0200 Subject: [PATCH 16/73] fixed visual error --- pandora_console/include/functions_config.php | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 326b725e43..1d1a127806 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -3400,7 +3400,7 @@ function config_user_set_custom_config() } } - if ((isset($userinfo['id_skin']) && $userinfo['id_skin'] !== 0)) { + if ((isset($userinfo['id_skin']) && (int) $userinfo['id_skin'] !== 0)) { if ((int) $userinfo['id_skin'] === 1) { $config['style'] = 'pandora'; } @@ -3416,12 +3416,10 @@ function config_user_set_custom_config() if ($sec2_aux != 'godmode/groups/group_list' && $skin !== false) { $id_user_aux = get_parameter('id'); if ($id_user_aux == $config['id_user']) { - if ((int) $skin === 1 || (int) $skin === 0) { - $config['style'] = 'pandora'; - } - - if ((int) $skin === 2) { + if ($config['style'] === 'pandora_black' && (int) $skin === 0 || (int) $skin === 2) { $config['style'] = 'pandora_black'; + } else if ((int) $skin === 1 || (int) $skin === 0) { + $config['style'] = 'pandora'; } } } From 09d56576504d261f1af1d09af811766016e22d0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Wed, 16 Jun 2021 16:36:14 +0200 Subject: [PATCH 17/73] Solve typo --- pandora_console/include/functions_reports.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index f688ea78b6..4f8323f188 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -662,7 +662,7 @@ function reports_get_report_types($template=false, $not_editor=false) ]; $types['sql_graph_hbar'] = [ 'optgroup' => __('Graphs'), - 'name' => __('SQL horizonal bar graph'), + 'name' => __('SQL horizontal bar graph'), ]; } From 5aeab363e999dd3678e633bd6e4aca7bd1f0f704 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 21 Jun 2021 11:25:19 +0200 Subject: [PATCH 18/73] more size for select owner modal events --- pandora_console/include/functions_events.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index c1d7aeb404..d2e6dbe106 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -3576,7 +3576,12 @@ function events_page_responses($event, $childrens_ids=[]) '', __('None'), -1, - true + true, + false, + true, + '', + false, + 'width: 70%' ); $data[2] .= html_print_button( __('Update'), From 951924dd9354f9c49081b54cb9b9443b7733c9e8 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 21 Jun 2021 11:40:48 +0200 Subject: [PATCH 19/73] colspan 1 to group selector custom graph --- .../godmode/reporting/graph_builder.graph_editor.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/reporting/graph_builder.graph_editor.php b/pandora_console/godmode/reporting/graph_builder.graph_editor.php index 1d9b891b79..54ced4e030 100644 --- a/pandora_console/godmode/reporting/graph_builder.graph_editor.php +++ b/pandora_console/godmode/reporting/graph_builder.graph_editor.php @@ -331,9 +331,9 @@ echo "
"; echo ''; -echo "".__('Filter group').''; +echo "".__('Filter group').''; echo ''; -echo "".html_print_select_groups( +echo "".html_print_select_groups( $config['id_user'], ($report_w == true) ? 'RW' : (($report_m == true) ? 'RM' : 'RW'), true, From 289e8a3902fdee02d82f62b98b809dfa5348f591 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 22 Jun 2021 17:05:45 +0200 Subject: [PATCH 20/73] #7668 fixed tags --- pandora_console/include/lib/Dashboard/Widgets/events_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/events_list.php b/pandora_console/include/lib/Dashboard/Widgets/events_list.php index 5f5f732128..e457df69bf 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/events_list.php +++ b/pandora_console/include/lib/Dashboard/Widgets/events_list.php @@ -529,11 +529,11 @@ class EventsListWidget extends Widget if ($customFilter !== false) { $filter = $customFilter; $filter['tag_with'] = base64_encode( - json_encode($filter['tag_with']) + io_safe_output($filter['tag_with']) ); $filter['tag_without'] = base64_encode( - json_encode($filter['tag_without']) + io_safe_output($filter['tag_without']) ); if (!empty($filter['id_agent_module'])) { From 538f17441fc5e2bc265da79b908043177aedf7b7 Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 23 Jun 2021 12:49:32 +0200 Subject: [PATCH 21/73] Fixed missing return on tags_update_policy_module_tag function --- pandora_console/include/functions_tags.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pandora_console/include/functions_tags.php b/pandora_console/include/functions_tags.php index 8b1c725143..247e31bd1c 100644 --- a/pandora_console/include/functions_tags.php +++ b/pandora_console/include/functions_tags.php @@ -511,6 +511,11 @@ function tags_update_policy_module_tag($id_policy_module, $tags, $autocommit=fal } } + if ($errn > 0) { + return false; + } else { + return true; + } } From 38711ca06749cd5bf230ec8649cc77aed683f9cb Mon Sep 17 00:00:00 2001 From: Calvo Date: Wed, 23 Jun 2021 15:13:19 +0200 Subject: [PATCH 22/73] Added icons colors_and_text and faces for server crashed status --- .../status_sets/color_text/server_crash.png | Bin 0 -> 1160 bytes .../images/status_sets/faces/server_crash.png | Bin 0 -> 1231 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 pandora_console/images/status_sets/color_text/server_crash.png create mode 100755 pandora_console/images/status_sets/faces/server_crash.png diff --git a/pandora_console/images/status_sets/color_text/server_crash.png b/pandora_console/images/status_sets/color_text/server_crash.png new file mode 100644 index 0000000000000000000000000000000000000000..43b0c50baa785c2383d226c797b4c219daa7a2fe GIT binary patch literal 1160 zcmV;31b6$1P)+wb?aZ0k=j^Mge_&;0ecvMSo3CG7yS%pULu>HC7(-1xqfS^47a$8b zXNY403^!Je%5#w`U3+@XNV; z$9B}!t*ck2_wK{}xxvv_uz7bqNljr9zKfFJ`^WbOt{KaCZg;o=Jqj&lOg^>IAUq5UX-KWsK%GsI$)7$XRqjq~4 zRp>6QpwR?Nn94wiZ{*43Bu>*+PP_`;M~JkmSJUC4yQ{D$>FZ9U5!MQ8hVllQ&HBk>UsoK2H+UL! z*?BnE8o4)lxapf|MF1(#Tdv5&jp{?apEX=RBHq6bTNV35clk2zbeixnY^OL8B zr>0TYISDAc+|zYU9k$rt?yUNaC?$&u1?b#0JD#4O&7e zqIHG|8jNd@j41WQwlhIDSQabOro`omm&`fGZD0We2+j(j(o~iGUf)-$$N`|TG*Uwd zjYxt|LP)&hA#gMYSR$1+6i8~QAgF5? z4jc#=b974(B2oq2mx&A@9z^7YEz1x|qJ*H-RXPO6 aIr|St0a!0WnD*-c0000Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01ejw01ejxLMWSf00007bV*G`2i*i3 z3M(APwvd_t00d7-L_t(I%e9nmXw_91$3N$s-~Ic$cXQ6^c6F|~W>FDyMPj2rb`v5= zLMq>=g)NaHGJ2QAFoTR(yZi6=@0?!j zDqf|c7e4TX!*d=!=Xsv<@W3rH@o$&?n@EcyU9v!%D3QQNU|~#@oQX3SQfzMffbRbV z-oKH7P~L7!t$GQ&xfPX+A}oXPG=8=~e)JgUzTSz6<_FuivFJa+{cmxPxNWL>OL;_^)vp{Ey%R8^|`Teluy`VdH0a zV}db+j39-=2m!`mw2#q65Or9wr^p}8@#j|`Pqpu$>MBRxSbl2x`lP)uj&pfC1Y<}U zMXDG=B~UVnR5nt@kSY#(0{7CV*ezjZFI|~D^a=wvf%`X+4(08(n#D_SuY7?tC4>ku zbPUqZoMm_fq?KU!sA1W2e=#%yLWB^)!=3zwn)~m?II*_luad3+%OYK=Rh{_mUbKH2 zP#`T140s&=qeORa0i_b`=_xRN-lw~_h>#XYiSaY&(m`gYmr>GmRe(jFws>r8LWL_Bj#!x5KIjdpO-?rv{iyjBrH2l;G6<9 zm;lhswcq3YcRQ(zd`J-Fm~HQ7%R61vMs`le7!BHBiep%I810e(u&(`FfDl4}SHJ*9 z_!#M7w2O1$4WtNTgv1z4SZ_lc2ctcV=Ytb~Q$k1s!StkE0}F*Qt`@?NV?+)u9klBr zWS$FGYS^)>$dA8fS-K?3>+2KLMJ6$>3q~Uxz(g^w2MSZ!iU_%2GK&;V;DB)*jO!pg z&G$bS89GuTpVyo`?eOKdSqcRYJP%49I3QIW?qn7jB3C&TVFvS~BUsV)=?omeF$ARo zL&qgkIq*EgR1QYZ2qwmTa5T6ee2}pg3THB?FoPA~m}K+0A9kT)i%~Qq3LpZ&Xqubv zqOq}_xv4Po=hxG`;BG9HgaGhCgy$e4Eu7!iM^v)80=)1exp;^x&oCIPD z3m!vRHUu6CmE-n0ho%`tsv;Jux*b{l2$u#;pcL>pC|zWh0zwJoME*41fOr&%f2$~5-@qS6*ul<1%%5F tM9b$;*)Pg6Wd(p&F1=KiTlU{N`y1py)7TXEUNZmy002ovPDHLkV1n~WDt7 Date: Wed, 23 Jun 2021 15:34:52 +0200 Subject: [PATCH 23/73] Fixed color --- pandora_console/include/styles/pandora.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 3b37291fe4..6350659aec 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -7208,7 +7208,7 @@ div.graph div.legend table { } .bg_82B92E { - background-color: #82b92e; + background-color: #82b92e !important; } .bg_B2B2B2 { @@ -7233,13 +7233,13 @@ div.graph div.legend table { background-color: #eee; } .bg_ffd { - background-color: #ffd036; + background-color: #ffd036 !important; } .bg_ff5 { - background-color: #ff5653; + background-color: #ff5653 !important; } .bg_ff9 { - background-color: #ff9e39; + background-color: #ff9e39 !important; } .bg_lightgray { background-color: lightgray; From fafcef7e854ec267cfddfc4bcd4a403a645eb3d8 Mon Sep 17 00:00:00 2001 From: marcos Date: Wed, 23 Jun 2021 17:35:16 +0200 Subject: [PATCH 24/73] se command sanpshot black theme --- pandora_console/operation/agentes/snapshot_view.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/snapshot_view.php b/pandora_console/operation/agentes/snapshot_view.php index 11bb4fcdd2..2308269532 100644 --- a/pandora_console/operation/agentes/snapshot_view.php +++ b/pandora_console/operation/agentes/snapshot_view.php @@ -79,13 +79,16 @@ if (!check_acl_one_of_groups($config['id_user'], $all_groups, 'AR')) { if ($refresh > 0) { $query = ui_get_url_refresh(false); echo ''; + if ($config['style'] === 'pandora_black') { + echo ''; + } } ?> <?php echo __('%s Snapshot data view for module (%s)', get_product_name(), $label); ?> - + "; echo __('Current data at %s', $last_timestamp); From 76d996a96650e70a5b60d2b041dcd41adbcfdaae Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 24 Jun 2021 12:51:14 +0200 Subject: [PATCH 25/73] Fixed tags in events --- pandora_console/include/functions_events.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index c1d7aeb404..acf0b8f0dc 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1151,7 +1151,12 @@ function events_get_all( $tags_names[$id_tag] = tags_get_name($id_tag); } - $_tmp .= ' AND ( '; + if ($tags[0] === $id_tag) { + $_tmp .= ' AND ( '; + } else { + $_tmp .= ' OR ( '; + } + $_tmp .= sprintf( ' tags LIKE "%s" OR', $tags_names[$id_tag] From fec01148017f4ddf47e87c7d847ad3c63be17423 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Thu, 24 Jun 2021 13:22:25 +0200 Subject: [PATCH 26/73] set urls as macros in console supervisor --- .../include/class/ConsoleSupervisor.php | 64 +++++++++---------- .../include/functions_messages.php | 2 +- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/pandora_console/include/class/ConsoleSupervisor.php b/pandora_console/include/class/ConsoleSupervisor.php index 84c30f8b8f..9ecf10ad34 100644 --- a/pandora_console/include/class/ConsoleSupervisor.php +++ b/pandora_console/include/class/ConsoleSupervisor.php @@ -808,7 +808,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.LICENSE.LIMITED', 'title' => __('Limited mode.'), 'message' => io_safe_output($config['limited_mode']), - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', ] ); } else { @@ -834,7 +834,7 @@ class ConsoleSupervisor $msg, $days_to_expiry ), - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', ] ); } else if ($days_to_expiry < 0) { @@ -852,7 +852,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.LICENSE.EXPIRATION', 'title' => $title, 'message' => $msg, - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/license'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/license', ] ); return false; @@ -929,7 +929,7 @@ class ConsoleSupervisor 'Directory %s is not writable. Please, configure corresponding permissions.', $config['attachment_store'] ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', ] ); return; @@ -951,7 +951,7 @@ class ConsoleSupervisor 'There are more than %d files in attachment, consider cleaning up attachment directory manually.', $config['num_files_attachment'] ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', ] ); } else { @@ -985,7 +985,7 @@ class ConsoleSupervisor 'Remote configuration directory %s is not readable. Please, adjust configuration.', $remote_config_dir ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', ] ); return; @@ -1004,7 +1004,7 @@ class ConsoleSupervisor 'Remote configuration directory %s is not writable. Please, adjust configuration.', $remote_config_dir.'/conf' ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', ] ); } else { @@ -1022,7 +1022,7 @@ class ConsoleSupervisor 'Collections directory %s is not writable. Please, adjust configuration.', $remote_config_dir.'/collections' ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', ] ); } else { @@ -1040,7 +1040,7 @@ class ConsoleSupervisor 'MD5 directory %s is not writable. Please, adjust configuration.', $remote_config_dir.'/md5' ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=general', ] ); } else { @@ -1071,7 +1071,7 @@ class ConsoleSupervisor $MAX_FILES_DATA_IN, $remote_config_dir ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', ] ); } else { @@ -1094,7 +1094,7 @@ class ConsoleSupervisor $MAX_BADXML_FILES_DATA_IN, $remote_config_dir ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', ] ); } else { @@ -1186,7 +1186,7 @@ class ConsoleSupervisor $modules_queued, $queue['queued_modules'] ), - 'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'), + 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', ] ); } else { @@ -1322,7 +1322,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.SERVER.STATUS.'.$server['id_server'], 'title' => $msg, 'message' => $description, - 'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60'), + 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/modificar_server&refr=60', ] ); } @@ -1634,7 +1634,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.HISTORYDB', 'title' => __('Historical database not available'), 'message' => __('Historical database is enabled, though not accessible with the current configuration.'), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', ] ); } else { @@ -1681,7 +1681,7 @@ class ConsoleSupervisor 'Your database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', io_safe_output(get_product_name()) ), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', ] ); } else { @@ -1741,7 +1741,7 @@ class ConsoleSupervisor 'Historical database maintenance problem.' ), 'message' => __('Your historical database hasn\'t been through maintenance for 48hrs. Please, check documentation on how to perform this maintenance process on %s and enable it as soon as possible.', get_product_name()), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=perf'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=perf', ] ); } else { @@ -1780,7 +1780,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.HISTORYDB.MR', 'title' => __('Historical database MR mismatch'), 'message' => __('Your historical database is not using the same schema as the main DB. This could produce anomalies while storing historical data.'), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=hist_db', ] ); } else { @@ -1821,7 +1821,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.EXT.ELASTICSEARCH', 'title' => __('Log collector cannot connect to ElasticSearch'), 'message' => __('ElasticSearch is not available using current configuration.'), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=log'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=log', ] ); } else { @@ -1891,7 +1891,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.METACONSOLE.DB_CONNECTION', 'title' => __('Metaconsole DB is not available.'), 'message' => __('Cannot connect with Metaconsole DB using current configuration.'), - 'url' => ui_get_full_url('index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise'), + 'url' => '__url__/index.php?sec=general&sec2=godmode/setup/setup§ion=enterprise', ] ); } @@ -1920,7 +1920,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.DOWNTIME', 'title' => __('Scheduled downtime running.'), 'message' => __('A scheduled downtime is running. Some monitoring data won\'t be available while downtime is taking place.'), - 'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'), + 'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list', ] ); return; @@ -2081,7 +2081,7 @@ class ConsoleSupervisor date('M j, G:i:s ', $next_downtime_begin), date('M j, G:i:s ', $next_downtime_end) ), - 'url' => ui_get_full_url('index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list'), + 'url' => '__url__/index.php?sec=gagente&sec2=godmode/agentes/planned_downtime.list', ] ); return; @@ -2142,7 +2142,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.SECURITY.DEFAULT_PASSWORD', 'title' => __('Default password for "Admin" user has not been changed'), 'message' => __('Please, change the default password since it is a commonly reported vulnerability.'), - 'url' => ui_get_full_url('index.php?sec=gusuarios&sec2=godmode/users/user_list'), + 'url' => '__url__/index.php?sec=gusuarios&sec2=godmode/users/user_list', ] ); } else { @@ -2178,7 +2178,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.MISC.FONTPATH', 'title' => __('Default font doesn\'t exist'), 'message' => __('Your defined font doesn\'t exist or is not defined. Please, check font parameters in your config'), - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=vis', ] ); } else { @@ -2205,7 +2205,7 @@ class ConsoleSupervisor 'Your %s has the "develop_bypass" mode enabled. This is a developer mode and should be disabled in a production environment. This value is located in the main index.php file', get_product_name() ), - 'url' => ui_get_full_url('index.php'), + 'url' => '__url__/index.php', ] ); } else { @@ -2228,7 +2228,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.MISC.EVENTSTORMPROTECTION', 'title' => __('Event storm protection is enabled.'), 'message' => __('Some events may get lost while this mode is enabled. The server must be restarted after altering this setting.'), - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general', ] ); } else { @@ -2255,7 +2255,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.UPDATEMANAGER.OPENSETUP', 'title' => __('Failed to retrieve updates, please configure utility'), 'message' => $message, - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/setup/setup§ion=general', ] ); } @@ -2275,7 +2275,7 @@ class ConsoleSupervisor get_product_name() ), 'message' => __('There is a new update available. Please go to Administration:Setup:Update Manager for more details.'), - 'url' => ui_get_full_url('index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online'), + 'url' => '__url__/index.php?sec=gsetup&sec2=godmode/update_manager/update_manager&tab=online', ] ); } else { @@ -2313,7 +2313,7 @@ class ConsoleSupervisor 'There is one or more minor releases available. .About minor release update.', $url ), - 'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'), + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', ] ); } else { @@ -2362,7 +2362,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.CRON.CONFIGURED', 'title' => __('DiscoveryConsoleTasks is not configured.'), 'message' => __($message_conf_cron), - 'url' => ui_get_full_url('index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist'), + 'url' => '__url__/index.php?sec=gservers&sec2=godmode/servers/discovery&wiz=tasklist', ] ); } else { @@ -2462,7 +2462,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.SERVER.MISALIGNED', 'title' => __($title_ver_misaligned), 'message' => __($message_ver_misaligned), - 'url' => ui_get_full_url('index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online'), + 'url' => '__url__/index.php?sec=messages&sec2=godmode/update_manager/update_manager&tab=online', ] ); } @@ -2507,7 +2507,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.ALLOWOVERRIDE.MESSAGE', 'title' => __('AllowOverride is disabled'), 'message' => __($message), - 'url' => ui_get_full_url('index.php'), + 'url' => '__url__/index.php', ] ); } @@ -2553,7 +2553,7 @@ class ConsoleSupervisor 'type' => 'NOTIF.HAMASTER.MESSAGE', 'title' => __('Desynchronized operation on the node '.$node['host']), 'message' => __($message), - 'url' => ui_get_full_url('index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster'), + 'url' => '__url__/index.php?sec=gservers&sec2=enterprise/godmode/servers/HA_cluster', ] ); } else { diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php index f929eb9ed1..a8a0b009bf 100644 --- a/pandora_console/include/functions_messages.php +++ b/pandora_console/include/functions_messages.php @@ -662,7 +662,7 @@ function messages_get_url($message_id) // Return URL stored if is set in database. if (isset($messages['url'])) { - return $messages['url']; + return str_replace('__url__', ui_get_full_url('/'), $messages['url']); } // Return the message direction. From 7fa398b027c7dbef560520339616bc8f82fdf1bb Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 28 Jun 2021 11:25:22 +0200 Subject: [PATCH 27/73] fixed font reference --- pandora_console/extras/mr/49.sql | 6 ++++++ pandora_console/include/functions_config.php | 4 ++-- pandora_console/pandoradb_data.sql | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 pandora_console/extras/mr/49.sql diff --git a/pandora_console/extras/mr/49.sql b/pandora_console/extras/mr/49.sql new file mode 100644 index 0000000000..a6c40dcb2b --- /dev/null +++ b/pandora_console/extras/mr/49.sql @@ -0,0 +1,6 @@ +START TRANSACTION; + +UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font'; +UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath'; + +COMMIT; \ No newline at end of file diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index 326b725e43..936cc5a9d1 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -2243,7 +2243,7 @@ function config_process_config() if (!isset($config['fontpath'])) { config_update_value( 'fontpath', - 'lato.ttf' + 'Lato-Regular.ttf' ); } @@ -3126,7 +3126,7 @@ function config_process_config() } if (!isset($config['custom_report_front_font'])) { - config_update_value('custom_report_front_font', 'lato.ttf'); + config_update_value('custom_report_front_font', 'Lato-Regular.ttf'); } if (!isset($config['custom_report_front_logo'])) { diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 9e5fefa497..e1c13b9b6b 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -105,7 +105,7 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES ('show_vc', 1), ('inventory_changes_blacklist', '1,2,20,21'), ('custom_report_front', 0), -('custom_report_front_font', 'lato.ttf'), +('custom_report_front_font', 'Lato-Regular.ttf'), ('custom_report_front_logo', 'images/pandora_logo_white.jpg'), ('custom_report_front_header', ''), ('custom_report_front_footer', ''), From 548c0c3013e1b8ece97b8915f895e3464e01df98 Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Mon, 28 Jun 2021 11:27:41 +0200 Subject: [PATCH 28/73] fixed font reference --- pandora_console/extras/mr/49.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extras/mr/49.sql b/pandora_console/extras/mr/49.sql index a6c40dcb2b..68de9070ed 100644 --- a/pandora_console/extras/mr/49.sql +++ b/pandora_console/extras/mr/49.sql @@ -3,4 +3,4 @@ START TRANSACTION; UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'custom_report_front_font'; UPDATE `tconfig` set value = 'Lato-Regular.ttf' WHERE token LIKE 'fontpath'; -COMMIT; \ No newline at end of file +COMMIT; From fb129750d56dcdebe4466a39538f7c6c8ef836ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Mon, 28 Jun 2021 12:03:25 +0200 Subject: [PATCH 29/73] Fixed issues with views in Netflow live view --- pandora_console/include/functions_netflow.php | 105 ++++++++++-------- .../include/graphs/functions_flot.php | 3 +- .../operation/netflow/nf_live_view.php | 37 +++--- 3 files changed, 77 insertions(+), 68 deletions(-) diff --git a/pandora_console/include/functions_netflow.php b/pandora_console/include/functions_netflow.php index cd31986a2a..8007c19077 100644 --- a/pandora_console/include/functions_netflow.php +++ b/pandora_console/include/functions_netflow.php @@ -600,7 +600,7 @@ function netflow_get_stats( global $config, $nfdump_date_format; // Requesting remote data. - if (defined('METACONSOLE') && $connection_name != '') { + if (is_metaconsole() === true && empty($connection_name) === false) { $data = metaconsole_call_remote_api($connection_name, 'netflow_get_stats', "$start_date|$end_date|".base64_encode(json_encode($filter))."|$aggregate|$max|$absolute|".(int) $address_resolution); return json_decode($data, true); } @@ -612,7 +612,7 @@ function netflow_get_stats( // Execute nfdump. exec($command, $string); - if (! is_array($string)) { + if (is_array($string) === false) { return []; } @@ -1062,7 +1062,7 @@ function netflow_draw_item( ) { $aggregate = $filter['aggregate']; $interval = ($end_date - $start_date); - if (defined('METACONSOLE')) { + if (is_metaconsole() === true) { $width = 950; } else { $width = 850; @@ -1084,12 +1084,13 @@ function netflow_draw_item( $connection_name, $address_resolution ); - if (empty($data)) { + + if (empty($data) === true) { break; } - if ($output == 'HTML' || $output == 'PDF') { - $html .= graph_netflow_aggregate_area( + if ($output === 'HTML' || $output === 'PDF') { + return graph_netflow_aggregate_area( $data, $interval, $width, @@ -1098,9 +1099,8 @@ function netflow_draw_item( ($output === 'HTML'), $end_date ); - return $html; - } else if ($output == 'XML') { - $xml .= ''.$aggregate."\n"; + } else if ($output === 'XML') { + $xml = ''.$aggregate."\n"; $xml .= ''.$interval_length."\n"; $xml .= netflow_aggregate_area_xml($data); return $xml; @@ -1119,18 +1119,19 @@ function netflow_draw_item( $connection_name, $address_resolution ); - if (empty($data)) { + + if (empty($data) === true) { break; } - if ($output == 'HTML' || $output == 'PDF') { - $html .= "
"; + if ($output === 'HTML' || $output === 'PDF') { + $html = "
"; $html .= netflow_data_table($data, $start_date, $end_date, $aggregate); $html .= '
'; return $html; - } else if ($output == 'XML') { - $xml .= ''.$aggregate."\n"; + } else if ($output === 'XML') { + $xml = ''.$aggregate."\n"; $xml .= ''.$interval_length."\n"; // Same as netflow_aggregate_area_xml. $xml .= netflow_aggregate_area_xml($data); @@ -1159,7 +1160,8 @@ function netflow_draw_item( $connection_name, $address_resolution ); - if (empty($data_pie)) { + + if (empty($data_pie) === true) { break; } @@ -1222,51 +1224,56 @@ function netflow_draw_item( $connection_name, $address_resolution ); - switch ($aggregate) { - case 'srcip': - case 'srcport': - $address_type = 'source_address'; - $port_type = 'source_port'; - $type = __('Sent'); - break; - default: - case 'dstip': - case 'dstport': - $address_type = 'destination_address'; - $port_type = 'destination_port'; - $type = __('Received'); - break; - } + if (empty($data_stats) === false) { + switch ($aggregate) { + case 'srcip': + case 'srcport': + $address_type = 'source_address'; + $port_type = 'source_port'; + $type = __('Sent'); + break; - $data_graph = [ - 'name' => __('Host detailed traffic').': '.$type, - 'children' => [], - ]; - $id = -1; + default: + case 'dstip': + case 'dstport': + $address_type = 'destination_address'; + $port_type = 'destination_port'; + $type = __('Received'); + break; + } - foreach ($data_stats as $sdata) { - $data_graph['children'][] = [ - 'id' => $i++, - 'name' => $sdata['agg'], - 'children' => [ - [ - 'id' => $i++, - 'name' => $sdata['agg'], - 'value' => $sdata['data'], - 'tooltip_content' => network_format_bytes($sdata['data']), - ], - ], + $data_graph = [ + 'name' => __('Host detailed traffic').': '.$type, + 'children' => [], ]; + $id = -1; + + foreach ($data_stats as $sdata) { + $data_graph['children'][] = [ + 'id' => $id++, + 'name' => $sdata['agg'], + 'children' => [ + [ + 'id' => $id++, + 'name' => $sdata['agg'], + 'value' => $sdata['data'], + 'tooltip_content' => network_format_bytes($sdata['data']), + ], + ], + ]; + } + + return graph_netflow_host_traffic($data_graph, 'auto', 400); } - return graph_netflow_host_traffic($data_graph, 'auto', 400); + break; default: // Nothing to do. break; } - if ($output == 'HTML' || $output == 'PDF') { + if ($output === 'HTML' || $output === 'PDF') { return graph_nodata_image(300, 110, 'data'); } } diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index eabaa8c6b9..080c941049 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -763,7 +763,8 @@ function flot_slicesbar_graph( $height = ((int) $height + 15); $style = 'width:'.$width.'%;'; - $style .= 'height:'.$height.'px;'; + // Fixed height size. + $style .= 'height: 100%;'; $return = "
"; $return .= "
"; diff --git a/pandora_console/operation/netflow/nf_live_view.php b/pandora_console/operation/netflow/nf_live_view.php index a27686f8a7..dcc9e4065e 100644 --- a/pandora_console/operation/netflow/nf_live_view.php +++ b/pandora_console/operation/netflow/nf_live_view.php @@ -352,12 +352,12 @@ if (is_metaconsole()) { $filter_type = 0; } - echo ""; + echo ""; echo "".ui_print_error_message('Define a name for the filter and click on Save as new filter again', '', true).''; echo ''; - echo ""; + echo ""; echo ''.__('Name').''; echo "".html_print_input_text( @@ -373,7 +373,7 @@ if (is_metaconsole()) { echo "".html_print_select_groups($config['id_user'], 'AR', $own_info['is_admin'], 'assign_group', $filter['id_group'], '', '', -1, true, false, false).''; echo ''; - $advanced_toggle = ''; + $advanced_toggle = '
'; $advanced_toggle .= ''; if ($netflow_disable_custom_lvfilters) { @@ -381,7 +381,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; } else { $advanced_toggle .= ''; - $advanced_toggle .= ''; + $advanced_toggle .= ''; } @@ -403,7 +403,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "'; + $advanced_toggle .= "'; $advanced_toggle .= ''; } @@ -411,7 +411,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "'; + $advanced_toggle .= "'; $advanced_toggle .= ''; } @@ -422,7 +422,7 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "'; + $advanced_toggle .= "'; $advanced_toggle .= ''; } @@ -430,19 +430,19 @@ if (is_metaconsole()) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { - $advanced_toggle .= "'; + $advanced_toggle .= "'; $advanced_toggle .= ''; } $advanced_toggle .= ''; - $advanced_toggle .= ""; + $advanced_toggle .= ""; if ($netflow_disable_custom_lvfilters) { $advanced_toggle .= ''; $advanced_toggle .= ''; } else { $advanced_toggle .= ''; - $advanced_toggle .= "'; + $advanced_toggle .= "'; } $advanced_toggle .= ''; @@ -490,14 +490,14 @@ if (is_metaconsole()) { echo ''; echo '
'.__('Filter').''.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'class="mrgn_right_40px"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'class="mrgn_right_40px"', true).''.__('Normal').' '.html_print_radio_button_extended('filter_type', 0, '', $filter_type, false, 'displayNormalFilter();', 'style="margin-right: 40px;"', true).__('Custom').' '.html_print_radio_button_extended('filter_type', 1, '', $filter_type, false, 'displayAdvancedFilter();', 'style="margin-right: 40px;"', true).'".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:
25.46.157.214,160.253.135.249'), true).'
".__('Dst Ip').ui_print_help_tip(__('Destination IP. A comma separated list of destination ip. If we leave the field blank, will show all ip. Example filter by ip:
25.46.157.214,160.253.135.249'), true).'
'.html_print_input_text('ip_dst', $filter['ip_dst'], false, 40, 80, true).'".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:
25.46.157.214,160.253.135.249'), true).'
".__('Src Ip').ui_print_help_tip(__('Source IP. A comma separated list of source ip. If we leave the field blank, will show all ip. Example filter by ip:
25.46.157.214,160.253.135.249'), true).'
'.html_print_input_text('ip_src', $filter['ip_src'], false, 40, 80, true).'".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:
80,22'), true).'
".__('Dst Port').ui_print_help_tip(__('Destination port. A comma separated list of destination ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:
80,22'), true).'
'.html_print_input_text('dst_port', $filter['dst_port'], false, 40, 80, true).'".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:
80,22'), true).'
".__('Src Port').ui_print_help_tip(__('Source port. A comma separated list of source ports. If we leave the field blank, will show all ports. Example filter by ports 80 and 22:
80,22'), true).'
'.html_print_input_text('src_port', $filter['src_port'], false, 40, 80, true).'
'; - echo "
"; + echo "
"; echo html_print_submit_button(__('Draw'), 'draw_button', false, 'class="sub upd"', true); if (!$netflow_disable_custom_lvfilters) { if (check_acl($config['id_user'], 0, 'AW')) { - html_print_submit_button(__('Save as new filter'), 'save_button', false, ' class="sub upd mrgn_lft_5px" onClick="return defineFilterName();"'); - html_print_submit_button(__('Update current filter'), 'update_button', false, 'class="sub upd mrgn_lft_5px"'); + html_print_submit_button(__('Save as new filter'), 'save_button', false, 'style="margin-left: 5px;" class="sub upd" onClick="return defineFilterName();"'); + html_print_submit_button(__('Update current filter'), 'update_button', false, 'style="margin-left: 5px;" class="sub upd"'); } } @@ -670,11 +670,12 @@ if (is_metaconsole()) { // Check right filter type $("#radiobtn0002").attr("checked", "checked"); } - }); - + } // Get filter values from DB // Shows update filter button $("#submit-update_button").show(); From a225bbdafcc8bd91a7d854b54bb7d95416e26b53 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 28 Jun 2021 14:21:45 +0200 Subject: [PATCH 30/73] fixed minnor error when show event comment with filters --- pandora_console/include/ajax/events.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index b49a884832..81c440c809 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1599,7 +1599,6 @@ if ($get_extended_event) { page: "include/ajax/events", get_comments: 1, event: '.json_encode($event).', - filter: '.json_encode($filter).' }, dataType : "html", success: function (data) { From 1d468987d3406eececd83242766633c00e7358b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Tue, 29 Jun 2021 14:55:03 +0200 Subject: [PATCH 31/73] Added parameter onclick in anchors --- pandora_console/include/functions_html.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 6eabde142f..c05477ad06 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -2365,12 +2365,13 @@ function html_print_div( /** * Render an anchor html element. * - * @param array $options Parameters + * @param array $options Parameters. * - id: string. * - style: string. * - title: string. * - href: string. * - content: string. + * - onClick: string. * @param boolean $return Return or echo flag. * * @return string HTML code if return parameter is true. @@ -2387,6 +2388,7 @@ function html_print_anchor( 'style', 'class', 'title', + 'onClick', ]; $output .= (isset($options['href']) === true) ? 'href="'.io_safe_input_html($options['href']).'"' : ui_get_full_url(); From a88a131152e357881711f9de0fee3f5af5e1e2ca Mon Sep 17 00:00:00 2001 From: "alejandro.campos@artica.es" Date: Thu, 1 Jul 2021 15:07:52 +0200 Subject: [PATCH 32/73] fixed top n widgets in meta --- .../include/lib/Dashboard/Widgets/top_n.php | 30 ++++++++++++++++--- .../Widgets/top_n_events_by_group.php | 23 ++++++++++---- .../Widgets/top_n_events_by_module.php | 8 +++-- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n.php b/pandora_console/include/lib/Dashboard/Widgets/top_n.php index 599bef0b0b..1125ca41ab 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n.php @@ -414,10 +414,32 @@ class TopNWidget extends Widget $quantity ); - $modules = @db_get_all_rows_sql( - $sql, - $search_in_history_db - ); + if (is_metaconsole() === true) { + $servers = metaconsole_get_servers(); + + $modules = []; + + foreach ($servers as $server) { + if (metaconsole_connect(null, $server['id']) !== NOERR) { + continue; + } + + $modules = array_merge( + $modules, + @db_get_all_rows_sql( + $sql, + $search_in_history_db + ) + ); + + metaconsole_restore_db(); + } + } else { + $modules = @db_get_all_rows_sql( + $sql, + $search_in_history_db + ); + } if (empty($modules) === true) { $output .= '
'; diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php index aa4f64ca79..42cd059dc5 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_group.php @@ -367,6 +367,8 @@ class TopNEventByGroupWidget extends Widget $this->values['groupId'] = explode(',', $this->values['groupId'][0]); + $event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento'; + if (empty($this->values['groupId']) === true) { $output .= '
'; $output .= \ui_print_info_message( @@ -388,12 +390,13 @@ class TopNEventByGroupWidget extends Widget if ($all_group === false) { $sql = sprintf( 'SELECT id_agente, COUNT(*) AS count - FROM tevento + FROM %s WHERE utimestamp >= %d AND id_grupo IN (%s) GROUP BY id_agente ORDER BY count DESC LIMIT %d', + $event_table, $timestamp, implode(',', $this->values['groupId']), $this->values['amountShow'] @@ -401,11 +404,12 @@ class TopNEventByGroupWidget extends Widget } else { $sql = sprintf( 'SELECT id_agente, COUNT(*) AS count - FROM tevento + FROM %s WHERE utimestamp >= %d GROUP BY id_agente ORDER BY count DESC LIMIT %d', + $event_table, $timestamp, $this->values['amountShow'] ); @@ -428,9 +432,18 @@ class TopNEventByGroupWidget extends Widget if ($row['id_agente'] == 0) { $name = __('System'); } else { - $name = io_safe_output( - agents_get_alias($row['id_agente']) - ); + if (is_metaconsole() === true) { + $name = (string) db_get_value( + 'alias', + 'tmetaconsole_agent', + 'id_tagente', + (int) $row['id_agente'] + ); + } else { + $name = io_safe_output( + agents_get_alias($row['id_agente']) + ); + } } $name .= ' ('.$row['count'].')'; diff --git a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php index f110c4ea52..0d413d219c 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/top_n_events_by_module.php @@ -365,6 +365,8 @@ class TopNEventByModuleWidget extends Widget $this->values['groupId'] = explode(',', $this->values['groupId'][0]); + $event_table = (is_metaconsole() === true) ? 'tmetaconsole_event' : 'tevento'; + if (empty($this->values['groupId']) === true) { $output = '
'; $output .= \ui_print_info_message( @@ -389,12 +391,13 @@ class TopNEventByModuleWidget extends Widget id_agentmodule, event_type, COUNT(*) AS count - FROM tevento + FROM %s WHERE utimestamp >= %d AND id_grupo IN (%s) GROUP BY id_agentmodule, event_type ORDER BY count DESC LIMIT %d', + $event_table, $timestamp, implode(',', $this->values['groupId']), $this->values['amountShow'] @@ -405,11 +408,12 @@ class TopNEventByModuleWidget extends Widget id_agentmodule, event_type, COUNT(*) AS count - FROM tevento + FROM %s WHERE utimestamp >= %d GROUP BY id_agentmodule, event_type ORDER BY count DESC LIMIT %d', + $event_table, $timestamp, $this->values['amountShow'] ); From 4100d541cf0627594e6f01de07a9f8dcac35d312 Mon Sep 17 00:00:00 2001 From: marcos Date: Thu, 1 Jul 2021 17:28:12 +0200 Subject: [PATCH 33/73] fixed error with name on agent module view --- .../lib/Dashboard/Widgets/agent_module.php | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php index 618e1c0537..a0a33734ae 100644 --- a/pandora_console/include/lib/Dashboard/Widgets/agent_module.php +++ b/pandora_console/include/lib/Dashboard/Widgets/agent_module.php @@ -315,9 +315,9 @@ class AgentModuleWidget extends Widget function ($carry, $item) { $d = explode('|', $item); if (isset($d[1]) === true) { - $carry[] = $d[1]; + $carry[] = \io_safe_output($d[1]); } else { - $carry[] = $item; + $carry[] = \io_safe_output($item); } return $carry; @@ -424,7 +424,7 @@ class AgentModuleWidget extends Widget foreach ($allModules as $module_name) { $file_name = ui_print_truncate_text( - $module_name, + \io_safe_output($module_name), 'module_small', false, true, @@ -466,7 +466,7 @@ class AgentModuleWidget extends Widget } $file_name = \ui_print_truncate_text( - $row['agent_alias'], + \io_safe_output($row['agent_alias']), 'agent_small', false, true, @@ -636,13 +636,13 @@ class AgentModuleWidget extends Widget } // Extract info all modules selected. - $target_modules = explode( - self::MODULE_SEPARATOR, - $this->values['mModules'] - ); - if (is_metaconsole() === true - && $this->values['mShowCommonModules'] === '0' - ) { + $target_modules = $this->values['mModules']; + if (is_metaconsole() === true) { + $target_modules = explode( + self::MODULE_SEPARATOR, + $this->values['mModules'] + ); + $all_modules = $target_modules; } else { $all_modules = Module::search( @@ -661,7 +661,12 @@ class AgentModuleWidget extends Widget if (is_object($item) === true) { $carry[$item->name()] = null; } else { - $carry[$item] = null; + if ((is_metaconsole() === true + && $this->values['mShowCommonModules'] !== '1') + || is_metaconsole() === false + ) { + $carry[$item] = null; + } } return $carry; @@ -699,9 +704,19 @@ class AgentModuleWidget extends Widget if (is_metaconsole() === true && $this->values['mShowCommonModules'] === '1' ) { + // MC should connect to nodes and retrieve information + // from targets. $modules = $agent->searchModules( ['id_agente_modulo' => $target_modules] ); + + foreach ($modules as $module) { + if ($module === null) { + $reduceAllModules[] = null; + } else { + $reduceAllModules[$module->name()] = null; + } + } } else { $modules = $agent->searchModules( ['nombre' => array_keys($reduceAllModules)] @@ -714,10 +729,6 @@ class AgentModuleWidget extends Widget continue; } - if ((bool) is_metaconsole() === true) { - $reduceAllModules[$module->name()] = null; - } - $visualData[$agent_id]['modules'][$module->name()] = $module->getStatus()->estado(); } @@ -729,7 +740,6 @@ class AgentModuleWidget extends Widget } } - ksort($reduceAllModules); $allModules = array_keys($reduceAllModules); if ($allModules === null) { $allModules = []; From 498a353a29eb9e42c27da017197318afe89529b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Fri, 2 Jul 2021 12:20:53 +0200 Subject: [PATCH 34/73] Improve code for get secondary groups --- pandora_console/godmode/agentes/agent_manager.php | 5 ++++- pandora_console/include/functions_events.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 8e314f0293..f34fb3e15d 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -500,7 +500,10 @@ if (enterprise_installed()) { false, // Delete_groups. // Do not show the primary group in this selection. - array_merge(($secondary_groups_selected['plain'] ?? []), [$agent['id_grupo']]) + array_merge( + (empty($secondary_groups_selected['plain']) === false) ? $secondary_groups_selected['plain'] : [], + [$agent['id_grupo']] + ) // Include_groups. // Size. // Simple_multiple_options. diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index c1d7aeb404..0d8d4183e9 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -4843,7 +4843,7 @@ function events_page_general($event) if (isset($event['id_agente']) && $event['id_agente'] > 0) { enterprise_include_once('include/functions_agents.php'); $secondary_groups_selected = enterprise_hook('agents_get_secondary_groups', [$event['id_agente'], is_metaconsole()]); - if (!empty($secondary_groups_selected)) { + if (empty($secondary_groups_selected['for_select']) === false) { $secondary_groups = implode(', ', $secondary_groups_selected['for_select']); } } From a9075463ac7346c167e91ddf0eedca566892e39e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Gonz=C3=A1lez?= Date: Fri, 2 Jul 2021 13:48:59 +0200 Subject: [PATCH 35/73] Missed change --- pandora_console/operation/agentes/estado_generalagente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index f2b69d5b56..702159bf14 100755 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -395,7 +395,7 @@ $table_contact->data[] = $data; $data = []; $data[0] = ''.__('Secondary groups').''; $secondary_groups = enterprise_hook('agents_get_secondary_groups', [$id_agente]); -if (!$secondary_groups) { +if (empty($secondary_groups['for_select']) === true) { $data[1] = ''.__('N/A').''; } else { $secondary_links = []; From ea57c58f40bae722da8533efe0f1ee5c70f11f06 Mon Sep 17 00:00:00 2001 From: marcos Date: Mon, 5 Jul 2021 11:34:32 +0200 Subject: [PATCH 36/73] set default font size on graph modules when is send in mails --- pandora_console/godmode/alerts/alert_list.list.php | 2 +- pandora_console/include/ajax/alert_list.ajax.php | 2 +- pandora_console/include/functions_api.php | 4 ++++ pandora_console/include/functions_graph.php | 6 +++++- pandora_console/include/styles/pandora_black.css | 4 +++- pandora_server/lib/PandoraFMS/Core.pm | 4 ++-- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 399bb55cfd..7025433316 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -708,7 +708,7 @@ foreach ($simple_alerts as $alert) { $data[3] .= '