Metasploit mailing list archives
checking file existence on meterpreter client
From: Joshua Smith <lazydj98 () gmail com>
Date: Fri, 4 Dec 2009 17:21:43 -0500
I'm writing a meterpreter script. At one point I'm checking the existence
of a file on the target.
I can easily do
if client.fs.file.stat(file2find).file?
but that throws an error when the file doesn't exist (stdapi_fs_stat:
operation failed: 2)
neither client.fs.file.stat nor client.fs.file has a .exist? function like
::File.exist?(file2find) on the server side
What's the easiest way to check for file existence on the meterpreter client
side?
Do I just have to handle the error thrown, something like?
begin
stat = client.fs.file.stat.new(file2find)
rescue
print_status("File not found")
end
if stat.file?
do stuff
end
Sorry if this is a dumb question
--
- Josh
_______________________________________________ https://mail.metasploit.com/mailman/listinfo/framework
Current thread:
- checking file existence on meterpreter client Joshua Smith (Dec 04)
- Re: checking file existence on meterpreter client HD Moore (Dec 04)
