diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb index 72d7f277cd..7b4a120f8c 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/fs.rb @@ -124,14 +124,18 @@ class Console::CommandDispatcher::Stdapi::Fs return true end - fd = client.fs.file.new(args[0], "rb") + if (client.fs.stat(args[0]).directory?) + print_error("#{args[0]} is a directory") + else + fd = client.fs.file.new(args[0], "rb") - until fd.eof? - print(fd.read) + until fd.eof? + print(fd.read) + end + + fd.close end - fd.close - true end