Class: Arachni::Component::Options::URL

Inherits:
Base show all
Defined in:
lib/arachni/component/options/url.rb

Overview

URL 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/url.rb', line 23

def type
    'url'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


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

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

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

    super
end