Improvements in log details v10

This commit is contained in:
fbsanchez 2020-05-13 16:43:20 +02:00
parent 6bbb9d5d9b
commit bd6b57e8c3
2 changed files with 69 additions and 63 deletions

View File

@ -409,8 +409,8 @@ sub exec_recon_script ($$$) {
################################################################################
# Guess the OS using xprobe2 or nmap.
################################################################################
sub PandoraFMS::Recon::Base::guess_os($$) {
my ($self, $device) = @_;
sub PandoraFMS::Recon::Base::guess_os($$;$) {
my ($self, $device, $string_flag) = @_;
return $self->{'os_id'}{$device} if defined($self->{'os_id'}{$device});
@ -432,7 +432,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`;
if ($? == 0) {
if($return =~ /Running OS:(.*)/) {
return pandora_get_os($self->{'dbh'}, $1);
my $str_os = $1;
return $str_os if is_enabled($string_flag);
return pandora_get_os($self->{'dbh'}, $str_os);
}
}
}
@ -443,7 +445,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) {
return OS_OTHER if ($? != 0);
if ($return =~ /Aggressive OS guesses:\s*(.*)/) {
return pandora_get_os($self->{'dbh'}, $1);
my $str_os = $1;
return $str_os if is_enabled($string_flag);
return pandora_get_os($self->{'dbh'}, $str_os);
}
}

View File

@ -2324,7 +2324,7 @@ sub rcmd_credentials_calculation {
return undef;
}
my $id_os = $self->call('guess_os', $target);
my $id_os = $self->call('guess_os', $target, 1);
$rcmd->set_host($target);
$rcmd->set_os($id_os);
@ -2376,6 +2376,8 @@ sub rcmd_credentials_calculation {
$self->{'summary'}->{'RCMD'} += 1;
$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);
}
}