2007-04-14 05:22:22 +00:00
|
|
|
##
|
2008-10-02 05:23:59 +00:00
|
|
|
# $Id$
|
2007-04-14 05:22:22 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
##
|
2009-12-27 07:30:50 +00:00
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
2007-04-14 05:22:22 +00:00
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
2012-02-21 01:40:50 +00:00
|
|
|
# web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/
|
2007-04-14 05:22:22 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
|
2008-10-02 05:23:59 +00:00
|
|
|
class Metasploit3 < Msf::Auxiliary
|
2007-04-14 05:22:22 +00:00
|
|
|
|
|
|
|
# Exploit mixins should be called first
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Exploit::Remote::DCERPC
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2009-12-18 01:51:31 +00:00
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
2007-04-14 05:22:22 +00:00
|
|
|
# Scanner mixin should be near last
|
2008-10-02 05:23:59 +00:00
|
|
|
include Msf::Auxiliary::Scanner
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-14 05:22:22 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'Endpoint Mapper Service Discovery',
|
2007-05-07 04:48:45 +00:00
|
|
|
'Version' => '$Revision$',
|
2007-04-14 05:22:22 +00:00
|
|
|
'Description' => %q{
|
2009-12-27 07:30:50 +00:00
|
|
|
This module can be used to obtain information from the
|
2007-04-14 05:22:22 +00:00
|
|
|
Endpoint Mapper service.
|
|
|
|
},
|
|
|
|
'Author' => 'hdm',
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-14 05:22:22 +00:00
|
|
|
deregister_options('RHOST')
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-14 05:22:22 +00:00
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
Opt::RPORT(135)
|
2009-12-27 07:30:50 +00:00
|
|
|
], self.class)
|
2007-04-14 05:22:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# Obtain information about a single host
|
2009-12-27 07:30:50 +00:00
|
|
|
def run_host(ip)
|
2007-04-14 05:22:22 +00:00
|
|
|
begin
|
|
|
|
|
|
|
|
ids = dcerpc_endpoint_list()
|
|
|
|
return if not ids
|
2009-12-18 01:51:31 +00:00
|
|
|
name = nil
|
2007-04-14 05:22:22 +00:00
|
|
|
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]
|
2009-12-27 07:30:50 +00:00
|
|
|
print_status(line)
|
2009-12-18 01:51:31 +00:00
|
|
|
if (id[:host] and id[:host][0,2] == "\\\\")
|
|
|
|
name = id[:host][2..-1]
|
|
|
|
end
|
|
|
|
if id[:prot].downcase == "tcp" or id[:prot].downcase == "udp"
|
2009-12-27 07:30:50 +00:00
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => id[:port],
|
|
|
|
:proto => id[:prot].downcase,
|
|
|
|
:name => "dcerpc",
|
|
|
|
:info => "#{id[:uuid]} v#{id[:vers]} #{id[:note]}"
|
|
|
|
)
|
2009-12-18 01:51:31 +00:00
|
|
|
end
|
2007-04-14 05:22:22 +00:00
|
|
|
end
|
2009-12-18 01:51:31 +00:00
|
|
|
report_host(:host => ip, :name => name) if name
|
2010-03-08 04:35:14 +00:00
|
|
|
report_service(
|
|
|
|
:host => ip,
|
|
|
|
:port => rport,
|
2010-03-08 04:39:06 +00:00
|
|
|
:proto => 'tcp',
|
2010-03-08 04:35:14 +00:00
|
|
|
:name => "dcerpc",
|
|
|
|
:info => "Endpoint Mapper (#{ids.length} services)"
|
|
|
|
)
|
2009-12-27 07:30:50 +00:00
|
|
|
|
2007-04-14 05:22:22 +00:00
|
|
|
rescue ::Interrupt
|
|
|
|
raise $!
|
2010-03-08 04:39:06 +00:00
|
|
|
rescue ::Rex::Proto::DCERPC::Exceptions::Fault
|
2007-04-14 05:22:22 +00:00
|
|
|
rescue ::Exception => e
|
2010-07-25 21:37:54 +00:00
|
|
|
print_error("#{ip}:#{rport} error: #{e}")
|
2007-04-14 05:22:22 +00:00
|
|
|
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
|