Skip to content

Commit 41ba2d2

Browse files
committed
Address PR feedback
Simplify the application_key usage, update docs and catch another exception.
1 parent 825604d commit 41ba2d2

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

documentation/modules/auxiliary/admin/dcerpc/samr_computer.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ computers to the domain. Administrative privileges however are required to delet
1414

1515
### SMBDomain
1616

17-
The Windows domain to use for authentication. If the target server has more than one domain present on it, this option
18-
must be set to the target domain. If the target server has only one domain present on it, the domain will automatically
19-
be identified.
17+
The Windows domain to use for authentication. The domain will automatically be identified if this option is left in its
18+
default value.
2019

2120
### COMPUTER_NAME
2221

@@ -65,14 +64,15 @@ msf6 auxiliary(admin/dcerpc/samr_computer) > show options
6564
6665
Module options (auxiliary/admin/dcerpc/samr_computer):
6766
68-
Name Current Setting Required Description
69-
---- --------------- -------- -----------
70-
COMPUTER_NAME no The computer name
71-
RHOSTS 192.168.159.96 yes The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
72-
RPORT 445 yes The target port (TCP)
73-
SMBDomain . no The Windows domain to use for authentication
74-
SMBPass Password1 no The password for the specified username
75-
SMBUser aliddle no The username to authenticate as
67+
Name Current Setting Required Description
68+
---- --------------- -------- -----------
69+
COMPUTER_NAME no The computer name
70+
COMPUTER_PASSWORD no The password for the new computer
71+
RHOSTS 192.168.159.96 yes The target host(s), see https://github.com/rapid7/metasploit-framework/wiki/Using-Metasploit
72+
RPORT 445 yes The target port (TCP)
73+
SMBDomain . no The Windows domain to use for authentication
74+
SMBPass Password1 no The password for the specified username
75+
SMBUser aliddle no The username to authenticate as
7676
7777
7878
Auxiliary action:

modules/auxiliary/admin/dcerpc/samr_computer.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,12 @@ def run
115115
@domain_sid = @samr.samr_lookup_domain(server_handle: @server_handle, name: @domain_name)
116116
@domain_handle = @samr.samr_open_domain(server_handle: @server_handle, domain_id: @domain_sid)
117117
send("action_#{action.name.downcase}")
118-
rescue RubySMB::Dcerpc::Error::SamrError => e
118+
rescue RubySMB::Dcerpc::Error::DcerpcError => e
119119
elog(e.message, error: e)
120120
fail_with(Failure::UnexpectedReply, e.message)
121+
rescue RubySMB::Error::RubySMBError
122+
elog(e.message, error: e)
123+
fail_with(Failure::Unknown, e.message)
121124
end
122125

123126
def random_hostname(prefix: 'DESKTOP')
@@ -164,7 +167,7 @@ def action_add_computer
164167
user_password: {
165168
buffer: RubySMB::Dcerpc::Samr::SamprEncryptedUserPasswordNew.encrypt_password(
166169
password,
167-
@simple.client.application_key.blank? ? @simple.client.session_key : @simple.client.application_key
170+
@simple.client.application_key
168171
)
169172
}
170173
)

0 commit comments

Comments
 (0)