diff --git a/pandora_server/lib/PandoraFMS/Core.pm b/pandora_server/lib/PandoraFMS/Core.pm index ea9fb091b1..305c116d4b 100644 --- a/pandora_server/lib/PandoraFMS/Core.pm +++ b/pandora_server/lib/PandoraFMS/Core.pm @@ -6689,40 +6689,40 @@ sub pandora_get_os ($$) { return 10; } - if ($os =~ m/Windows.*?(?=\(\d+%\))/i) { + if ($os =~ m/Windows/i) { return 9; } - if ($os =~ m/Cisco.*?(?=\(\d+%\))/i) { + if ($os =~ m/Cisco/i) { return 7; } - if ($os =~ m/SunOS.*?(?=\(\d+%\))/i || $os =~ m/Solaris.*?(?=\(\d+%\))/i) { + if ($os =~ m/SunOS/i || $os =~ m/Solaris/i) { return 2; } - if ($os =~ m/AIX.*?(?=\(\d+%\))/i) { + if ($os =~ m/AIX/i) { return 3; } - if ($os =~ m/HP\-UX.*?(?=\(\d+%\))/i) { + if ($os =~ m/HP\-UX/i) { return 5; } - if ($os =~ m/Apple.*?(?=\(\d+%\))/i || $os =~ m/Darwin.*?(?=\(\d+%\))/i) { + if ($os =~ m/Apple/i || $os =~ m/Darwin/i) { return 8; } - if ($os =~ m/Linux.*?(?=\(\d+%\))/i) { - return 1; - } - if ($os =~ m/Enterasys.*?(?=\(\d+%\))/i || $os =~ m/3com.*?(?=\(\d+%\))/i) { - return 11; - } - if ($os =~ m/Octopods.*?(?=\(\d+%\))/i) { - return 13; - } - if ($os =~ m/embedded.*?(?=\(\d+%\))/i) { - return 14; - } - if ($os =~ m/android.*?(?=\(\d+%\))/i) { + if ($os =~ m/android/i) { return 15; } - if ($os =~ m/BSD.*?(?=\(\d+%\))/i) { + if ($os =~ m/Linux/i) { + return 1; + } + if ($os =~ m/Enterasys/i || $os =~ m/3com/i) { + return 11; + } + if ($os =~ m/Octopods/i) { + return 13; + } + if ($os =~ m/embedded/i) { + return 14; + } + if ($os =~ m/BSD/i) { return 4; } diff --git a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm index a556334ee0..835ae1b82a 100644 --- a/pandora_server/lib/PandoraFMS/DiscoveryServer.pm +++ b/pandora_server/lib/PandoraFMS/DiscoveryServer.pm @@ -432,7 +432,7 @@ sub PandoraFMS::Recon::Base::guess_os($$;$) { my $return = `"$self->{pa_config}->{nmap}" -sSU -T5 -F -O --osscan-limit $device 2>$DEVNULL`; return OS_OTHER if ($? != 0); my $str_os; - if ($return =~ /Aggressive OS guesses:\s*(.*)|OS details:\s(.*)/) { + if ($return =~ /Aggressive OS guesses:(.*?)(?>\(\d+%\),)|^OS details:(.*?)\(.*\)*$/mi) { if(defined($1) && $1 ne "") { $str_os = $1; } else {