Module: Msf::DBManager::VulnDetail

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

Instance Method Summary collapse

Instance Method Details

#report_vuln_details(vuln, details) ⇒ Object

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



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

def report_vuln_details(vuln, details)
::ApplicationRecord.connection_pool.with_connection {
  detail = ::Mdm::VulnDetail.where(( details.delete(:key) || {} ).merge(:vuln_id => vuln.id)).first
  if detail
    details.each_pair do |k,v|
      detail[k] = v
    end
    detail.save! if detail.changed?
    detail
  else
    detail = ::Mdm::VulnDetail.create(details.merge(:vuln_id => vuln.id))
  end
}
end

#update_vuln_details(details) ⇒ Object

Update vuln_details records en-masse based on specific criteria Note that this can update data across workspaces



25
26
27
28
29
30
31
32
# File 'lib/msf/core/db_manager/vuln_detail.rb', line 25

def update_vuln_details(details)
::ApplicationRecord.connection_pool.with_connection {
  criteria = details.delete(:key) || {}
  vuln_detail = ::Mdm::VulnDetail.find(key)
  vuln_detail.update!(criteria)
  return vuln_detail
}
end