Class: Dradis::Plugins::Zap::FieldProcessor

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

Overview

This simple field processor tries to locate the fields as nested XML tags under the root element.

Instance Method Summary collapse

Instance Method Details

#value(args = {}) ⇒ Object

No need to implement anything here def post_initialize(args={}) end



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dradis/plugins/zap/field_processor.rb', line 10

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('.')

  if tag = @data.at_xpath(name)
    tag.text().gsub(/<p>/, '').gsub(/<\/p>/, "\n\n")
  else
    'n/a'
  end
end