2014-11-03 22:20:21 +00:00
|
|
|
# -*- coding: binary -*-
|
|
|
|
|
|
|
|
module Msf
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# Mult-byte character string option.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
class OptString < OptBase
|
|
|
|
def type
|
|
|
|
return 'string'
|
|
|
|
end
|
|
|
|
|
|
|
|
def normalize(value)
|
2015-04-27 21:07:43 +00:00
|
|
|
if (value =~ /^file:(.*)/)
|
|
|
|
path = $1
|
|
|
|
begin
|
|
|
|
value = File.read(path)
|
|
|
|
rescue ::Errno::ENOENT, ::Errno::EISDIR
|
|
|
|
value = nil
|
|
|
|
end
|
|
|
|
end
|
2014-11-03 22:20:21 +00:00
|
|
|
value
|
|
|
|
end
|
|
|
|
|
|
|
|
def valid?(value=self.value)
|
|
|
|
value = normalize(value)
|
|
|
|
return false if empty_required_value?(value)
|
|
|
|
return super
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|