Skip to content

Commit 42a17cc

Browse files
committed
Update powershell.rb
To be clear, the shell that was tested with was 'windows/shell_reverse_tcp' delivered via 'exploit/windows/smb/psexec' Additional changes required to fix regex to support the multiline output. Also, InstanceId uses a lower case 'D' on the platforms I tested - PowerShell 2.0 on Windows 2003, Windows 7, Windows 2008 R2 as well as PowerShell 4.0 on Windows 2012 R2. This method doesn't appear to be used anywhere in the Metasploit codebase currently.
1 parent 76b9273 commit 42a17cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Powershell
2020
#
2121
def have_powershell?
2222
cmd_out = cmd_exec("echo. | powershell get-host")
23-
return true if cmd_out =~ /Name.*Version.*InstanceID/
23+
return true if cmd_out =~ /Name.*Version.*InstanceId/m
2424
return false
2525
end
2626

0 commit comments

Comments
 (0)