Class: Nessana::Vulnerability

Inherits:
Object
  • Object
show all
Defined in:
lib/nessana/vulnerability.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(plugin_id, cve, cvss, risk, name, synopsis, description, solution, see_also, plugin_output) ⇒ Vulnerability

Returns a new instance of Vulnerability.



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nessana/vulnerability.rb', line 9

def initialize(plugin_id, cve, cvss, risk, name, synopsis, description, solution, see_also, plugin_output)
  @plugin_id = plugin_id
  @cve = cve
  @cvss = cvss
  @risk = risk
  @name = name
  @synopsis = reformat_multiline(synopsis)
  @description = reformat_multiline(description)
  @solution = solution
  @see_also = see_also
  @plugin_output = plugin_output
end

Instance Attribute Details

#cveObject (readonly)

Returns the value of attribute cve.



4
5
6
# File 'lib/nessana/vulnerability.rb', line 4

def cve
  @cve
end

#cvssObject (readonly)

Returns the value of attribute cvss.



4
5
6
# File 'lib/nessana/vulnerability.rb', line 4

def cvss
  @cvss
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/nessana/vulnerability.rb', line 5

def description
  @description
end

#detectionsObject

Returns the value of attribute detections.



7
8
9
# File 'lib/nessana/vulnerability.rb', line 7

def detections
  @detections
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/nessana/vulnerability.rb', line 5

def name
  @name
end

#plugin_idObject (readonly)

Returns the value of attribute plugin_id.



3
4
5
# File 'lib/nessana/vulnerability.rb', line 3

def plugin_id
  @plugin_id
end

#plugin_outputObject (readonly)

Returns the value of attribute plugin_output.



6
7
8
# File 'lib/nessana/vulnerability.rb', line 6

def plugin_output
  @plugin_output
end

#riskObject (readonly)

Returns the value of attribute risk.



4
5
6
# File 'lib/nessana/vulnerability.rb', line 4

def risk
  @risk
end

#see_alsoObject (readonly)

Returns the value of attribute see_also.



6
7
8
# File 'lib/nessana/vulnerability.rb', line 6

def see_also
  @see_also
end

#solutionObject (readonly)

Returns the value of attribute solution.



5
6
7
# File 'lib/nessana/vulnerability.rb', line 5

def solution
  @solution
end

#synopsisObject (readonly)

Returns the value of attribute synopsis.



5
6
7
# File 'lib/nessana/vulnerability.rb', line 5

def synopsis
  @synopsis
end

Instance Method Details

#add_detection(detection) ⇒ Object



22
23
24
25
# File 'lib/nessana/vulnerability.rb', line 22

def add_detection(detection)
  @detections ||= []
  @detections.push(detection)
end

#matches?(filters = []) ⇒ Boolean

Returns:

  • (Boolean)


31
32
33
34
35
36
37
# File 'lib/nessana/vulnerability.rb', line 31

def matches?(filters = [])
  filters.each do |filter|
    return true if filter.applies_to?(self)
  end

  false
end

#short_descriptionObject



43
44
45
46
# File 'lib/nessana/vulnerability.rb', line 43

def short_description
  "#{title_line}
#{@synopsis}"
end

#title_lineObject



39
40
41
# File 'lib/nessana/vulnerability.rb', line 39

def title_line
  "[Nessus #{@plugin_id || "???"}] #{@name || "Unknown Vulnerability"} (#{@risk || "Unknown Risk"})"
end

#to_sObject



27
28
29
# File 'lib/nessana/vulnerability.rb', line 27

def to_s
  [title_line, @synopsis, cve_s, cvss_s, description_s, solution_s, see_also_s].join("\n\n")
end