Class: Msf::OptRaw

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

Overview

Raw, arbitrary data 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


191
192
193
194
195
196
197
198
199
200
201
# File 'lib/msf/core/option_container.rb', line 191

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


187
188
189
# File 'lib/msf/core/option_container.rb', line 187

def type
  return 'raw'
end

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


203
204
205
206
207
# File 'lib/msf/core/option_container.rb', line 203

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