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
|
# 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|
finding = Finding.new()
finding.title = issue.css('name').text.to_s()
finding.overview = issue.css('info').text.to_s()
finding.risk = 0 finding.remediation = ""
finding.id = issue.css('id').text.to_s()
findings << finding.to_hash
end
vulns[host] = findings
end
return vulns.to_json
end
|