Class: OpenvasCli::VasNVT
Overview
Describes a NSIS/OpenVAS scan rule. – TODO: Filter by other useful fields TODO: Find external links for more information TODO: Redcloth and Autolink description TODO: Implement sorting options ++
Instance Attribute Summary collapse
-
#bugtraq_id ⇒ Object
Returns the value of attribute bugtraq_id.
-
#category ⇒ Object
Returns the value of attribute category.
-
#copyright ⇒ Object
Returns the value of attribute copyright.
-
#cve_id ⇒ Object
Returns the value of attribute cve_id.
-
#cvss_base ⇒ Object
Returns the value of attribute cvss_base.
-
#description ⇒ Object
Returns the value of attribute description.
-
#family ⇒ Object
Returns the value of attribute family.
-
#name ⇒ Object
Human readable name of the rule.
-
#preferences ⇒ Object
Returns the value of attribute preferences.
-
#risk_factor ⇒ Object
Returns the value of attribute risk_factor.
-
#summary ⇒ Object
Returns the value of attribute summary.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#version ⇒ Object
Returns the value of attribute version.
-
#xrefs ⇒ Object
Returns the value of attribute xrefs.
Attributes inherited from VasBase
Class Method Summary collapse
-
.get_all(options = {}) ⇒ Object
Pulls VasNVT rules that match the provided options.
Methods inherited from VasBase
#create_or_update, #delete_record, #destroy, #destroy!, get_by_id, #initialize, #new_record?, #reset_changes, #save, #save!, #to_key, #to_param, #update_attributes
Methods included from ConnAddin
Methods included from XmlAddin
Constructor Details
This class inherits a constructor from OpenvasCli::VasBase
Instance Attribute Details
#bugtraq_id ⇒ Object
Returns the value of attribute bugtraq_id.
24 25 26 |
# File 'lib/openvas-cli/vas_nvt.rb', line 24 def bugtraq_id @bugtraq_id end |
#category ⇒ Object
Returns the value of attribute category.
15 16 17 |
# File 'lib/openvas-cli/vas_nvt.rb', line 15 def category @category end |
#copyright ⇒ Object
Returns the value of attribute copyright.
16 17 18 |
# File 'lib/openvas-cli/vas_nvt.rb', line 16 def copyright @copyright end |
#cve_id ⇒ Object
Returns the value of attribute cve_id.
23 24 25 |
# File 'lib/openvas-cli/vas_nvt.rb', line 23 def cve_id @cve_id end |
#cvss_base ⇒ Object
Returns the value of attribute cvss_base.
21 22 23 |
# File 'lib/openvas-cli/vas_nvt.rb', line 21 def cvss_base @cvss_base end |
#description ⇒ Object
Returns the value of attribute description.
17 18 19 |
# File 'lib/openvas-cli/vas_nvt.rb', line 17 def description @description end |
#family ⇒ Object
Returns the value of attribute family.
19 20 21 |
# File 'lib/openvas-cli/vas_nvt.rb', line 19 def family @family end |
#name ⇒ Object
Human readable name of the rule.
13 14 15 |
# File 'lib/openvas-cli/vas_nvt.rb', line 13 def name @name end |
#preferences ⇒ Object
Returns the value of attribute preferences.
27 28 29 |
# File 'lib/openvas-cli/vas_nvt.rb', line 27 def preferences @preferences end |
#risk_factor ⇒ Object
Returns the value of attribute risk_factor.
22 23 24 |
# File 'lib/openvas-cli/vas_nvt.rb', line 22 def risk_factor @risk_factor end |
#summary ⇒ Object
Returns the value of attribute summary.
18 19 20 |
# File 'lib/openvas-cli/vas_nvt.rb', line 18 def summary @summary end |
#tags ⇒ Object
Returns the value of attribute tags.
26 27 28 |
# File 'lib/openvas-cli/vas_nvt.rb', line 26 def @tags end |
#version ⇒ Object
Returns the value of attribute version.
20 21 22 |
# File 'lib/openvas-cli/vas_nvt.rb', line 20 def version @version end |
#xrefs ⇒ Object
Returns the value of attribute xrefs.
25 26 27 |
# File 'lib/openvas-cli/vas_nvt.rb', line 25 def xrefs @xrefs end |
Class Method Details
.get_all(options = {}) ⇒ Object
Pulls VasNVT rules that match the provided options.
Options:
- :id => [VasNVT.oid]
-
will pull only the NVT rule that matches the given OID
- :family => [VasFamily.name]
-
will pull all NVT rules for the specified family
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/openvas-cli/vas_nvt.rb', line 35 def self.get_all( = {}) params = {:details => '1'} params[:nvt_oid] = [:id] if [:id] params[:family] = [:family] if [:family] params[:config_id] = [:config_id] if [:config_id] req = Nokogiri::XML::Builder.new { |xml| xml.get_nvts(params) } rules = connection.send_receive(req.doc) ret = [] rules.xpath("/get_nvts_response/nvt").each { |nvt| rule = VasNVT.new rule.id = extract_value_from("@oid", nvt) rule.name = extract_value_from("name", nvt) rule.category = extract_value_from("category", nvt) rule.copyright = extract_value_from("copyright", nvt) rule.description = extract_value_from("description", nvt).strip rule.summary = extract_value_from("summary", nvt) rule.family = extract_value_from("family", nvt) rule.version = extract_value_from("version", nvt) rule.cvss_base = extract_value_from("cvss_base", nvt) rule.risk_factor = extract_value_from("risk_factor", nvt) rule.cve_id = extract_value_from("cve_id", nvt) rule.bugtraq_id = extract_value_from("bugtraq_id", nvt) rule.xrefs = extract_value_from("xrefs", nvt).split(/, ?/) rule. = extract_value_from("tags", nvt).split(/, ?/) ret << rule } ret end |