This commit is contained in:
fbsanchez 2020-05-13 17:02:07 +02:00
parent bd6b57e8c3
commit ee51814650
2 changed files with 16 additions and 8 deletions

View File

@ -551,7 +551,12 @@ sub PandoraFMS::Recon::Base::test_module($$) {
# Remote command.
return 0 unless $self->rcmd_responds($addr);
my $target_os = pandora_get_os($self->{'dbh'}, $test->{'custom_string_2'});
my $target_os;
if ($test->{'custom_string_2'} =~ /inherited/i) {
$target_os = $self->{'os_cache'}{$test->{'ip_target'}};
} else {
$target_os = $test->{'custom_string_2'};
}
$value = enterprise_hook(
'remote_execution_module',
@ -566,8 +571,8 @@ sub PandoraFMS::Recon::Base::test_module($$) {
$target_os,
# ip_target,
$test->{'ip_target'},
# tcp_port
$test->{'tcp_port'}
# tcp_send
$test->{'tcp_send'}
]
);

View File

@ -2324,9 +2324,12 @@ sub rcmd_credentials_calculation {
return undef;
}
my $id_os = $self->call('guess_os', $target, 1);
my $os = $self->{'os_cache'}{$target};
$os = $self->call('guess_os', $target, 1) if is_empty($os);
$rcmd->set_host($target);
$rcmd->set_os($id_os);
$rcmd->set_os($os);
$self->{'os_cache'}{$target} = $os;
# Test all credentials selected.
foreach my $key_index (@{$self->{'auth_strings_array'}}) {
@ -2363,10 +2366,10 @@ sub rcmd_credentials_calculation {
chomp($result);
my $out = '';
$out = $result if !is_empty($result);
$self->call('message', "Trying [".$key_index."] in [". $target."] [".$id_os."]: [$out]", 10);
$self->call('message', "Trying [".$key_index."] in [". $target."] [".$os."]: [$out]", 10);
};
if ($@) {
$self->call('message', "Failed while trying [".$key_index."] in [". $target."] [".$id_os."]:" . @_, 10);
$self->call('message', "Failed while trying [".$key_index."] in [". $target."] [".$os."]:" . @_, 10);
}
if (!is_empty($result) && $result == "1") {
@ -2377,7 +2380,7 @@ sub rcmd_credentials_calculation {
$self->call('message', "RCMD available for $target", 10);
return 1;
} else {
$self->call('message', "Last error ($target|$id_os|$result) was [".$rcmd->get_last_error()."]", 10);
$self->call('message', "Last error ($target|$os|$result) was [".$rcmd->get_last_error()."]", 10);
}
}