Land #18104, fix falsely caused empty file reads
This issue was happening frequently with the java metepreter. The issue has been fixed and tested with test/file post module.
This commit is contained in:
commit
4c73067dfe
|
@ -831,13 +831,14 @@ protected
|
|||
def _read_file_meterpreter(file_name)
|
||||
fd = session.fs.file.new(file_name, 'rb')
|
||||
|
||||
data = fd.read
|
||||
data = ''.b
|
||||
data << fd.read
|
||||
data << fd.read until fd.eof?
|
||||
|
||||
data
|
||||
rescue EOFError
|
||||
# Sometimes fd isn't marked EOF in time?
|
||||
''
|
||||
data
|
||||
rescue ::Rex::Post::Meterpreter::RequestError => e
|
||||
print_error("Failed to open file: #{file_name}: #{e}")
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue