Patch the Discovery Server to support vulnerability scans.

This commit is contained in:
Ramon Novoa 2023-10-26 18:51:01 +02:00
parent 1fbba70eb1
commit eade0aedbe
1 changed files with 31 additions and 14 deletions

View File

@ -443,6 +443,7 @@ sub exec_recon_app ($$$) {
"__consoleAPIPass__" => $pa_config->{'console_api_pass'}, "__consoleAPIPass__" => $pa_config->{'console_api_pass'},
"__consoleUser__" => $pa_config->{'console_user'}, "__consoleUser__" => $pa_config->{'console_user'},
"__consolePass__" => $pa_config->{'console_pass'}, "__consolePass__" => $pa_config->{'console_pass'},
"__pandoraServerConf__" => $pa_config->{'pandora_path'},
get_recon_app_macros($pa_config, $dbh, $task), get_recon_app_macros($pa_config, $dbh, $task),
get_recon_script_macros($pa_config, $dbh, $task) get_recon_script_macros($pa_config, $dbh, $task)
); );
@ -2227,6 +2228,7 @@ sub PandoraFMS::Recon::Base::connect_agents($$$$$;$) {
# data = [ # data = [
# 'agent_data' => {}, # 'agent_data' => {},
# 'module_data' => [] # 'module_data' => []
# 'inventory_data' => []
# ] # ]
################################################################################ ################################################################################
sub PandoraFMS::Recon::Base::create_agents($$) { sub PandoraFMS::Recon::Base::create_agents($$) {
@ -2240,7 +2242,8 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
foreach my $information (@{$data}) { foreach my $information (@{$data}) {
my $agent = $information->{'agent_data'}; my $agent = $information->{'agent_data'};
my $modules = $information->{'module_data'}; my $modules = defined($information->{'module_data'}) ? $information->{'module_data'} : [];
my $inventory = defined($information->{'inventory_data'}) ? $information->{'inventory_data'} : [];
my $force_processing = 0; my $force_processing = 0;
# Search agent # Search agent
@ -2249,7 +2252,9 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
); );
my $parent_id; my $parent_id;
if (defined($agent->{'parent_agent_name'})) { if (defined($agent->{'id_parent'})) {
$parent_id = $agent->{'id_parent'};
} elsif (defined($agent->{'parent_agent_name'})) {
$parent_id = PandoraFMS::Core::locate_agent( $parent_id = PandoraFMS::Core::locate_agent(
$pa_config, $dbh, $agent->{'parent_agent_name'} $pa_config, $dbh, $agent->{'parent_agent_name'}
); );
@ -2259,7 +2264,7 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
} }
my $agent_id; my $agent_id;
my $os_id = get_os_id($dbh, $agent->{'os'}); my $os_id = defined($agent->{'id_os'}) ? $agent->{'id_os'} : get_os_id($dbh, $agent->{'os'});
if ($os_id < 0) { if ($os_id < 0) {
$os_id = get_os_id($dbh, 'Other'); $os_id = get_os_id($dbh, 'Other');
@ -2322,8 +2327,20 @@ sub PandoraFMS::Recon::Base::create_agents($$) {
); );
} }
} }
}
# Add inventory data.
if (ref($inventory) eq "HASH") {
PandoraFMS::Core::process_inventory_data (
$pa_config,
$inventory,
0, # Does not seem to be used.
$agent->{'agent_name'},
$agent->{'interval'},
strftime ("%Y/%m/%d %H:%M:%S", localtime()),
$dbh
);
}
}
} }
################################################################################ ################################################################################