Class: Dradis::Plugins::Nmap::FieldProcessor

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

Instance Method Summary collapse

Instance Method Details

#post_initialize(args = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/dradis/plugins/nmap/field_processor.rb', line 5

def post_initialize(args={})
  if data.kind_of?(::Nmap::Host) || data.kind_of?(::Nmap::Port)
    @nmap_object = data
  elsif data.name == 'host'
    @nmap_object = ::Nmap::Host.new(data)
  elsif data.name == 'port'
    @nmap_object = ::Nmap::Port.new(data)
  end
end

#value(args = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dradis/plugins/nmap/field_processor.rb', line 15

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).
  type, name, attribute = field.split('.')
  if type == 'host'
    host_value(name)
  elsif type == 'port'
    port_value(name, attribute)
  end
end