From 97f246ae60cb2fed95a7b840f31cbf95d67b6939 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Thu, 10 Oct 2019 17:28:02 +0200 Subject: [PATCH] discovery os detection --- pandora_server/lib/PandoraFMS/DiscoveryServer.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index 51abd3c022..1ab91839e7 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -360,8 +360,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) { if (-x $self->{'pa_config'}->{'xprobe2'}) { my $return = `"$self->{pa_config}->{xprobe2}" $device 2>$DEVNULL`; if ($? == 0) { - my ($output) = $a =~ /Running OS:(.*)/; - return pandora_get_os($self->{'dbh'}, $output); + if($return =~ /Running OS:(.*)/) { + return pandora_get_os($self->{'dbh'}, $1); + } } } @@ -370,8 +371,9 @@ sub PandoraFMS::Recon::Base::guess_os($$) { my $return = `"$self->{pa_config}->{nmap}" -F -O $device 2>$DEVNULL`; return OS_OTHER if ($? != 0); - my ($output) = $return =~ /Aggressive OS guesses:\s*(.*)/; - return pandora_get_os($self->{'dbh'}, $output); + if ($return =~ /Aggressive OS guesses:\s*(.*)/) { + return pandora_get_os($self->{'dbh'}, $1); + } } return OS_OTHER;