Land #9976, Store non-nil linux enum_network loot
commit
5e968529bf
|
@ -421,22 +421,22 @@ protected
|
|||
#
|
||||
# @return [String]
|
||||
def _read_file_meterpreter(file_name)
|
||||
begin
|
||||
fd = session.fs.file.new(file_name, "rb")
|
||||
rescue ::Rex::Post::Meterpreter::RequestError => e
|
||||
print_error("Failed to open file: #{file_name}: #{e}")
|
||||
return nil
|
||||
end
|
||||
fd = session.fs.file.new(file_name, "rb")
|
||||
|
||||
data = fd.read
|
||||
begin
|
||||
until fd.eof?
|
||||
data << fd.read
|
||||
end
|
||||
ensure
|
||||
fd.close
|
||||
until fd.eof?
|
||||
data << fd.read
|
||||
end
|
||||
|
||||
data
|
||||
rescue EOFError
|
||||
# Sometimes fd isn't marked EOF in time?
|
||||
''
|
||||
rescue ::Rex::Post::Meterpreter::RequestError => e
|
||||
print_error("Failed to open file: #{file_name}: #{e}")
|
||||
return nil
|
||||
ensure
|
||||
fd.close if fd
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -74,6 +74,10 @@ class MetasploitModule < Msf::Post
|
|||
|
||||
# Save enumerated data
|
||||
def save(msg, data, ctype="text/plain")
|
||||
if data.nil? || data.include?('not found') || data.include?('cannot access')
|
||||
print_bad("Unable to get data for #{msg}")
|
||||
return
|
||||
end
|
||||
ltype = "linux.enum.network"
|
||||
loot = store_loot(ltype, ctype, session, data, nil, msg)
|
||||
print_good("#{msg} stored in #{loot.to_s}")
|
||||
|
|
Loading…
Reference in New Issue