diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index e1a0b8f0f0..4682564973 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.754-210519 +Version: 7.0NG.754-210520 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index efd6b0843f..6bac49e622 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.754-210519" +pandora_version="7.0NG.754-210520" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 3533c3390c..72382dc598 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -1015,7 +1015,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.754'; -use constant AGENT_BUILD => '210519'; +use constant AGENT_BUILD => '210520'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index e130e6f231..e88db2c983 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.754 -%define release 210519 +%define release 210520 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index cf96d6d051..a6c30e9ebf 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0NG.754 -%define release 210519 +%define release 210520 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 6cefdd0081..90311e3ea7 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.754" -PI_BUILD="210519" +PI_BUILD="210520" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/unix/pandora_revent b/pandora_agents/unix/pandora_revent index 3af581decb..5f1bc8c3bd 100755 --- a/pandora_agents/unix/pandora_revent +++ b/pandora_agents/unix/pandora_revent @@ -3,7 +3,7 @@ ######################################################################## # Pandora FMS - Remote Event Tool (via WEB API) ######################################################################## -# Copyright (c) 2013 Artica Soluciones Tecnologicas S.L +# Copyright (c) 2021 Artica Soluciones Tecnologicas S.L # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 2 @@ -12,6 +12,7 @@ # Includes list use strict; use LWP::Simple; +use LWP::UserAgent; use MIME::Base64; use lib '/usr/lib/perl5'; use PandoraFMS::Tools; @@ -32,40 +33,41 @@ sub help_screen{ \t$0 -p -u -create_event Where options:\n - -u : API credentials separated by comma: ,, - -name : Free text - -group : Group ID (use 0 for 'all') - -agent : Agent ID + -u : API credentials separated by comma: ,, + -name : Free text (surrounded by single-quotes, for security reasons) + -group : Group ID (use 0 for 'all') Optional parameters: - - [-status ] : 0 New, 1 Validated, 2 In process - [-user ] : User comment (use in combination with -comment option) - [-type ] : unknown, alert_fired, alert_recovered, alert_ceased + + [-agent ] : 0 New, 1 Validated, 2 In process + [-user ] : User comment (use in combination with -comment option) + [-type ] : unknown, alert_fired, alert_recovered, alert_ceased alert_manual_validation, system, error, new_agent configuration_change, going_unknown, going_down_critical, going_down_warning, going_up_normal - [-severity ] : 0 Maintance, + [-severity ] : 0 Maintance, 1 Informative, 2 Normal, 3 Warning, 4 Crit, 5 Minor, 6 Major - [-am ] : ID Agent Module linked to event - [-alert ] : ID Alert Module linked to event + [-am ] : ID Agent Module linked to event + [-alert ] : ID Alert Module linked to event [-c_instructions ] [-w_instructions ] [-u_instructions ] - [-user_comment ] - [-owner_user ] : Use the login name, not the descriptive - [-source ] : (By default 'Pandora') - [-tag ] : Tag (must exist in the system to be imported) + [-user_comment ] : Free text (surrounded by single-quotes, for security reasons) + [-owner_user ] : Use the login name, not the descriptive + [-source ] : (By default 'Pandora') + [-tag ] : Tag (must exist in the system to be imported) [-custom_data ]: Custom data has to be in JSON format. Example: -custom_data \'{\"test1\" : \"t1\", \"test2\": \"2\"}\' - [-id_extra ] : Id extra - [-agent_name ] : Agent name, Not to be confused with the alias. - [-force_create_agent<0 o 1>]: Force the creation of agent through an event this will create when it is 1. - [-server_id ] : The pandora node server_id\n\n"; + [-id_extra ] : Id extra + [-agent_name ] : Agent name, Not to be confused with the alias. + [-force_create_agent<0 o 1>] : Force the creation of agent through an event this will create when it is 1. + [-separator ''] : If you use the vertical bar `|` in the event name, you must set other character for send the info. This must be surrounded by single-quotes + [-server_id ] : The pandora node server_id\n\n"; print "Example of event generation:\n\n"; @@ -88,7 +90,7 @@ Optional parameters: ############################################################################## sub tool_api_init () { - print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2015 Artica ST\n"; + print "\nPandora FMS Remote Event Tool Copyright (c) 2013-2021 Artica ST\n"; print "This program is Free Software, licensed under the terms of GPL License v2\n"; print "You can download latest versions and documentation at http://www.pandorafms.org\n\n"; @@ -120,7 +122,7 @@ sub tool_api_main () { my $db_user; my $db_pass; my @db_info; - my $id_agent; + my $id_agent = '0'; my $id_user = ''; my $status = ''; my $id_agent_module = ''; @@ -141,6 +143,7 @@ sub tool_api_main () { my $call_api; my $custom_data = ""; my $server_id = 0; + my $separator = '|'; #~ help or api path (required) if ($ARGV[0] eq '-h') { @@ -185,12 +188,18 @@ sub tool_api_main () { if ($line eq '-agent') { $id_agent = $ARGV[$i + 1]; + # If not defined, send 0 for API. + if ($id_agent eq undef) { + $id_agent = '0'; + } + } if ($line eq '-group') { $id_group = $ARGV[$i + 1]; } if ($line eq '-name') { $event_name = $ARGV[$i + 1]; + $event_name =~ s/#/%23/g; } if ($line eq '-type') { $event_type = $ARGV[$i + 1]; @@ -250,50 +259,49 @@ sub tool_api_main () { if ($line eq '-server_id') { $server_id = $ARGV[$i + 1]; } + if ($line eq '-separator') { + $separator = $ARGV[$i + 1]; + } $i++; } if ($event_name eq "") { - print "[ERROR] Missing id agent! Read help info:\n\n"; + print "[ERROR] Missing event name! Read help info:\n\n"; help_screen (); } if ($id_group eq "") { print "[ERROR] Missing event group! Read help info:\n\n"; help_screen (); } - if ($id_agent eq "" && $agent_name eq "") { - print "[ERROR] Missing id agent! and agent_name Read help info:\n\n"; - help_screen (); - } $data_event = $event_name . - "|" . $id_group . - "|" . $id_agent . - "|" . $status . - "|" . $id_user . - "|" . $event_type . - "|" . $severity . - "|" . $id_agent_module . - "|" . $id_alert_am . - "|" . $critical_instructions . - "|" . $warning_instructions . - "|" . $unknown_instructions . - "|" . $user_comment . - "|" . $owner_user . - "|" . $source . - "|" . $tags . - "|" . $custom_data . - "|" . $server_id . - "|" . $id_extra . - "|" . $agent_name . - "|" . $force_create_agent; + $separator . $id_group . + $separator . $id_agent . + $separator . $status . + $separator . $id_user . + $separator . $event_type . + $separator . $severity . + $separator . $id_agent_module . + $separator . $id_alert_am . + $separator . $critical_instructions . + $separator . $warning_instructions . + $separator . $unknown_instructions . + $separator . $user_comment . + $separator . $owner_user . + $separator . $source . + $separator . $tags . + $separator . $custom_data . + $separator . $server_id . + $separator . $id_extra . + $separator . $agent_name . + $separator . $force_create_agent; $call_api = $api_path . '?' . 'op=set&' . 'op2=create_event&' . 'other=' . $data_event .'&' . - 'other_mode=url_encode_separator_|&' . + 'other_mode=url_encode_separator_'.$separator.'&' . 'apipass=' . $api_pass . '&' . 'user=' . $db_user . '&' . 'pass=' . $db_pass; @@ -321,7 +329,8 @@ sub tool_api_main () { exit; } else { - my $content = get($call_api); + my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); + my $content = $ua->get($call_api); if ($option eq '-create_event') { if ($content eq undef) { @@ -329,7 +338,7 @@ sub tool_api_main () { help_screen(); } else { - print "Event ID: $content"; + print "Event ID: $content->{'_content'}"; } } elsif ($option eq '-validate_event') { diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 6bfd7d14ad..27438b39e6 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{210519} +{210520} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 3ea9f99f4d..8175c802aa 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0NG.754 Build 210519") +#define PANDORA_VERSION ("7.0NG.754 Build 210520") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index bf76b70e96..0e749e22e7 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0NG.754(Build 210519))" + VALUE "ProductVersion", "(7.0NG.754(Build 210520))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 738ec03949..091b98c419 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.754-210519 +Version: 7.0NG.754-210520 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 6a5939f5ff..4651f3ec75 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0NG.754-210519" +pandora_version="7.0NG.754-210520" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/class/HTML.class.php b/pandora_console/include/class/HTML.class.php index d55aebb924..d5bf6dfc97 100644 --- a/pandora_console/include/class/HTML.class.php +++ b/pandora_console/include/class/HTML.class.php @@ -867,6 +867,7 @@ class HTML } $output .= '
    '.$output_submit.'
'; + $output .= html_print_csrf_hidden(true); $output .= ''; $output .= ''; if ($rawjs) { @@ -1002,6 +1003,7 @@ class HTML $output .= ''; $output .= '
    '.$output_submit.'
'; + $output .= html_print_csrf_hidden(true); $output .= ''; $output .= ''; if ($rawjs) { @@ -1073,6 +1075,7 @@ class HTML $output .= ''; $output .= '
    '.$output_submit.'
'; + $output .= html_print_csrf_hidden(true); $output .= ''; $output .= ''; if ($rawjs) { diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index e47c495d7c..fc5a4f76f6 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC210519'; +$build_version = 'PC210520'; $pandora_version = 'v7.0NG.754'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index 13bb5fdc44..b4210c66c9 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -13043,8 +13043,10 @@ function api_set_create_event($id, $trash1, $other, $returnType) $error_msg = ''; if ($other['data'][2] != '') { + // Id agent assignment. If come from pandora_revent, id_agent can be 0. $id_agent = $other['data'][2]; - if (is_metaconsole()) { + // To the next if is metaconsole and id_agent is not none. + if (is_metaconsole() === true && $id_agent > 0) { // On metaconsole, connect with the node to check the permissions if (empty($values['server_id'])) { $agent_cache = db_get_row('tmetaconsole_agent', 'id_tagente', $id_agent); @@ -13067,7 +13069,7 @@ function api_set_create_event($id, $trash1, $other, $returnType) $values['id_agente'] = $id_agent; - if (!util_api_check_agent_and_print_error($id_agent, 'string', 'AR')) { + if ((int) $id_agent > 0 && util_api_check_agent_and_print_error($id_agent, 'string', 'AR') === false) { if (is_metaconsole()) { metaconsole_restore_db(); } diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 11298f6062..d934c7815d 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -4306,10 +4306,14 @@ function html_print_sort_arrows($params, $order_tag, $up='up', $down='down') /** * Print an input hidden with a new csrf token generated + * + * @param boolean $return If it is true return a string with the output instead to echo the output. + * + * @return void */ -function html_print_csrf_hidden() +function html_print_csrf_hidden(bool $return=false) { - html_print_input_hidden('csrf_code', generate_csrf_code()); + return html_print_input_hidden('csrf_code', generate_csrf_code(), $return); } diff --git a/pandora_console/install.php b/pandora_console/install.php index de55a2ba1b..d865cda708 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 2a3c618def..5d307561e4 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.754 -%define release 210519 +%define release 210520 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 2ff4ae4f33..7d8268e665 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.754 -%define release 210519 +%define release 210520 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index bd4a797870..e6c50b6d55 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.754" -PI_BUILD="210519" +PI_BUILD="210520" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 47a5f16a84..19bb22f7ec 100755 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -35,7 +35,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.754 Build 210519"; +my $version = "7.0NG.754 Build 210520"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 37ad807aaa..77deeb82fb 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.754 Build 210519"; +my $version = "7.0NG.754 Build 210520"; # save program name for logging my $progname = basename($0); diff --git a/pandora_server/util/pandora_revent.pl b/pandora_server/util/pandora_revent.pl index 5a517ffe40..5f1bc8c3bd 100755 --- a/pandora_server/util/pandora_revent.pl +++ b/pandora_server/util/pandora_revent.pl @@ -3,7 +3,7 @@ ######################################################################## # Pandora FMS - Remote Event Tool (via WEB API) ######################################################################## -# Copyright (c) 2013-2021 Artica Soluciones Tecnologicas S.L +# Copyright (c) 2021 Artica Soluciones Tecnologicas S.L # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License version 2 @@ -12,6 +12,7 @@ # Includes list use strict; use LWP::Simple; +use LWP::UserAgent; use MIME::Base64; use lib '/usr/lib/perl5'; use PandoraFMS::Tools; @@ -32,40 +33,41 @@ sub help_screen{ \t$0 -p -u -create_event Where options:\n - -u : API credentials separated by comma: ,, - -name : Free text - -group : Group ID (use 0 for 'all') - -agent : Agent ID + -u : API credentials separated by comma: ,, + -name : Free text (surrounded by single-quotes, for security reasons) + -group : Group ID (use 0 for 'all') Optional parameters: - - [-status ] : 0 New, 1 Validated, 2 In process - [-user ] : User comment (use in combination with -comment option) - [-type ] : unknown, alert_fired, alert_recovered, alert_ceased + + [-agent ] : 0 New, 1 Validated, 2 In process + [-user ] : User comment (use in combination with -comment option) + [-type ] : unknown, alert_fired, alert_recovered, alert_ceased alert_manual_validation, system, error, new_agent configuration_change, going_unknown, going_down_critical, going_down_warning, going_up_normal - [-severity ] : 0 Maintance, + [-severity ] : 0 Maintance, 1 Informative, 2 Normal, 3 Warning, 4 Crit, 5 Minor, 6 Major - [-am ] : ID Agent Module linked to event - [-alert ] : ID Alert Module linked to event + [-am ] : ID Agent Module linked to event + [-alert ] : ID Alert Module linked to event [-c_instructions ] [-w_instructions ] [-u_instructions ] - [-user_comment ] - [-owner_user ] : Use the login name, not the descriptive - [-source ] : (By default 'Pandora') - [-tag ] : Tag (must exist in the system to be imported) - [-custom_data ]: Custom data should be a base 64 encoded JSON document example -custom_data \'{\"test1\" : 1, \"test2\": 2}\' - [-id_extra ] : Id extra - [-agent_name ] : Agent name, Not to be confused with the alias. - [-force_create_agent<0 o 1>]: Force the creation of agent through an event this will create when it is 1. - [-server_id ] : The pandora node server_id\n\n"; + [-user_comment ] : Free text (surrounded by single-quotes, for security reasons) + [-owner_user ] : Use the login name, not the descriptive + [-source ] : (By default 'Pandora') + [-tag ] : Tag (must exist in the system to be imported) + [-custom_data ]: Custom data has to be in JSON format. Example: -custom_data \'{\"test1\" : \"t1\", \"test2\": \"2\"}\' + [-id_extra ] : Id extra + [-agent_name ] : Agent name, Not to be confused with the alias. + [-force_create_agent<0 o 1>] : Force the creation of agent through an event this will create when it is 1. + [-separator ''] : If you use the vertical bar `|` in the event name, you must set other character for send the info. This must be surrounded by single-quotes + [-server_id ] : The pandora node server_id\n\n"; print "Example of event generation:\n\n"; @@ -120,7 +122,7 @@ sub tool_api_main () { my $db_user; my $db_pass; my @db_info; - my $id_agent; + my $id_agent = '0'; my $id_user = ''; my $status = ''; my $id_agent_module = ''; @@ -141,6 +143,7 @@ sub tool_api_main () { my $call_api; my $custom_data = ""; my $server_id = 0; + my $separator = '|'; #~ help or api path (required) if ($ARGV[0] eq '-h') { @@ -185,12 +188,18 @@ sub tool_api_main () { if ($line eq '-agent') { $id_agent = $ARGV[$i + 1]; + # If not defined, send 0 for API. + if ($id_agent eq undef) { + $id_agent = '0'; + } + } if ($line eq '-group') { $id_group = $ARGV[$i + 1]; } if ($line eq '-name') { $event_name = $ARGV[$i + 1]; + $event_name =~ s/#/%23/g; } if ($line eq '-type') { $event_type = $ARGV[$i + 1]; @@ -250,50 +259,49 @@ sub tool_api_main () { if ($line eq '-server_id') { $server_id = $ARGV[$i + 1]; } + if ($line eq '-separator') { + $separator = $ARGV[$i + 1]; + } $i++; } if ($event_name eq "") { - print "[ERROR] Missing id agent! Read help info:\n\n"; + print "[ERROR] Missing event name! Read help info:\n\n"; help_screen (); } if ($id_group eq "") { print "[ERROR] Missing event group! Read help info:\n\n"; help_screen (); } - if ($id_agent eq "" && $agent_name eq "") { - print "[ERROR] Missing id agent! and agent_name Read help info:\n\n"; - help_screen (); - } $data_event = $event_name . - "|" . $id_group . - "|" . $id_agent . - "|" . $status . - "|" . $id_user . - "|" . $event_type . - "|" . $severity . - "|" . $id_agent_module . - "|" . $id_alert_am . - "|" . $critical_instructions . - "|" . $warning_instructions . - "|" . $unknown_instructions . - "|" . $user_comment . - "|" . $owner_user . - "|" . $source . - "|" . $tags . - "|" . $custom_data . - "|" . $server_id . - "|" . $id_extra . - "|" . $agent_name . - "|" . $force_create_agent; + $separator . $id_group . + $separator . $id_agent . + $separator . $status . + $separator . $id_user . + $separator . $event_type . + $separator . $severity . + $separator . $id_agent_module . + $separator . $id_alert_am . + $separator . $critical_instructions . + $separator . $warning_instructions . + $separator . $unknown_instructions . + $separator . $user_comment . + $separator . $owner_user . + $separator . $source . + $separator . $tags . + $separator . $custom_data . + $separator . $server_id . + $separator . $id_extra . + $separator . $agent_name . + $separator . $force_create_agent; $call_api = $api_path . '?' . 'op=set&' . 'op2=create_event&' . 'other=' . $data_event .'&' . - 'other_mode=url_encode_separator_|&' . + 'other_mode=url_encode_separator_'.$separator.'&' . 'apipass=' . $api_pass . '&' . 'user=' . $db_user . '&' . 'pass=' . $db_pass; @@ -321,13 +329,8 @@ sub tool_api_main () { exit; } else { - #-----------DEBUG---------------------------- - #print($call_api . "\n\n\n"); - - my $content = get($call_api); - - #-----------DEBUG---------------------------- - #print($content . "\n\n\n"); + my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 }); + my $content = $ua->get($call_api); if ($option eq '-create_event') { if ($content eq undef) { @@ -335,7 +338,7 @@ sub tool_api_main () { help_screen(); } else { - print "Event ID: $content"; + print "Event ID: $content->{'_content'}"; } } elsif ($option eq '-validate_event') {