Merge branch 'ent-11292-asignacion-os-erronea-cuando-el-dispositivo-solo-responde-el-os-details' into 'develop'

Fix nmap os detection with OS details

See merge request artica/pandorafms!5953
This commit is contained in:
Rafael Ameijeiras 2023-05-30 09:23:57 +00:00
commit 6e27b7ce15
2 changed files with 22 additions and 22 deletions

View File

@ -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;
}

View File

@ -432,8 +432,8 @@ 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($1 ne "") {
if ($return =~ /Aggressive OS guesses:(.*?)(?>\(\d+%\),)|^OS details:(.*?)\(.*\)*$/mi) {
if(defined($1) && $1 ne "") {
$str_os = $1;
} else {
$str_os = $2;