Class: Nessana::Vulnerability
- Inherits:
-
Object
- Object
- Nessana::Vulnerability
- Defined in:
- lib/nessana/vulnerability.rb
Instance Attribute Summary collapse
-
#cve ⇒ Object
readonly
Returns the value of attribute cve.
-
#cvss ⇒ Object
readonly
Returns the value of attribute cvss.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#detections ⇒ Object
Returns the value of attribute detections.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plugin_id ⇒ Object
readonly
Returns the value of attribute plugin_id.
-
#plugin_output ⇒ Object
readonly
Returns the value of attribute plugin_output.
-
#risk ⇒ Object
readonly
Returns the value of attribute risk.
-
#see_also ⇒ Object
readonly
Returns the value of attribute see_also.
-
#solution ⇒ Object
readonly
Returns the value of attribute solution.
-
#synopsis ⇒ Object
readonly
Returns the value of attribute synopsis.
Instance Method Summary collapse
- #add_detection(detection) ⇒ Object
-
#initialize(plugin_id, cve, cvss, risk, name, synopsis, description, solution, see_also, plugin_output) ⇒ Vulnerability
constructor
A new instance of Vulnerability.
- #matches?(filters = []) ⇒ Boolean
- #short_description ⇒ Object
- #title_line ⇒ Object
- #to_s ⇒ Object
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
#cve ⇒ Object (readonly)
Returns the value of attribute cve.
4 5 6 |
# File 'lib/nessana/vulnerability.rb', line 4 def cve @cve end |
#cvss ⇒ Object (readonly)
Returns the value of attribute cvss.
4 5 6 |
# File 'lib/nessana/vulnerability.rb', line 4 def cvss @cvss end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/nessana/vulnerability.rb', line 5 def description @description end |
#detections ⇒ Object
Returns the value of attribute detections.
7 8 9 |
# File 'lib/nessana/vulnerability.rb', line 7 def detections @detections end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/nessana/vulnerability.rb', line 5 def name @name end |
#plugin_id ⇒ Object (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_output ⇒ Object (readonly)
Returns the value of attribute plugin_output.
6 7 8 |
# File 'lib/nessana/vulnerability.rb', line 6 def plugin_output @plugin_output end |
#risk ⇒ Object (readonly)
Returns the value of attribute risk.
4 5 6 |
# File 'lib/nessana/vulnerability.rb', line 4 def risk @risk end |
#see_also ⇒ Object (readonly)
Returns the value of attribute see_also.
6 7 8 |
# File 'lib/nessana/vulnerability.rb', line 6 def see_also @see_also end |
#solution ⇒ Object (readonly)
Returns the value of attribute solution.
5 6 7 |
# File 'lib/nessana/vulnerability.rb', line 5 def solution @solution end |
#synopsis ⇒ Object (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
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_description ⇒ Object
43 44 45 46 |
# File 'lib/nessana/vulnerability.rb', line 43 def short_description "#{title_line} #{@synopsis}" end |
#title_line ⇒ Object
39 40 41 |
# File 'lib/nessana/vulnerability.rb', line 39 def title_line "[Nessus #{@plugin_id || "???"}] #{@name || "Unknown Vulnerability"} (#{@risk || "Unknown Risk"})" end |
#to_s ⇒ Object
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 |