Class: Msf::OptString

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

Overview

Mult-byte character string 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


162
163
164
165
166
167
168
169
170
171
172
# File 'lib/msf/core/option_container.rb', line 162

def normalize(value)
  if (value =~ /^file:(.*)/)
    path = $1
    begin
      value = File.read(path)
    rescue ::Errno::ENOENT, ::Errno::EISDIR
      value = nil
    end
  end
  value
end

#typeObject


158
159
160
# File 'lib/msf/core/option_container.rb', line 158

def type
  return 'string'
end

#valid?(value = self.value) ⇒ Boolean

Returns:

  • (Boolean)

174
175
176
177
178
# File 'lib/msf/core/option_container.rb', line 174

def valid?(value=self.value)
  value = normalize(value)
  return false if empty_required_value?(value)
  return super
end