Module: Msf::DBManager::HostDetail

Included in:
Msf::DBManager
Defined in:
lib/msf/core/db_manager/host_detail.rb

Instance Method Summary collapse

Instance Method Details

#report_host_details(host, details) ⇒ Object

Populate the host_details table with additional information, matched by a specific criteria


6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/msf/core/db_manager/host_detail.rb', line 6

def report_host_details(host, details)
::ApplicationRecord.connection_pool.with_connection {

  detail = ::Mdm::HostDetail.where(( details.delete(:key) || {} ).merge(:host_id => host.id)).first
  if detail
    details.each_pair do |k,v|
      detail[k] = v
    end
    detail.save! if detail.changed?
    detail
  else
    detail = ::Mdm::HostDetail.create(details.merge(:host_id => host.id))
  end
}
end