Skip to content

Commit 084fc19

Browse files
committed
Add the LOOKUP_COMPUTER action
1 parent 74936f6 commit 084fc19

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modules/auxiliary/admin/dcerpc/samr_computer.rb

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def initialize(info = {})
3232
},
3333
'Actions' => [
3434
[ 'ADD_COMPUTER', { 'Description' => 'Add a computer account' } ],
35+
[ 'LOOKUP_COMPUTER', { 'Description' => 'Lookup a computer account' } ]
3536
],
3637
'DefaultAction' => 'ADD_COMPUTER'
3738
)
@@ -164,6 +165,20 @@ def action_add_computer
164165
report_creds(@domain_name, computer_name, password)
165166
end
166167

168+
def action_lookup_computer
169+
fail_with(Failure::BadConfig, 'This action requires COMPUTER_NAME to be specified.') if datastore['COMPUTER_NAME'].blank?
170+
computer_name = datastore['COMPUTER_NAME']
171+
172+
details = @samr.samr_lookup_names_in_domain(domain_handle: @domain_handle, names: [ computer_name ])
173+
if details.nil?
174+
print_error('The specified computer was not found.')
175+
return
176+
end
177+
details = details[computer_name]
178+
sid = @samr.samr_rid_to_sid(object_handle: @domain_handle, rid: details[:rid]).to_s
179+
print_good("Found #{@domain_name}\\#{computer_name} (SID: #{sid})")
180+
end
181+
167182
def report_creds(domain, username, password)
168183
service_data = {
169184
address: datastore['RHOST'],

0 commit comments

Comments
 (0)