Class: Nexpose::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/report.rb

Overview

Object that represents a report filter which determines which sites, asset groups, and/or devices that a report is run against.

The configuration must include at least one of device (asset), site, group (asset group) or scan filter to define the scope of report. The vuln-status filter can be used only with raw report formats: csv or raw_xml. If the vuln-status filter is not included in the configuration, all the vulnerability test results (including invulnerable instances) are exported by default in csv and raw_xml reports.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, id) ⇒ Filter

Returns a new instance of Filter.



413
414
415
416
# File 'lib/nexpose/report.rb', line 413

def initialize(type, id)
  @type = type
  @id = id
end

Instance Attribute Details

#idObject (readonly)

The ID of the specific site, group, device, or scan. For scan, this can also be “last” for the most recently run scan. For vuln-status, the ID can have one of the following values:

  1. vulnerable-exploited (The check was positive. An exploit verified the vulnerability.)

  2. vulnerable-version (The check was positive. The version of the scanned service or software is associated with known vulnerabilities.)

  3. potential (The check for a potential vulnerability was positive.)

These values are supported for CSV and XML formats.



409
410
411
# File 'lib/nexpose/report.rb', line 409

def id
  @id
end

#typeObject (readonly)

One of: site|group|device|scan|vuln-categories|vuln-severity|vuln-status|cyberscope-component|cyberscope-bureau|cyberscope-enclave



411
412
413
# File 'lib/nexpose/report.rb', line 411

def type
  @type
end

Class Method Details

.parse(xml) ⇒ Object



422
423
424
425
426
427
428
# File 'lib/nexpose/report.rb', line 422

def self.parse(xml)
  filters = []
  xml.res.elements.each('//Filters/filter') do |filter|
    filters << Filter.new(filter.attributes['type'], filter.attributes['id'])
  end
  filters
end

Instance Method Details

#to_xmlObject



418
419
420
# File 'lib/nexpose/report.rb', line 418

def to_xml
  %Q{<filter id='#{@id}' type='#{@type}' />}
end