From a85a7eccf8c212f854dd9af6cc1cf561aa7b3dc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Sun, 4 Jun 2023 10:34:33 -0600 Subject: [PATCH 1/3] Modifications to accept spaces in agent alias CLI --- pandora_server/util/pandora_manage.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 07c7bf6ad1..b11e862790 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5389,6 +5389,8 @@ sub cli_get_agents_id_name_by_alias() { my @agents; my $where_value; + $agent_alias =~ s/ / /g; + if($strict eq 'strict') { $where_value = $agent_alias; } else { @@ -5404,14 +5406,14 @@ sub cli_get_agents_id_name_by_alias() { print "[ERROR] No agents retrieved.\n\n"; } else { if(is_metaconsole($conf) == 1) { - print "alias, id_agente, id_tagente, id_server, server_name\n"; + print "id_agente, alias, id_tagente, id_server, server_name\n"; foreach my $agent (@agents) { - print safe_output($agent->{'alias'}).", ".$agent->{'id_agente'}.", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n"; + print safe_output($agent->{'id_agente'}).", ".$agent->{'alias'}.", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n"; } } else { - print "alias, id_agente\n"; + print "id_agente, alias\n"; foreach my $agent (@agents) { print $agent->{'id_agente'}.",".safe_output($agent->{'alias'})."\n"; From b7a6c8f7301eea6145e1a1eef2094493ed512dcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Mon, 5 Jun 2023 08:41:10 -0600 Subject: [PATCH 2/3] Validate entities with safe input. --- pandora_server/util/pandora_manage.pl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index b11e862790..a7cc0af873 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5384,13 +5384,11 @@ sub cli_get_agent_status() { ############################################################################## sub cli_get_agents_id_name_by_alias() { - my $agent_alias = @ARGV[2]; + my $agent_alias = safe_input(@ARGV[2]); my $strict = @ARGV[3]; my @agents; my $where_value; - $agent_alias =~ s/ / /g; - if($strict eq 'strict') { $where_value = $agent_alias; } else { From 9873e3c4d42522ddcf11b5089fa89ce53e2ae83d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Su=C3=A1rez?= Date: Mon, 12 Feb 2024 10:24:35 -0600 Subject: [PATCH 3/3] Change safe_output to Meta Agent name --- pandora_server/util/pandora_manage.pl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index a7cc0af873..21961c72ab 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5407,8 +5407,7 @@ sub cli_get_agents_id_name_by_alias() { print "id_agente, alias, id_tagente, id_server, server_name\n"; foreach my $agent (@agents) { - - print safe_output($agent->{'id_agente'}).", ".$agent->{'alias'}.", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n"; + print $agent->{'id_agente'}.", ".safe_output($agent->{'alias'}).", ".$agent->{'id_tagente'}.", ".$agent->{'id_server'}.", ".$agent->{'server_name'}."\n"; } } else { print "id_agente, alias\n";