Class: Arachni::OptAddress

Inherits:
OptBase show all
Defined in:
lib/arachni/component_options.rb

Overview

Network address option.

Instance Attribute Summary

Attributes inherited from OptBase

#default, #desc, #enums, #name, #owner, #required

Instance Method Summary collapse

Methods inherited from OptBase

#empty_required_value?, #initialize, #normalize, #required?, #to_h, #type?

Constructor Details

This class inherits a constructor from Arachni::OptBase

Instance Method Details

#typeObject



322
323
324
# File 'lib/arachni/component_options.rb', line 322

def type
    return 'address'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/arachni/component_options.rb', line 326

def valid?(value)
    return false if empty_required_value?(value)

    if (value != nil and value.empty? == false)
        require 'socket'
        begin
            ::IPSocket.getaddress( value )
        rescue
            return false
        end
    end

    return super
end