Class: Openvas::Scan
- Inherits:
-
Object
- Object
- Openvas::Scan
- Defined in:
- lib/openvas/scans.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
Returns the value of attribute comment.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#status ⇒ Object
Returns the value of attribute status.
-
#target ⇒ Object
Returns the value of attribute target.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #finished? ⇒ Boolean
-
#initialize(scan) ⇒ Scan
constructor
A new instance of Scan.
- #last_report ⇒ Object
- #last_results ⇒ Object
Constructor Details
#initialize(scan) ⇒ Scan
Returns a new instance of Scan.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/openvas/scans.rb', line 23 def initialize(scan) @id = scan.at_xpath('@id').value @name = scan.at_xpath('name').text @comment = scan.at_xpath('comment').text @user = scan.at_xpath('owner/name').text @status = scan.at_xpath('status').text @target = scan.at_xpath('target')&.first_element_child&.text @created_at = Time.parse(scan.at_xpath('creation_time').text) @updated_at = Time.parse(scan.at_xpath('modification_time').text) @last_report_id = scan.at_xpath('last_report/report/@id')&.value end |
Instance Attribute Details
#comment ⇒ Object
Returns the value of attribute comment.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def comment @comment end |
#created_at ⇒ Object
Returns the value of attribute created_at.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def created_at @created_at end |
#id ⇒ Object
Returns the value of attribute id.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def name @name end |
#status ⇒ Object
Returns the value of attribute status.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def status @status end |
#target ⇒ Object
Returns the value of attribute target.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def target @target end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def updated_at @updated_at end |
#user ⇒ Object
Returns the value of attribute user.
21 22 23 |
# File 'lib/openvas/scans.rb', line 21 def user @user end |
Instance Method Details
#finished? ⇒ Boolean
46 47 48 49 50 |
# File 'lib/openvas/scans.rb', line 46 def finished? return true if @status.eql? 'Done' false end |
#last_report ⇒ Object
38 39 40 |
# File 'lib/openvas/scans.rb', line 38 def last_report Openvas::Reports.find_by_id(@last_report_id) end |
#last_results ⇒ Object
42 43 44 |
# File 'lib/openvas/scans.rb', line 42 def last_results Openvas::Results.find_by_report_id(@last_report_id) end |