fix enum default logic for bools that default to false

MS-2855/keylogger-mettle-extension
Brent Cook 2017-09-21 02:33:37 -05:00
parent d811a2a8c1
commit 6da66e885a
2 changed files with 10 additions and 2 deletions

View File

@ -36,7 +36,11 @@ module Msf
self.required = required
self.desc = attrs.is_a?(String) ? attrs : desc
self.enums = [ *(enums) ].map { |x| x.to_s }
self.default = default || enums[0]
if default.nil? && enums.length > 0
self.default = enums[0]
else
self.default = default
end
regex_temp = regex
else
self.required = attrs[0] || required

View File

@ -25,7 +25,11 @@ module Msf
end
def normalize(value = self.value)
!valid?(value) ? nil : value.to_s
if valid?(value)
value.to_s
else
nil
end
end
def desc=(value)