2011-02-22 20:49:44 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
2011-01-24 17:23:48 +00:00
|
|
|
require 'msf/core'
|
|
|
|
require 'msf/core/post/windows/accounts'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Post
|
|
|
|
|
2011-06-21 00:38:04 +00:00
|
|
|
include Msf::Post::Windows::Accounts
|
2011-01-24 17:23:48 +00:00
|
|
|
|
|
|
|
def initialize(info={})
|
|
|
|
super( update_info( info,
|
2011-04-27 16:25:15 +00:00
|
|
|
'Name' => 'Windows Gather Local User Account SID Lookup',
|
2011-01-24 17:23:48 +00:00
|
|
|
'Description' => %q{ This module prints information about a given SID from the perspective of this session },
|
|
|
|
'License' => BSD_LICENSE,
|
|
|
|
'Author' => [ 'chao-mu'],
|
2011-02-22 20:49:44 +00:00
|
|
|
'Version' => '$Revision$',
|
2011-01-24 17:23:48 +00:00
|
|
|
'Platform' => [ 'windows' ],
|
|
|
|
'SessionTypes' => [ 'meterpreter' ]
|
|
|
|
))
|
|
|
|
register_options(
|
|
|
|
[
|
|
|
|
OptString.new('SID', [ true, 'SID to lookup' ]),
|
|
|
|
OptString.new('SYSTEM_NAME', [ false, 'Where to search. If undefined, first local then trusted DCs' ]),
|
|
|
|
], self.class)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
sid = datastore['SID']
|
|
|
|
target_system = datastore['SYSTEM_NAME']
|
|
|
|
|
|
|
|
info = resolve_sid(sid, target_system ? target_system : nil)
|
2011-02-22 20:49:44 +00:00
|
|
|
|
2011-01-24 17:23:48 +00:00
|
|
|
if info.nil?
|
|
|
|
print_error 'Unable to resolve SID. Giving up.'
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
sid_type = info[:type]
|
|
|
|
|
2011-07-27 02:39:49 +00:00
|
|
|
if sid_type == :invalid
|
2011-01-24 17:23:48 +00:00
|
|
|
print_error 'Invalid SID provided'
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
unless info[:mapped]
|
|
|
|
print_error 'No account found for the given SID'
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2011-02-22 20:49:44 +00:00
|
|
|
print_status "SID Type: #{sid_type.to_s}"
|
|
|
|
print_status "Name: #{info[:name]}"
|
|
|
|
print_status "Domain: #{info[:domain]}"
|
2011-01-24 17:23:48 +00:00
|
|
|
end
|
|
|
|
end
|