Class: Arachni::Component::Options::Address

Inherits:
Base
  • Object
show all
Defined in:
lib/arachni/component/options/address.rb

Overview

Network address option.

Instance Attribute Summary

Attributes inherited from Base

#default, #desc, #enums, #name

Instance Method Summary collapse

Methods inherited from Base

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

Constructor Details

This class inherits a constructor from Arachni::Component::Options::Base

Instance Method Details

#typeObject



23
24
25
# File 'lib/arachni/component/options/address.rb', line 23

def type
    'address'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/arachni/component/options/address.rb', line 27

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

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

    super
end