2010-12-25 06:08:34 +00:00
|
|
|
##
|
2013-10-15 18:50:46 +00:00
|
|
|
# This module requires Metasploit: http//metasploit.com/download
|
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2010-12-25 06:08:34 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::SNMPClient
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
include Msf::Auxiliary::Scanner
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'SNMP Windows Username Enumeration',
|
|
|
|
'Description' => "This module will use LanManager OID values to enumerate local user accounts on a Windows system via SNMP",
|
|
|
|
'Author' => ['tebo[at]attackresearch.com'],
|
|
|
|
'License' => MSF_LICENSE
|
|
|
|
)
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run_host(ip)
|
|
|
|
begin
|
|
|
|
snmp = connect_snmp
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
if snmp.get_value('sysDescr.0') =~ /Windows/
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
@users = []
|
|
|
|
snmp.walk("1.3.6.1.4.1.77.1.2.25") do |row|
|
|
|
|
row.each { |val| @users << val.value.to_s }
|
|
|
|
end
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_good("#{ip} Found Users: #{@users.sort.join(", ")} ")
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
disconnect_snmp
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
report_note(
|
|
|
|
:host => rhost,
|
|
|
|
:port => datastore['RPORT'],
|
|
|
|
:proto => 'udp',
|
|
|
|
:sname => 'snmp',
|
|
|
|
:update => :unique_data,
|
|
|
|
:type => 'snmp.users',
|
|
|
|
:data => @users
|
|
|
|
)
|
2011-11-20 02:12:07 +00:00
|
|
|
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
rescue ::SNMP::UnsupportedVersion
|
|
|
|
rescue ::SNMP::RequestTimeout
|
|
|
|
rescue ::Interrupt
|
|
|
|
raise $!
|
|
|
|
rescue ::Exception => e
|
|
|
|
print_error("Unknown error: #{e.class} #{e}")
|
|
|
|
end
|
2010-12-25 06:08:34 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-12-25 06:08:34 +00:00
|
|
|
|
|
|
|
end
|