Move code out of begin/rescue block

bug/bundler_fix
Meatballs 2014-12-17 06:45:00 +00:00
parent dd63d793e5
commit 6a822cca61
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 15 additions and 14 deletions

View File

@ -16,7 +16,7 @@ class Metasploit3 < Msf::Post
def initialize(info = {}) def initialize(info = {})
super(update_info( super(update_info(
info, info,
'Name' => 'Windows Gather Active Directory Users', 'Name' => 'Windows Gather Active Directory Users',
'Description' => %{ 'Description' => %{
This module will enumerate user accounts in the default Active Domain (AD) directory and stores This module will enumerate user accounts in the default Active Domain (AD) directory and stores
them in the database. them in the database.
@ -35,15 +35,15 @@ class Metasploit3 < Msf::Post
OptBool.new('EXCLUDE_LOCKED', [true, 'Exclude in search locked accounts..', false]), OptBool.new('EXCLUDE_LOCKED', [true, 'Exclude in search locked accounts..', false]),
OptBool.new('EXCLUDE_DISABLED', [true, 'Exclude from search disabled accounts.', false]), OptBool.new('EXCLUDE_DISABLED', [true, 'Exclude from search disabled accounts.', false]),
OptEnum.new('UAC', [true, 'Filter on User Account Control Setting.', 'ANY', OptEnum.new('UAC', [true, 'Filter on User Account Control Setting.', 'ANY',
[ [
'ANY', 'ANY',
'NO_PASSWORD', 'NO_PASSWORD',
'CHANGE_PASSWORD', 'CHANGE_PASSWORD',
'NEVER_EXPIRES', 'NEVER_EXPIRES',
'SMARTCARD_REQUIRED', 'SMARTCARD_REQUIRED',
'NEVER_LOGGEDON' 'NEVER_LOGGEDON'
]]) ]])
], self.class) ], self.class)
end end
def run def run
@ -74,16 +74,17 @@ class Metasploit3 < Msf::Post
begin begin
q = query(search_filter, max_search, fields) q = query(search_filter, max_search, fields)
if q.nil? || q[:results].empty?
print_status('No results returned.')
return
end
rescue ::RuntimeError, ::Rex::Post::Meterpreter::RequestError => e rescue ::RuntimeError, ::Rex::Post::Meterpreter::RequestError => e
# Can't bind or in a network w/ limited accounts # Can't bind or in a network w/ limited accounts
print_error(e.message) print_error(e.message)
return return
end end
if q.nil? || q[:results].empty?
print_status('No results returned.')
return
end
# Results table holds raw string data # Results table holds raw string data
results_table = Rex::Ui::Text::Table.new( results_table = Rex::Ui::Text::Table.new(
'Header' => "Domain Users", 'Header' => "Domain Users",