class Rex::Parser::RetinaXMLStreamParser

XXX - Retina XML does not include ANY service/port information export

Attributes

on_found_host[RW]

Public Class Methods

new(on_found_host = nil) click to toggle source
# File lib/rex/parser/retina_xml.rb, line 9
def initialize(on_found_host = nil)
  reset_state
  self.on_found_host = on_found_host if on_found_host
end

Public Instance Methods

attlist() click to toggle source
# File lib/rex/parser/retina_xml.rb, line 80
def attlist; end
cdata() click to toggle source
# File lib/rex/parser/retina_xml.rb, line 77
def cdata; end
comment(str) click to toggle source
# File lib/rex/parser/retina_xml.rb, line 78
def comment(str); end
instruction(name, instruction) click to toggle source
# File lib/rex/parser/retina_xml.rb, line 79
def instruction(name, instruction); end
reset_audit_state() click to toggle source
# File lib/rex/parser/retina_xml.rb, line 20
def reset_audit_state
  @audit = { 'refs' => [] }
end
reset_state() click to toggle source
# File lib/rex/parser/retina_xml.rb, line 14
def reset_state
  @state = :generic_state
  @host  = { 'vulns' => [] }
  reset_audit_state
end
tag_end(name) click to toggle source
# File lib/rex/parser/retina_xml.rb, line 64
def tag_end(name)
  case name
  when "host"
    on_found_host.call(@host) if on_found_host
    reset_state
  when "audit"
    @host['vulns'].push @audit
    reset_audit_state
  end
end
tag_start(name, attributes) click to toggle source
# File lib/rex/parser/retina_xml.rb, line 24
def tag_start(name, attributes)
  @state = "in_#{name.downcase}".intern
end
text(str) click to toggle source
# File lib/rex/parser/retina_xml.rb, line 28
def text(str)
  case @state
  when :in_ip
    @host["address"] = str
  when :in_dnsname
    @host["hostname"] = str.split(/\s+/).first
  when :in_netbiosname
    @host["netbios"] = str
  when :in_mac
    @host["mac"] = str
  when :in_os
    @host["os"] = str
  when :in_rthid
    @audit['refs'].push(['RETINA', str])
  when :in_cve
    str.split(",").each do |cve|
      cve = cve.to_s.strip
      next if cve.empty?
      pre,val = cve.split('-', 2)
      next if not val
      next if pre != "CVE"
      @audit['refs'].push( ['CVE', val] )
    end
  when :in_name
    @audit['name'] = str
  when :in_description
    @audit['description'] = str
  when :in_risk
    @audit['risk'] = str
  when :in_cce
    @audit['cce'] = str
  when :in_date
    @audit['data'] = str
  end
end
xmldecl(version, encoding, standalone) click to toggle source

We don't need these methods, but they're necessary to keep REXML happy

# File lib/rex/parser/retina_xml.rb, line 76
def xmldecl(version, encoding, standalone); end