Module: Msf::DBManager::HostTag
- Included in:
- Msf::DBManager
- Defined in:
- lib/msf/core/db_manager/host_tag.rb
Instance Method Summary collapse
-
#report_host_tag(opts) ⇒ Object
This is only exercised by MSF3 XML importing for now.
Instance Method Details
#report_host_tag(opts) ⇒ Object
This is only exercised by MSF3 XML importing for now. Needs the wait conditions and return hash as well.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/msf/core/db_manager/host_tag.rb', line 4 def report_host_tag(opts) opts = opts.clone() # protect the original caller's opts name = opts.delete(:name) raise Msf::DBImportError.new("Missing required option :name") unless name addr = opts.delete(:addr) raise Msf::DBImportError.new("Missing required option :addr") unless addr ::ApplicationRecord.connection_pool.with_connection { wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework) raise Msf::DBImportError.new("Missing required option :workspace") unless wspace host = nil report_host(:workspace => wspace, :address => addr) host = get_host(:workspace => wspace, :address => addr) desc = opts[:desc] summary = opts[:summary] detail = opts[:detail] crit = opts[:crit] = Mdm::Tag.includes(:hosts).where("hosts.workspace_id = ? and tags.name = ?", wspace.id, name).order("tags.id DESC").limit(1) tag = (.blank? ? Mdm::Tag.new : .first) tag.name = name tag.desc = desc tag.report_summary = !!summary tag.report_detail = !!detail tag.critical = !!crit tag.hosts = tag.hosts | [host] tag.save! if tag.changed? } end |