2007-04-14 05:22:22 +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
|
2007-04-14 05:22:22 +00:00
|
|
|
##
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2007-04-14 05:22:22 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Exploit mixins should be called first
|
|
|
|
include Msf::Exploit::Remote::DCERPC
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Auxiliary::Report
|
2009-12-18 01:51:31 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Scanner mixin should be near last
|
|
|
|
include Msf::Auxiliary::Scanner
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Endpoint Mapper Service Discovery',
|
|
|
|
'Description' => %q{
|
|
|
|
This module can be used to obtain information from the
|
|
|
|
Endpoint Mapper service.
|
|
|
|
},
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
deregister_options('RHOST')
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(135)
|
2017-05-03 20:42:21 +00:00
|
|
|
])
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2007-04-14 05:22:22 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Obtain information about a single host
|
|
|
|
def run_host(ip)
|
|
|
|
begin
|
2007-04-14 05:22:22 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
ids = dcerpc_endpoint_list()
|
|
|
|
return if not ids
|
|
|
|
name = nil
|
|
|
|
ids.each do |id|
|
|
|
|
next if not id[:prot]
|
|
|
|
line = "#{id[:uuid]} v#{id[:vers]} "
|
|
|
|
line << "#{id[:prot].upcase} "
|
|
|
|
line << "(#{id[:port]}) " if id[:port]
|
|
|
|
line << "(#{id[:pipe]}) " if id[:pipe]
|
|
|
|
line << "#{id[:host]} " if id[:host]
|
|
|
|
line << "[#{id[:note]}]" if id[:note]
|
|
|
|
print_status(line)
|
|
|
|
if (id[:host] and id[:host][0,2] == "\\\\")
|
|
|
|
name = id[:host][2..-1]
|
|
|
|
end
|
|
|
|
if id[:prot].downcase == "tcp" or id[:prot].downcase == "udp"
|
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => id[:port],
|
|
|
|
:proto => id[:prot].downcase,
|
|
|
|
:name => "dcerpc",
|
|
|
|
:info => "#{id[:uuid]} v#{id[:vers]} #{id[:note]}"
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
report_host(:host => ip, :name => name) if name
|
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => rport,
|
|
|
|
:proto => 'tcp',
|
|
|
|
:name => "dcerpc",
|
|
|
|
:info => "Endpoint Mapper (#{ids.length} services)"
|
|
|
|
)
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
rescue ::Interrupt
|
|
|
|
raise $!
|
|
|
|
rescue ::Rex::Proto::DCERPC::Exceptions::Fault
|
|
|
|
rescue ::Exception => e
|
|
|
|
print_error("#{ip}:#{rport} error: #{e}")
|
|
|
|
end
|
|
|
|
end
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-14 05:22:22 +00:00
|
|
|
|
2009-12-18 01:51:31 +00:00
|
|
|
end
|