@@ -31,48 +31,49 @@ def start_element(name=nil,attrs=[])
31
31
def end_element ( name = nil )
32
32
block = @block
33
33
case name
34
- when "name"
35
- return if not in_tag ( "result" )
36
- @state [ :has_text ] = true
37
- @state [ :vuln_name ] = @text . strip if @text
38
- when "description"
34
+ when 'name'
35
+ if in_tag ( 'result' )
36
+ @state [ :has_text ] = true
37
+ @state [ :vuln_name ] = @text . strip if @text
38
+ end
39
+ when 'description'
39
40
@state [ :has_text ] = true
40
41
@state [ :vuln_desc ] = @text . strip if @text
41
- when " bid"
42
- return unless in_tag ( " result" )
43
- return unless in_tag ( "nvt" )
44
- @state [ :has_text ] = true
45
- @state [ :bid ] = @text . strip if @text
46
- when " cve"
47
- return unless in_tag ( " result" )
48
- return unless in_tag ( "nvt" )
49
- @state [ :has_text ] = true
50
- @state [ :cves ] = @text . strip if @text
51
- when " risk_factor"
52
- return unless in_tag ( " result" )
53
- return unless in_tag ( "nvt" )
54
- # we do this to clean out the buffer so to speak
55
- #if we don't set text to nil now, the text will show up later
56
- @state [ :has_text ] = true
57
- when " cvss_base"
58
- return unless in_tag ( " result" )
59
- return unless in_tag ( "nvt" )
60
- @state [ :has_text ] = true
61
- when " subnet"
42
+ when ' bid'
43
+ if in_tag ( ' result' ) && in_tag ( 'nvt' )
44
+ @state [ :has_text ] = true
45
+ @state [ :bid ] = @text . strip if @text
46
+ end
47
+ when ' cve'
48
+ if in_tag ( ' result' ) && in_tag ( 'nvt' )
49
+ @state [ :has_text ] = true
50
+ @state [ :cves ] = @text . strip if @text
51
+ end
52
+ when ' risk_factor'
53
+ if in_tag ( ' result' ) && in_tag ( 'nvt' )
54
+ #we do this to clean out the buffer so to speak
55
+ #if we don't set text to nil now, the text will show up later
56
+ @state [ :has_text ] = true
57
+ end
58
+ when ' cvss_base'
59
+ if in_tag ( ' result' ) && in_tag ( 'nvt' )
60
+ @state [ :has_text ] = true
61
+ end
62
+ when ' subnet'
62
63
@state [ :has_text ] = true
63
- when " result"
64
- record_vuln if in_tag ( " results" )
65
- when " threat"
66
- @state [ :has_text ] = true if in_tag ( " ports" ) && in_tag ( " port" )
67
- when " host"
64
+ when ' result'
65
+ record_vuln if in_tag ( ' results' )
66
+ when ' threat'
67
+ @state [ :has_text ] = true if in_tag ( ' ports' ) && in_tag ( ' port' )
68
+ when ' host'
68
69
if in_tag ( 'result' )
69
70
@state [ :has_text ] = true
70
71
@state [ :host ] = @text . strip if @text
71
72
elsif in_tag ( 'ports' ) && in_tag ( 'port' )
72
73
@state [ :has_text ] = true
73
74
@state [ :host ] = @text . strip if @text
74
75
end
75
- when " port"
76
+ when ' port'
76
77
if in_tag ( 'result' )
77
78
@state [ :has_text ] = true
78
79
if @text && @text . index ( '(' )
@@ -102,8 +103,8 @@ def end_element(name=nil)
102
103
record_service unless @state [ :port ] == 'general'
103
104
end
104
105
end
105
- when " name"
106
- return if not in_tag ( " result" )
106
+ when ' name'
107
+ return if not in_tag ( ' result' )
107
108
@state [ :has_text ] = true
108
109
end
109
110
0 commit comments