2012-10-19 20:08:58 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2012-10-19 20:08:58 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex/proto/ntlm/message'
|
|
|
|
|
|
|
|
|
2016-03-07 19:19:55 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2012-10-19 20:08:58 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::WinRM
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
|
|
|
|
include Msf::Auxiliary::Scanner
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'WinRM Authentication Method Detection',
|
|
|
|
'Description' => %q{
|
|
|
|
This module sends a request to an HTTP/HTTPS service to see if it is a WinRM service.
|
|
|
|
If it is a WinRM service, it also gathers the Authentication Methods supported.
|
|
|
|
},
|
|
|
|
'Author' => [ 'thelightcosine' ],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
|
|
|
|
|
|
|
deregister_options('USERNAME', 'PASSWORD')
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def run_host(ip)
|
|
|
|
resp = winrm_poke
|
|
|
|
return nil if resp.nil?
|
|
|
|
if resp.code == 401 and resp.headers['Server'] and resp.headers['Server'].include? "Microsoft-HTTPAPI"
|
|
|
|
methods = parse_auth_methods(resp)
|
|
|
|
desc = resp.headers['Server'] + " Authentication Methods: " + methods.to_s
|
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:name => 'winrm',
|
|
|
|
:info => desc
|
|
|
|
)
|
|
|
|
print_good "#{ip}:#{rport}: Negotiate protocol supported" if methods.include? "Negotiate"
|
|
|
|
print_good "#{ip}:#{rport}: Kerberos protocol supported" if methods.include? "Kerberos"
|
|
|
|
print_good "#{ip}:#{rport}: Basic protocol supported" if methods.include? "Basic"
|
|
|
|
else
|
|
|
|
print_error "#{ip}:#{rport} Does not appear to be a WinRM server"
|
|
|
|
end
|
|
|
|
end
|
2012-10-19 20:08:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
end
|