Change OptPort to inherit from OptInt

Fixes the normalize and validate methods.
This commit is contained in:
Adam Cammack
2016-03-22 19:25:51 -05:00
parent 22df7c0071
commit ec3a0a108d
+2 -13
View File
@@ -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