Sha256: e7df276767bc3c8e02f47ed7e95330428d34fc48ac46912e1a6603c6422ac000
Contents?: true
Size: 1.77 KB
Versions: 19
Compression:
Stored size: 1.77 KB
Contents
module OpenVAS::V7 # The format is given by the OMPv5 :get_reports call (OpenVASv7 uses OMPv5). # # See: # http://www.openvas.org/omp-5-0.html#command_get_reports class Result < ::OpenVAS::Result private # This method parses the <tags> tag of the <result> entry and extracts the # available fields. Previous versions of the format (e.g. OpenVAS v6) # included these embedded fields in the <description> tag instead of the # <tags> tag, hence the not-so-intuitive name. def description_fields if @tag_fields.nil? delimiters = { # Not supported via .fields 'cvss_base_vector=' => :cvss_base_vector, 'impact=' => :impact, 'solution_type=' => :solution_type, # Not supported via .fields 'affected=' => :affected_software, 'insight=' => :insight, 'solution=' => :solution, 'summary=' => :summary, 'vuldetect=' => :vuldetect # Missing fields, these used to be available under <description> but it # doesn't look like they are under <tags> # 'Impact Level:' => :impact_level, # 'Information that was gathered:' => :info_gathered, } @tag_fields = {} current_field = nil buffer = '' clean_line = nil @xml.at_xpath('./nvt/tags').text().split('|').each do |tag_line| clean_line = tag_line.lstrip if clean_line.empty? buffer << "\n" next end delimiters.keys.each do |tag_name| if tag_line.starts_with?(tag_name) @tag_fields[delimiters[tag_name]] = clean_line[tag_name.length..-1] next end end end end @tag_fields end end end
Version data entries
19 entries across 19 versions & 1 rubygems