From a730edf328e4196edb7458c9a93d5c688717f8b3 Mon Sep 17 00:00:00 2001 From: slerena Date: Tue, 17 Jun 2008 11:10:29 +0000 Subject: [PATCH] 2008-06-17 Sancho Lerena * pandora_recon: First code to implement traceroute functionality using Pureperl module. Added code for remote OS fingerprinting. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@868 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 3 ++- pandora_server/bin/pandora_recon | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 397f67ec59..8320a52994 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,7 +1,8 @@ 2008-06-17 Sancho Lerena * pandora_recon: First code to implement traceroute functionality - using Pureperl module. + using Pureperl module. Added code for remote OS fingerprinting. + 2008-06-16 Sancho Lerena diff --git a/pandora_server/bin/pandora_recon b/pandora_server/bin/pandora_recon index 25a1b077f0..5735151410 100755 --- a/pandora_server/bin/pandora_recon +++ b/pandora_server/bin/pandora_recon @@ -133,6 +133,52 @@ sub pandora_recon_subsystem { } } +########################################################################## +# SUB pandora_detect_os (paconfig, host) +# Detect OS using xprobe2 tool. Return tconfig_os id code. +########################################################################## + +sub pandora_detect_os { + my $pa_config = $_[0]; + my $host = $_[1]; + + # my $pa_config->{"xprobe2"} = "/usr/bin/xprobe2"; + # my $xprobe2 = $pa_config->{"xprobe2"}; + my $xprobe2 = "/usr/bin/xprobe2"; + if (! -e $xprobe2){ + return 10; + } + my $command = `$xprobe2 $host 2> /dev/null | grep "Running OS" | head -1`; + + if ($command =~ m/Windows/i){ + return 9; + } + elsif ($command =~ m/Linux/i){ + return 1; + } + elsif ($command =~ m/BSD/i){ + return 4; + } + elsif ($command =~ m/Cisco/i){ + return 7; + } + elsif ($command =~ m/SunOS/i){ + return 2; + } + elsif ($command =~ m/Solaris/i){ + return 2; + } + elsif ($command =~ m/AIX/i){ + return 3; + } + elsif ($command =~ m/HP-UX/i){ + return 5; + } + else { + return 10; + } + +} ########################################################################## # SUB pandora_exec_task (pa_config, id_task) # Execute task