Rebase on https://github.com/rapid7/metasploit-framework/pull/2831 and adapt to the new mixin
parent
808f87d213
commit
87be2e674a
|
@ -52,7 +52,7 @@ module Exploit::Remote::SMB::Psexec
|
|||
# @param command [String] Should be a valid windows command
|
||||
# @param disconnect [Boolean] Disconnect afterwards
|
||||
# @return [Boolean] Whether everything went well
|
||||
def psexec(command, disconnect=true, service_description=nil)
|
||||
def psexec(command, disconnect=true, service_description=nil, service_name=nil, display_name=nil)
|
||||
simple.connect("\\\\#{datastore['RHOST']}\\IPC$")
|
||||
handle = dcerpc_handle('367abb81-9844-35f1-ad32-98f038001003', '2.0', 'ncacn_np', ["\\svcctl"])
|
||||
vprint_status("#{peer} - Binding to #{handle} ...")
|
||||
|
@ -70,8 +70,9 @@ module Exploit::Remote::SMB::Psexec
|
|||
print_error("#{peer} - Error getting scm handle: #{e}")
|
||||
return false
|
||||
end
|
||||
servicename = Rex::Text.rand_text_alpha(11)
|
||||
displayname = Rex::Text.rand_text_alpha(16)
|
||||
servicename = service_name || Rex::Text.rand_text_alpha(11)
|
||||
displayname = display_name || Rex::Text.rand_text_alpha(16)
|
||||
servicedescription = service_description || Rex::Text.rand_text_alpha(rand(32)+1)
|
||||
|
||||
svc_handle = nil
|
||||
svc_status = nil
|
||||
|
|
Loading…
Reference in New Issue