Class: Arachni::OptUrl

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

Overview

URL 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



294
295
296
# File 'lib/arachni/component_options.rb', line 294

def type
    return 'url'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/arachni/component_options.rb', line 298

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

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

    return super
end