Class: Dradis::Plugins::OpenVAS::FieldProcessor

Inherits:
Upload::FieldProcessor
  • Object
show all
Defined in:
lib/dradis/plugins/openvas/field_processor.rb

Overview

This processor defers to ::OpenVAS::Result class to extract all the relevant information exposed through the :result template.

Instance Method Summary collapse

Instance Method Details

#post_initialize(args = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/dradis/plugins/openvas/field_processor.rb', line 7

def post_initialize(args={})

  # Figure out if v6 or v7
  @openvas_object = case detect_version(data)
                    when :v6
                      ::OpenVAS::V6::Result.new(data)
                    when :v7
                      ::OpenVAS::V7::Result.new(data)
                    end
end

#value(args = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/dradis/plugins/openvas/field_processor.rb', line 18

def value(args={})
  field = args[:field]

  # fields in the template are of the form <foo>.<field>, where <foo>
  # is common across all fields for a given template (and meaningless).
  _, name = field.split('.')

  @openvas_object.try(name) || 'n/a'
end