Module: MetasploitDataModels

Defined in:
lib/metasploit_data_models/base64_serializer.rb,
lib/metasploit_data_models.rb,
lib/metasploit_data_models/engine.rb,
lib/metasploit_data_models/version.rb,
lib/metasploit_data_models/serialized_prefs.rb,
lib/metasploit_data_models/change_required_columns_to_null_false.rb

Overview

Provides ActiveRecord 3.1x-friendly serialization for descendants of ActiveRecord::Base. Backwards compatible with older YAML methods and will fall back to string decoding in the worst case

Examples:

Using default default of {}

serialize :foo, MetasploitDataModels::Base64Serializer.new

Overriding default to []

serialize :bar, MetasploitDataModels::Base64Serializer.new(:default => [])

Defined Under Namespace

Modules: SerializedPrefs Classes: Base64Serializer, ChangeRequiredColumnsToNullFalse, Engine

Constant Summary collapse

VERSION =

MetasploitDataModels follows the Semantic Versioning Specification. At this time, the API is considered unstable because although the database migrations have moved from metasploit-framework/data/sql/migrate to db/migrate in this project, not all models have specs that verify the migrations (with have_db_column and have_db_index) and certain models may not be shared between metasploit-framework and pro, so models may be removed in the future. Because of the unstable API the version should remain below 1.0.0

'0.12.1'

Class Method Summary collapse

Class Method Details

.models_pathnameObject



33
34
35
# File 'lib/metasploit_data_models.rb', line 33

def self.models_pathname
  root.join('app', 'models')
end

.require_modelsObject



37
38
39
40
41
42
43
# File 'lib/metasploit_data_models.rb', line 37

def self.require_models
  models_globs = models_pathname.join('**', '*.rb')

  Dir.glob(models_globs) do |model_path|
    require model_path
  end
end

.rootObject



45
46
47
48
49
50
51
52
53
# File 'lib/metasploit_data_models.rb', line 45

def self.root
  unless instance_variable_defined? :@root
    lib_pathname = Pathname.new(__FILE__).dirname

    @root = lib_pathname.parent
  end

  @root
end