Method: Rex::Parser::NessusXMLStreamParser#tag_start

Defined in:
lib/rex/parser/nessus_xml.rb

#tag_start(name, attributes) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rex/parser/nessus_xml.rb', line 26

def tag_start(name, attributes)
  case name
  when "tag"
    if attributes['name'] == "mac-address"
      @state = :is_mac
    end
    if attributes['name'] == "host-fqdn"
      @state = :is_fqdn
    end
    if attributes['name'] == "ip-addr"
      @state = :is_ip
    end
    if attributes['name'] == "host-ip"
      @state = :is_ip
    end
    if attributes['name'] == "operating-system"
      @state = :is_os
    end
  when "ReportHost"
    @host['hname'] = attributes['name']
  when "ReportItem"
    @cve = Array.new
    @bid = Array.new
    @xref = Array.new
    @x = Hash.new
    @x['nasl'] = attributes['pluginID']
    @x['nasl_name'] = attributes['pluginName']
    @x['port'] = attributes['port']
    @x['proto'] = attributes['protocol']
    @x['svc_name'] = attributes['svc_name']
    @x['severity'] = attributes['severity']
  when "description"
    @state = :is_desc
  when "cve"
    @state = :is_cve
  when "bid"
    @state = :is_bid
  when "xref"
    @state = :is_xref
  when "solution"
    @state = :is_solution
  when "metasploit_name"
    @state = :msf
  end
end