Class: Nessus::Version2::Event
- Inherits:
-
Object
- Object
- Nessus::Version2::Event
- Defined in:
- lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb
Instance Method Summary collapse
-
#bid ⇒ String, false
Return the event bid.
-
#critical? ⇒ Boolean
Return true if the event is of critical severity.
-
#cve ⇒ String, false
Return the event cve.
-
#cvss_base_score ⇒ String, false
Return the event cvss base score.
-
#cvss_vector ⇒ String, false
Return other event cvss vector.
-
#description ⇒ String, false
Return the event description.
-
#family ⇒ String
(also: #plugin_family)
Return the event object plugin family name.
-
#high? ⇒ Boolean
Return ture if the event is of high severity.
-
#id ⇒ String
(also: #plugin_id)
Return the event object nessus plugin id.
-
#informational? ⇒ Boolean
Return true if event is of informational severity.
-
#initialize(event) ⇒ Event
constructor
A new instance of Event.
-
#low? ⇒ Boolean
Return ture if the event is of low severity.
-
#medium? ⇒ Boolean
Return ture if the event is of medium severity.
-
#output ⇒ String, false
(also: #data, #plugin_output)
Return the event plugin output.
-
#patch_publication_date ⇒ String, false
Return the event patch publication date.
-
#plugin_name ⇒ String, false
(also: #name)
Return the event name (plugin_name).
-
#port ⇒ Object
Return the event port.
-
#risk ⇒ String, false
Return the event risk.
-
#see_also ⇒ String, false
(also: #links, #more, #references)
Return the event reference links.
-
#severity ⇒ String
Return the event severity.
-
#solution ⇒ String, false
Return the event solution.
-
#synopsis ⇒ String, false
Return the event synopsis.
-
#version ⇒ String, false
(also: #plugin_version)
Return the event plugin version.
-
#xref ⇒ String, false
Return other event related references.
Constructor Details
#initialize(event) ⇒ Event
Returns a new instance of Event.
8 9 10 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 8 def initialize(event) @event = event end |
Instance Method Details
#bid ⇒ String, false
Return the event bid.
299 300 301 302 303 304 305 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 299 def bid @bid ||= if @event.at('bid') @event.at('bid').inner_text.to_i else false end end |
#critical? ⇒ Boolean
Return true if the event is of critical severity.
90 91 92 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 90 def critical? severity == 4 end |
#cve ⇒ String, false
Return the event cve.
285 286 287 288 289 290 291 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 285 def cve @cve ||= if @event.at('cve') @event.at('cve').inner_text else false end end |
#cvss_base_score ⇒ String, false
Return the event cvss base score.
271 272 273 274 275 276 277 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 271 def cvss_base_score @cvss_base_score ||= if @event.at('cvss_base_score') @event.at('cvss_base_score').inner_text.to_f else false end end |
#cvss_vector ⇒ String, false
Return other event cvss vector.
329 330 331 332 333 334 335 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 329 def cvss_vector @cvss_vector ||= if @event.at('cvss_vector') @event.at('cvss_vector').inner_text else false end end |
#description ⇒ String, false
Return the event description.
165 166 167 168 169 170 171 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 165 def description @description ||= if @event.at('description') @event.at('description').inner_text else false end end |
#family ⇒ String Also known as: plugin_family
Return the event object plugin family name.
117 118 119 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 117 def family @plugin_family ||= @event.at('@pluginFamily').inner_text end |
#high? ⇒ Boolean
Return ture if the event is of high severity.
80 81 82 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 80 def high? severity == 3 end |
#id ⇒ String Also known as: plugin_id
Return the event object nessus plugin id
103 104 105 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 103 def id @plugin_id ||= @event.at('@pluginID').inner_text.to_i end |
#informational? ⇒ Boolean
Return true if event is of informational severity.
50 51 52 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 50 def informational? severity == 0 end |
#low? ⇒ Boolean
Return ture if the event is of low severity.
60 61 62 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 60 def low? severity == 1 end |
#medium? ⇒ Boolean
Return ture if the event is of medium severity.
70 71 72 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 70 def medium? severity == 2 end |
#output ⇒ String, false Also known as: data, plugin_output
Return the event plugin output.
207 208 209 210 211 212 213 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 207 def output @plugin_output ||= if @event.at('plugin_output') @event.at('plugin_output').inner_text else false end end |
#patch_publication_date ⇒ String, false
Return the event patch publication date.
257 258 259 260 261 262 263 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 257 def patch_publication_date @patch_publication_date ||= if @event.at('patch_publication_date') DateTime.strptime(@event.at('patch_publication_date').inner_text, fmt='%Y/%m/%d') else false end end |
#plugin_name ⇒ String, false Also known as: name
Return the event name (plugin_name)
132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 132 def plugin_name s = @event.at('@pluginName').inner_text @plugin_name ||= if s.empty? false else @event.at('@pluginName').inner_text end return @plugin_name end |
#port ⇒ Object
Return the event port.
24 25 26 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 24 def port @port ||= Port.new(@event.at('@port'), @event.at('@svc_name'), @event.at('@protocol')) end |
#risk ⇒ String, false
Return the event risk.
193 194 195 196 197 198 199 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 193 def risk @risk_factor ||= if @event.at('risk_factor') @event.at('risk_factor').inner_text else false end end |
#see_also ⇒ String, false Also known as: links, more, references
Return the event reference links.
238 239 240 241 242 243 244 245 246 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 238 def see_also unless @see_also @see_also = [] @event.xpath("see_also").each do |see_also| @see_also << see_also.inner_text end end @see_also end |
#severity ⇒ String
Return the event severity.
40 41 42 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 40 def severity @severity ||= @event.at('@severity').inner_text.to_i end |
#solution ⇒ String, false
Return the event solution.
179 180 181 182 183 184 185 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 179 def solution @solution ||= if @event.at('solution') @event.at('solution').inner_text else false end end |
#synopsis ⇒ String, false
Return the event synopsis.
151 152 153 154 155 156 157 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 151 def synopsis @synopsis ||= if @event.at('synopsis') @event.at('synopsis').inner_text else false end end |
#version ⇒ String, false Also known as: plugin_version
Return the event plugin version.
223 224 225 226 227 228 229 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 223 def version @plugin_version ||= if @event.at('plugin_version') @event.at('plugin_version').inner_text else false end end |
#xref ⇒ String, false
Return other event related references.
313 314 315 316 317 318 319 320 321 |
# File 'lib/gemcache/ruby-nessus/ruby-nessus/Version2/event.rb', line 313 def xref unless @xref @xref = [] @event.xpath("xref").each do |xref| @xref << xref.inner_text end end @xref end |