From a7bed49e8abf8bd4d34d079e7c0f3d514b56fd6a Mon Sep 17 00:00:00 2001 From: pingport80 Date: Tue, 17 Aug 2021 16:39:23 +0530 Subject: [PATCH] update readable? for directories --- lib/msf/core/post/file.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msf/core/post/file.rb b/lib/msf/core/post/file.rb index 7c409eb7d7..c80fc6ecd2 100644 --- a/lib/msf/core/post/file.rb +++ b/lib/msf/core/post/file.rb @@ -254,11 +254,11 @@ module Msf::Post::File verification_token = Rex::Text::rand_text_alpha(8) return false unless exists?(path) if session.type == 'powershell' - if file?(path) + unless directory?(path) return cmd_exec("[System.IO.File]::OpenRead(\"#{path}\");if($?){echo\ #{verification_token}}").include?(verification_token) - elsif directory?(path) - return cmd_exec("Get-ChildItem -Path \"#{path}\"; if($?) {echo #{verification_token}}").include?(verification_token) + else + return cmd_exec("[System.IO.Directory]::GetFiles('#{path}'); if($?) {echo #{verification_token}}").include?(verification_token) end end