class RubyNessus::Version2::Event

Public Class Methods

new(event) click to toggle source
# File lib/ruby-nessus/version2/event.rb, line 8
def initialize(event)
  @event = event
end

Public Instance Methods

bid() click to toggle source

Return the event bid.

@return [Array<String>, nil]

Return the event bid.
# File lib/ruby-nessus/version2/event.rb, line 286
def bid
  unless @bid
    @bid = []
    @event.xpath('bid').each do |bid|
      @bid << bid.inner_text
    end
    @bid = nil if @bid.empty?
  end
  @bid
end
canvas_package() click to toggle source

Return the name of the CANVAS exploit package

@return [String, nil]

Return the canvas_package.
# File lib/ruby-nessus/version2/event.rb, line 375
def canvas_package
  @canvas_package ||= @event.at('canvas_package')&.inner_text
end
cpe() click to toggle source

Return the event cpe.

@return [Array<String>]

Return the event cpe.
# File lib/ruby-nessus/version2/event.rb, line 329
def cpe
  unless @cpe
    @cpe = []
    @event.xpath('cpe').each do |cpe|
      @cpe << cpe.inner_text
    end
  end
  @cpe
end
critical?() click to toggle source

Return true if the event is of critical severity.

@return [Boolean]

Return true if the event is critical severity.
# File lib/ruby-nessus/version2/event.rb, line 87
def critical?
  severity == 4
end
cve() click to toggle source

Return the event cve.

@return [Array<String>, nil]

Return the event cvss base score.
# File lib/ruby-nessus/version2/event.rb, line 269
def cve
  unless @cve
    @cve = []
    @event.xpath('cve').each do |cve|
      @cve << cve.inner_text
    end
    @cve = nil if @cve.empty?
  end
  @cve
end
cvss_base_score() click to toggle source

Return the event cvss base score.

@return [float, nil]

Return the event cvss base score.
# File lib/ruby-nessus/version2/event.rb, line 249
def cvss_base_score
  @cvss_base_score ||= @event.at('cvss_base_score')&.inner_text.to_f
end
cvss_temporal_score() click to toggle source

Return the event cvss temporal score.

@return [float, nil]

Return the event cvss temporal score.
# File lib/ruby-nessus/version2/event.rb, line 259
def cvss_temporal_score
  @cvss_temporal_score ||= @event.at('cvss_temporal_score')&.inner_text.to_f
end
cvss_vector() click to toggle source

Return other event cvss vector.

@return [String, nil]

Return the event cvss vector.
# File lib/ruby-nessus/version2/event.rb, line 319
def cvss_vector
  @cvss_vector ||= @event.at('cvss_vector')&.inner_text
end
data()
Alias for: output
description() click to toggle source

Return the event description.

@return [String, nil]

Return the event description.
# File lib/ruby-nessus/version2/event.rb, line 163
def description
  @description ||= @event.at('description')&.inner_text
end
exploit_available() click to toggle source

Return event exploit available.

@return [Boolean]

Return the event exploit available.
# File lib/ruby-nessus/version2/event.rb, line 355
def exploit_available
  @exploit_available ||= @event.at('exploit_available')&.inner_text == "true"
end
exploit_framework_canvas() click to toggle source

Return if an exploit exists in the Immunity CANVAS framework.

@return [Boolean]

Return the event exploit framework canvas.
# File lib/ruby-nessus/version2/event.rb, line 365
def exploit_framework_canvas
  @exploit_framework_canvas ||= @event.at('exploit_framework_canvas')&.inner_text == "true"
end
exploit_framework_core() click to toggle source

Return if an exploit exploit exists in the CORE Impact framework

@return [Boolean]

Return the event exploit framework core.
# File lib/ruby-nessus/version2/event.rb, line 405
def exploit_framework_core
  @exploit_framework_core ||= @event.at('exploit_framework_core')&.inner_text == "true"
end
exploit_framework_metasploit() click to toggle source

Return if an exploit exploit exists in the Metasploit framework

@return [Boolean]

Return the event exploit framework metasploit.
# File lib/ruby-nessus/version2/event.rb, line 385
def exploit_framework_metasploit
  @exploit_framework_metasploit ||= @event.at('exploit_framework_metasploit')&.inner_text == "true"
end
exploitability_ease() click to toggle source

Return event exploitability ease.

@return [String, nil]

Return the event exploitability ease.
# File lib/ruby-nessus/version2/event.rb, line 345
def exploitability_ease
  @exploitability_ease ||= @event.at('exploitability_ease')&.inner_text
end
family() click to toggle source

Return the event object plugin family name.

@return [String]

Return the event object plugin family name.

@example

event.family #=> "Service detection"
# File lib/ruby-nessus/version2/event.rb, line 114
def family
  @plugin_family ||= @event.at('@pluginFamily').inner_text
end
Also aliased as: plugin_family
high?() click to toggle source

Return true if the event is of high severity.

@return [Boolean]

Return true if the event is high severity.
# File lib/ruby-nessus/version2/event.rb, line 77
def high?
  severity == 3
end
id() click to toggle source

Return the event object nessus plugin id

@return [Integer]

Return the event object nessus plugin id

@example

event.plugin_id #=> 3245
# File lib/ruby-nessus/version2/event.rb, line 100
def id
  @plugin_id ||= @event.at('@pluginID').inner_text.to_i
end
Also aliased as: plugin_id
informational?() click to toggle source

Return true if event is of informational severity.

@return [Boolean]

Return true if the event is informational.
# File lib/ruby-nessus/version2/event.rb, line 47
def informational?
  severity == 0
end
low?() click to toggle source

Return true if the event is of low severity.

@return [Boolean]

Return true if the event is low severity.
# File lib/ruby-nessus/version2/event.rb, line 57
def low?
  severity == 1
end
medium?() click to toggle source

Return true if the event is of medium severity.

@return [Boolean]

Return true if the event is medium severity.
# File lib/ruby-nessus/version2/event.rb, line 67
def medium?
  severity == 2
end
metasploit_name() click to toggle source

Return name of the Metasploit exploit module.

@return [String, nil]

Return the metasploit_name.
# File lib/ruby-nessus/version2/event.rb, line 395
def metasploit_name
  @metasploit_name ||= @event.at('metasploit_name')&.inner_text
end
more()
Alias for: see_also
name()
Alias for: plugin_name
output() click to toggle source

Return the event plugin output.

@return [String, nil]

Return the event plugin output.
# File lib/ruby-nessus/version2/event.rb, line 193
def output
  @plugin_output ||= @event.at('plugin_output')&.inner_text
end
Also aliased as: data, plugin_output
patch_publication_date() click to toggle source

Return the event patch publication date.

@return [Time, nil]

Return the event patch publication date.
# File lib/ruby-nessus/version2/event.rb, line 239
def patch_publication_date
  @patch_publication_date ||= Time.parse(@event.at('patch_publication_date').inner_text + ' UTC') if @event.at('patch_publication_date')
end
plugin_family()
Alias for: family
plugin_id()
Alias for: id
plugin_name() click to toggle source

Return the event name (plugin_name)

@return [String, nil]

Return the event name (plugin_name)

@example

event.plugin_name   #=> "PHP < 5.2.4 Multiple Vulnerabilities"
event.name          #=> "PHP < 5.2.4 Multiple Vulnerabilities"
# File lib/ruby-nessus/version2/event.rb, line 129
def plugin_name
  @plugin_name ||= @event.at('@pluginName')&.inner_text unless @event.at('@pluginName').inner_text.empty?
end
Also aliased as: name
plugin_output()
Alias for: output
plugin_type() click to toggle source

Return the event object plugin type (plugin_type)

@return [String, nil]

Return the event object plugin type (plugin_type)

@example

event.plugin_type   #=> "remote"
# File lib/ruby-nessus/version2/event.rb, line 143
def plugin_type
  @plugin_type ||= @event.at('plugin_type')&.inner_text
end
plugin_version()
Alias for: version
port() click to toggle source

Return the event port.

@return [Object]

Return the event port object or port string.

@example

event.port            #=> "https (443/tcp)"
event.port.number     #=> 443
event.port.service    #=> "https"
event.port.protocol   #=> "tcp"
# File lib/ruby-nessus/version2/event.rb, line 24
def port
  @port ||= Port.new(@event.at('@port'), @event.at('@svc_name'), @event.at('@protocol'))
end
references()
Alias for: see_also
risk() click to toggle source

Return the event risk.

@return [String, nil]

Return the event risk.
# File lib/ruby-nessus/version2/event.rb, line 183
def risk
  @risk_factor ||= @event.at('risk_factor')&.inner_text
end
see_also() click to toggle source

Return the event reference links.

@return [Array<String>]

Return the event reference links.
# File lib/ruby-nessus/version2/event.rb, line 216
def see_also
  @see_also ||= @event.at('see_also')&.inner_text&.split("\n")
end
Also aliased as: links, more, references
severity() click to toggle source

Return the event severity.

@return [Integer]

Return the event severity.

@example

event.severity          #=> 3
# File lib/ruby-nessus/version2/event.rb, line 37
def severity
  @severity ||= @event.at('@severity').inner_text.to_i
end
solution() click to toggle source

Return the event solution.

@return [String, nil]

Return the event solution.
# File lib/ruby-nessus/version2/event.rb, line 173
def solution
  @solution ||= @event.at('solution')&.inner_text
end
synopsis() click to toggle source

Return the event synopsis.

@return [String, nil]

Return the event synopsis.
# File lib/ruby-nessus/version2/event.rb, line 153
def synopsis
  @synopsis ||= @event.at('synopsis')&.inner_text
end
version() click to toggle source

Return the event plugin version.

@return [String, nil]

Return the event plugin version.
# File lib/ruby-nessus/version2/event.rb, line 205
def version
  @plugin_version ||= @event.at('plugin_version')&.inner_text
end
Also aliased as: plugin_version
vuln_publication_date() click to toggle source

Return the event vulnerability publication date.

@return [Time, nil]

Return the event vulnerability publication date.
# File lib/ruby-nessus/version2/event.rb, line 229
def vuln_publication_date
  @vuln_publication_date ||= Time.parse(@event.at('vuln_publication_date').inner_text + ' UTC') if @event.at('vuln_publication_date')
end
xref() click to toggle source

Return other event related references.

@return [Array<String>]

Return the event related references.
# File lib/ruby-nessus/version2/event.rb, line 303
def xref
  unless @xref
    @xref = []
    @event.xpath('xref').each do |xref|
      @xref << xref.inner_text
    end
  end
  @xref
end