Database Reference
In-Depth Information
while ($count < 256)
{
my $host = $subnet.$count;
my $text = " milliseconds";
($TNSping) = `/u01/app/oracle/product/11.2.0/db_1/bin/tnsping $host | tail -1` ;
open (MYFILE, '>>output.txt');
if ($TNSping =~ /OK/)
{
($TNSping) = $TNSping =~ /OK \((\d+)/;
($TNSping) = $TNSping.$text;
print "Oracle Host $host responds successfully in $TNSping\n" ;
my ($OraVer) = `./tnscmd10gOneLine.pl version -h $host`;#11g will respond with
VSNNUM=186646784
print "The TNS version string from $host is - $OraVer\n";
print MYFILE "Oracle Host $host responds successfully in $TNSping\n";
print MYFILE "$OraVer\n";
my @OraCheck;
my $OraSID;
#8i and 9
if ($OraVer =~ m/( Version 8\.0| Version 9\.1| Version 9\.0)/)
{
print "Oracle Version at $host is below 9.2\n";
my ($OraSID) = `./tnscmd10gOneLine.pl status -h $host`;
if($OraSID =~ m/SERVICE_NAME=(.*?)\)/)
{
print "$1\n";
$OraSID=$1;
print "OraSID equals $OraSID\n";
}
#would be good to implement multiple SID extraction here which is doable from
oralogon.pl code
(@OraCheck) = `./oralogonsid.pl -h $host -l orapwshort.csv -S $OraSID`;
print "@OraCheck\n";
print MYFILE "@OraCheck\n";
}
#9.2 don't need to pass SID
elsif ($OraVer =~ / 9\.2/)
{
#do bfora with user and password file
print "Oracle Version at $host is 9.2\n";
(@OraCheck) = `./oralogon.pl -h $host -l orapwshort.csv`;#changed to be from list
print "@OraCheck\n";
print MYFILE "@OraCheck\n";
}
#10.x brute the SID or scrape it off the EM logon page
elsif ($OraVer =~ / 10\./)
{
print "Oracle Version at $host is 10g\n";
(@OraCheck)= `/usr/bin/nmap -PN -n -p 1521 $host --script oracle-sid-brute --script-
args=oraclesids=/home/oracle/paulsperl/mac/oracle/oracle-sids`;
if ($OraCheck[8]=~ /\|_ (.*?) /)
Search WWH ::




Custom Search