Class: Arachni::Component::Options::Port

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

Overview

Network port 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/port.rb', line 23

def type
    'port'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
30
31
32
33
34
35
36
# File 'lib/arachni/component/options/port.rb', line 27

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

    if value && !value.to_s.empty? &&
        ((!value.to_s.match( /^\d+$/ ) || value.to_i <= 0 || value.to_i > 65535))
        return false
    end

    super
end