Land #17980, Fix Powershell session's #exist?

Replace [System.IO.File]::Exists with Test-Path
This commit is contained in:
Spencer McIntyre
2023-05-11 09:10:43 -04:00
+1 -1
View File
@@ -305,7 +305,7 @@ module Msf::Post::File
end
return !!stat
elsif session.type == 'powershell'
return cmd_exec("[System.IO.File]::Exists( \"#{path}\")")&.include?('True')
return cmd_exec("Test-Path \"#{path}\"")&.include?('True')
else
if session.platform == 'windows'
f = cmd_exec("cmd.exe /C IF exist \"#{path}\" ( echo true )")