Skip to content

Commit 87be2e6

Browse files
committed
Rebase on rapid7#2831 and adapt to the new mixin
1 parent 808f87d commit 87be2e6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/msf/core/exploit/smb/psexec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def smb_read_file(smbshare, host, file)
5252
# @param command [String] Should be a valid windows command
5353
# @param disconnect [Boolean] Disconnect afterwards
5454
# @return [Boolean] Whether everything went well
55-
def psexec(command, disconnect=true, service_description=nil)
55+
def psexec(command, disconnect=true, service_description=nil, service_name=nil, display_name=nil)
5656
simple.connect("\\\\#{datastore['RHOST']}\\IPC$")
5757
handle = dcerpc_handle('367abb81-9844-35f1-ad32-98f038001003', '2.0', 'ncacn_np', ["\\svcctl"])
5858
vprint_status("#{peer} - Binding to #{handle} ...")
@@ -70,8 +70,9 @@ def psexec(command, disconnect=true, service_description=nil)
7070
print_error("#{peer} - Error getting scm handle: #{e}")
7171
return false
7272
end
73-
servicename = Rex::Text.rand_text_alpha(11)
74-
displayname = Rex::Text.rand_text_alpha(16)
73+
servicename = service_name || Rex::Text.rand_text_alpha(11)
74+
displayname = display_name || Rex::Text.rand_text_alpha(16)
75+
servicedescription = service_description || Rex::Text.rand_text_alpha(rand(32)+1)
7576

7677
svc_handle = nil
7778
svc_status = nil

0 commit comments

Comments
 (0)