From 15bf5ff7737a848dc8ce88bd811500cf321cff99 Mon Sep 17 00:00:00 2001 From: Tod Beardsley Date: Thu, 17 Jun 2010 15:16:39 +0000 Subject: [PATCH] Handle RSTs specifically, manage the probe timeout better. git-svn-id: file:///home/svn/framework3/trunk@9551 4d416f70-5f16-0410-b530-b9f4589650da --- modules/auxiliary/scanner/db2/db2_version.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/auxiliary/scanner/db2/db2_version.rb b/modules/auxiliary/scanner/db2/db2_version.rb index 16754fc457..d36a928f84 100644 --- a/modules/auxiliary/scanner/db2/db2_version.rb +++ b/modules/auxiliary/scanner/db2/db2_version.rb @@ -29,18 +29,23 @@ class Metasploit3 < Msf::Auxiliary ) register_options( [ - OptBool.new('VERBOSE', [ true, 'Verbose output', false]) + OptBool.new('VERBOSE', [ true, 'Verbose output', false]), + OptInt.new('TIMEOUT', [true, 'Timeout for the DB2 probe', 5]) ], self.class) deregister_options('USERNAME' , 'PASSWORD') end + def to + return 5 if datastore['TIMEOUT'].to_i.zero? + datastore['TIMEOUT'].to_i + end def run_host(ip) verbose = datastore['VERBOSE'] begin - info = db2_probe(2) + info = db2_probe(to) if info[:excsatrd] inst,plat,ver,pta = info[:instance_name],info[:platform],info[:version],info[:plaintext_auth] report_info = "Platform: #{plat}, Version: #{ver}, Instance: #{inst}, Plain-Authentication: #{pta ? "OK" : "NO"}" @@ -54,6 +59,9 @@ class Metasploit3 < Msf::Auxiliary end disconnect + rescue ::Rex::ConnectionRefused + print_error("#{rhost}:#{rport} : Cannot connect to host") if verbose + return :done rescue ::Rex::ConnectionError print_error("#{rhost}:#{rport} : Unable to attempt probe") if verbose return :done