Class: Metasploit

Inherits:
Object
  • Object
show all
Defined in:
lib/parsers/msfv5.rb

Instance Method Summary collapse

Instance Method Details

#parse(xml, threshold) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/parsers/msfv5.rb', line 5

def parse(xml,threshold)
  vulns = Hash.new
  vulns["findings"] = []

  doc = Nokogiri::XML(xml)
  doc.css('//hosts/host').each do |hostnode|
    findings = Array.new

    host = hostnode.css("/name").text.to_s

    hostnode.css("/vulns/vuln").each do |issue|
      # create a temporary finding object
      finding = Finding.new()
      finding.title = issue.css('name').text.to_s()
      finding.overview = issue.css('info').text.to_s()
      findings << finding.to_hash
    end
    vulns[host] = findings
  end

  #vulns["findings"] = uniq_findings(findings)
  return vulns.to_json
end