11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/ruby_acunetix.rb', line 11
def self.parse(path)
report_items = []
doc = Nokogiri::XML(File.open(path))
doc.xpath('//ReportItems/ReportItem').map do |xml_report_item|
report_item = RaReportItem.new
[:Name, :ModuleName, :Details, :Affects, :Parameter, :AOP_SourceFile, :AOP_SourceLine, :IsFalsePositive, :Severity, :Type, :Impact, :Description, :DetailedInformation, :Recommendation, :Request].each do |field|
report_item.send("#{ra_underscore(field.to_s)}=", xml_report_item.css(field.to_s).text)
end
cwe = xml_report_item.css('CWEList')
report_item.send("cwe=", cwe.css('CWE').text) if !cwe.nil?
cve = xml_report_item.css('CVEList')
report_item.send("cve=", cwe.css('CVE').text) if !cwe.nil?
cvss = xml_report_item.css('CVSS')
report_item.cvss = RaCvss.parse(cvss) if !cvss.nil?
cvss3 = xml_report_item.css('CVSS3')
report_item.cvss3 = RaCvss3.parse(cvss3) if !cvss3.nil?
report_item.references = []
references = xml_report_item.css('References')
if !references.nil?
references.css('Reference').each do |reference|
report_item.references.push(RaReference.parse(reference))
end
end
report_items.push report_item
end
return report_items
end
|