2009-05-11 02:46:59 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2010-01-15 03:25:34 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2009-05-11 02:46:59 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::Tcp
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
include Msf::Auxiliary::Report
|
2010-01-15 03:25:34 +00:00
|
|
|
|
2009-05-11 02:46:59 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'SSH Version Scannner',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'Detect SSH Version.',
|
|
|
|
'References' =>
|
|
|
|
[
|
|
|
|
[ 'URL', 'http://en.wikipedia.org/wiki/SecureShell' ],
|
|
|
|
],
|
2010-02-17 14:42:11 +00:00
|
|
|
'Author' => [ 'Daniel van Eeden <metasploit[at]myname.nl>' ],
|
2009-05-11 02:46:59 +00:00
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(22),
|
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_host(target_host)
|
|
|
|
connect
|
|
|
|
|
2010-01-15 03:25:34 +00:00
|
|
|
ver = sock.get_once(-1, 5)
|
2009-05-11 02:46:59 +00:00
|
|
|
|
2009-10-18 18:23:19 +00:00
|
|
|
if (ver and ver =~ /SSH/)
|
|
|
|
ver,msg = (ver.split(/(\n|\r)/))
|
2009-05-11 02:46:59 +00:00
|
|
|
print_status("#{target_host}:#{rport}, SSH server version: #{ver}")
|
2009-12-30 18:23:03 +00:00
|
|
|
report_service(:host => rhost, :port => rport, :name => "ssh", :info => ver)
|
2009-05-11 02:46:59 +00:00
|
|
|
else
|
|
|
|
print_status("#{target_host}:#{rport}, SSH server version detection failed!")
|
|
|
|
end
|
|
|
|
|
|
|
|
disconnect
|
|
|
|
end
|
|
|
|
end
|
2010-01-15 03:25:34 +00:00
|
|
|
|