Skip to content

Commit 03698ec

Browse files
committed
Fix how the psh mixing issues meterpreter commands
1 parent 91a4657 commit 03698ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def initialize(info = {})
2929
# Returns true if powershell is installed
3030
#
3131
def have_powershell?
32-
cmd_exec('cmd.exe /c "echo. | powershell get-host"') =~ /Name.*Version.*InstanceId/m
32+
cmd_exec('cmd.exe', '/c "echo. | powershell get-host"') =~ /Name.*Version.*InstanceId/m
3333
end
3434

3535
#
@@ -88,9 +88,9 @@ def execute_script(script, greedy_kill = false)
8888
script = encode_script(script.to_s)
8989
end
9090

91-
ps_string = "#{ps_bin} -EncodedCommand #{script} -InputFormat None"
92-
vprint_good "EXECUTING:\n#{ps_string}"
93-
cmd_out = session.sys.process.execute(ps_string, nil, { 'Hidden' => true, 'Channelized' => true })
91+
ps_string = "-EncodedCommand #{script} -InputFormat None"
92+
vprint_good "EXECUTING:\n#{ps_bin} #{ps_string}"
93+
cmd_out = session.sys.process.execute(ps_bin, ps_string, { 'Hidden' => true, 'Channelized' => true })
9494

9595
# Subtract prior PIDs from current
9696
if greedy_kill

0 commit comments

Comments
 (0)