From 50155919ea16cc4e35b56e986a3643d61b69b9d1 Mon Sep 17 00:00:00 2001 From: HD Moore Date: Fri, 15 Apr 2011 15:29:57 +0000 Subject: [PATCH] Add File.exists? as a wrapper to File.stat git-svn-id: file:///home/svn/framework3/trunk@12324 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb b/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb index cb7e7383e8..d9dab8c1b6 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/fs/file.rb @@ -96,7 +96,15 @@ Separator = "\\" def File.stat(name) return client.fs.filestat.new(name) end - + + # + # Determines if a file exists and returns true/false + # + def File.exists?(name) + r = client.fs.filestat.new(name) rescue nil + r ? true : false + end + # # Performs a delete on the specified file. #