Class: Msf::OptPort

Inherits:
OptBase show all
Defined in:
lib/msf/core/option_container.rb

Overview

Network port option.

Instance Attribute Summary

Attributes inherited from OptBase

#advanced, #default, #desc, #enums, #evasion, #name, #owner, #required

Instance Method Summary collapse

Methods inherited from OptBase

#advanced?, #display_value, #empty_required_value?, #evasion?, #initialize, #required?, #type?

Constructor Details

This class inherits a constructor from Msf::OptBase

Instance Method Details

#normalize(value) ⇒ Object


306
307
308
# File 'lib/msf/core/option_container.rb', line 306

def normalize(value)
  value.to_i
end

#typeObject


302
303
304
# File 'lib/msf/core/option_container.rb', line 302

def type
  return 'port'
end

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)

310
311
312
313
314
315
316
317
318
319
# File 'lib/msf/core/option_container.rb', line 310

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

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

  return super
end