2007-04-24 06:27:39 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2009-12-27 07:30:50 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-04-24 06:27:39 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
2009-04-13 14:33:26 +00:00
|
|
|
# http://metasploit.com/framework/
|
2007-04-24 06:27:39 +00:00
|
|
|
##
|
|
|
|
|
2009-11-26 20:39:15 +00:00
|
|
|
require 'rex/proto/http'
|
2007-04-24 06:27:39 +00:00
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
# Exploit mixins should be called first
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::HttpClient
|
|
|
|
include Msf::Auxiliary::WMAPScanServer
|
2007-04-24 06:27:39 +00:00
|
|
|
# Scanner mixin should be near last
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Scanner
|
2009-11-26 20:39:15 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2007-04-24 06:27:39 +00:00
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'HTTP Version Detection',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => 'Display version information about each system',
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Fingerprint a single host
|
|
|
|
def run_host(ip)
|
|
|
|
|
|
|
|
begin
|
|
|
|
res = send_request_raw({
|
2007-04-25 02:51:49 +00:00
|
|
|
'uri' => '/',
|
2009-12-28 00:37:56 +00:00
|
|
|
'method' => 'GET'
|
2010-03-25 21:35:37 +00:00
|
|
|
}, 25)
|
2007-04-24 06:27:39 +00:00
|
|
|
|
2010-03-08 13:52:39 +00:00
|
|
|
if (res)
|
2007-04-24 06:27:39 +00:00
|
|
|
extra = http_fingerprint(res)
|
2010-03-08 13:52:39 +00:00
|
|
|
print_status("#{ip} #{res.headers['Server'] ? ("is running " + res.headers['Server']) : "has no server header"}#{extra}")
|
2010-02-11 22:37:00 +00:00
|
|
|
report_service(:host => ip, :port => rport, :name => (ssl ? 'https' : 'http'), :info => "#{res.headers['Server']}#{extra}")
|
2007-04-24 06:27:39 +00:00
|
|
|
end
|
2009-10-26 19:48:15 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
rescue ::Timeout::Error, ::Errno::EPIPE
|
|
|
|
end
|
2008-10-19 20:32:14 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
end
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
#
|
|
|
|
# This is quick example of "extra" fingerprinting we can do
|
|
|
|
#
|
|
|
|
def http_fingerprint(res)
|
|
|
|
return if not res
|
2010-03-25 21:35:37 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
extras = []
|
|
|
|
|
2010-03-08 13:52:39 +00:00
|
|
|
case res.code
|
|
|
|
when 301,302
|
|
|
|
extras << "#{res.code}-#{res.headers['Location']}"
|
|
|
|
when 401
|
|
|
|
extras << "#{res.code}-#{res.headers['WWW-Authenticate']}"
|
|
|
|
when 403
|
|
|
|
extras << "#{res.code}-#{res.headers['WWW-Authenticate']||res.message}"
|
|
|
|
when 500 .. 599
|
|
|
|
extras << "#{res.code}-#{res.message}"
|
|
|
|
end
|
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
if (res.headers['X-Powered-By'])
|
|
|
|
extras << "Powered by " + res.headers['X-Powered-By']
|
|
|
|
end
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2010-03-08 13:52:39 +00:00
|
|
|
if (res.headers['Via'])
|
|
|
|
extras << "Via-" + res.headers['Via']
|
|
|
|
end
|
|
|
|
|
|
|
|
if (res.headers['X-AspNet-Version'])
|
|
|
|
extras << "AspNet-Version-" + res.headers['X-AspNet-Version']
|
|
|
|
end
|
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
case res.body
|
2010-03-25 21:35:37 +00:00
|
|
|
when nil
|
|
|
|
# Nothing
|
|
|
|
when /openAboutWindow.*\>DD\-WRT ([^\<]+)\</
|
|
|
|
extras << "DD-WRT #{$1.strip}"
|
2007-04-24 06:27:39 +00:00
|
|
|
|
2010-03-08 13:52:39 +00:00
|
|
|
when /ID_ESX_Welcome/
|
|
|
|
extras << "VMware ESX Server"
|
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
when /Test Page for.*Fedora/
|
|
|
|
extras << "Fedora Default Page"
|
|
|
|
|
|
|
|
when /Placeholder page/
|
|
|
|
extras << "Debian Default Page"
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
when /Welcome to Windows Small Business Server (\d+)/
|
|
|
|
extras << "Windows SBS #{$1}"
|
|
|
|
|
|
|
|
when /Asterisk@Home/
|
2010-03-22 00:09:04 +00:00
|
|
|
extras << "Asterisk"
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
when /swfs\/Shell\.html/
|
|
|
|
extras << "BPS-1000"
|
|
|
|
end
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2010-03-08 13:52:39 +00:00
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
if (extras.length == 0)
|
|
|
|
return ''
|
|
|
|
end
|
2009-12-27 07:30:50 +00:00
|
|
|
|
|
|
|
|
2007-04-24 06:27:39 +00:00
|
|
|
# Format and return
|
|
|
|
' ( ' + extras.join(', ') + ' )'
|
|
|
|
end
|
|
|
|
|
2008-11-10 04:38:05 +00:00
|
|
|
end
|
2009-12-27 07:30:50 +00:00
|
|
|
|