Change OptPort to inherit from OptInt
Fixes the normalize and validate methods.
This commit is contained in:
@@ -7,24 +7,13 @@ module Msf
|
||||
# Network port option.
|
||||
#
|
||||
###
|
||||
class OptPort < OptBase
|
||||
class OptPort < OptInt
|
||||
def type
|
||||
return 'port'
|
||||
end
|
||||
|
||||
def normalize(value)
|
||||
value.to_i
|
||||
end
|
||||
|
||||
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
|
||||
super && normalize(value) <= 65535 && normalize(value) > 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user