Class: Msf::OptPort

Inherits:
OptInt show all
Defined in:
lib/msf/core/opt_port.rb

Overview

Network port option.

Instance Attribute Summary

Attributes inherited from OptBase

#advanced, #aliases, #conditions, #default, #desc, #enums, #evasion, #max_length, #name, #owner, #regex, #required

Instance Method Summary collapse

Methods inherited from OptInt

#normalize

Methods inherited from OptBase

#advanced?, #display_value, #empty_required_value?, #evasion?, #initialize, #invalid_value_length?, #normalize, #required?, #type?, #validate_on_assignment?

Constructor Details

This class inherits a constructor from Msf::OptBase

Instance Method Details

#typeObject



11
12
13
# File 'lib/msf/core/opt_port.rb', line 11

def type
  return 'port'
end

#valid?(value, check_empty: true) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/msf/core/opt_port.rb', line 15

def valid?(value, check_empty: true)
  port = normalize(value).to_i
  super && port <= 65535 && port >= 0
end