Class: Msf::Framework

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/framework.rb

Overview

This class is the primary context that modules, scripts, and user interfaces interact with. It ties everything together.

Defined Under Namespace

Modules: Offspring

Constant Summary collapse

Major =

Versioning information

4
Minor =
9
Point =
0
Release =
"-dev"
Version =
"#{Major}.#{Minor}#{Release}"
Revision =
"$Revision$"
RepoRevision =

Repository information

::Msf::Util::SVN.revision
RepoUpdated =
::Msf::Util::SVN.updated
RepoUpdatedDays =
::Msf::Util::SVN.days_since_update
RepoUpdatedDaysNote =
::Msf::Util::SVN.last_updated_friendly
RepoUpdatedDate =
::Msf::Util::SVN.last_updated_date
RepoRoot =
::Msf::Util::SVN.root
EICARCorrupted =

EICAR canary

::Msf::Util::EXE.is_eicar_corrupted?
APIMajor =

API Version

1
APIMinor =
0
VersionCore =

Base/API Version

Major + (Minor / 10.0)
VersionAPI =
APIMajor + (APIMinor / 10.0)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Framework

Creates an instance of the framework context.


76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/msf/core/framework.rb', line 76

def initialize(opts={})

  # Allow specific module types to be loaded
  types = opts[:module_types] || MODULE_TYPES

  self.threads   = ThreadManager.new(self)
  self.events    = EventDispatcher.new(self)
  self.modules   = ModuleManager.new(self,types)
  self.sessions  = SessionManager.new(self)
  self.datastore = DataStore.new
  self.jobs      = Rex::JobContainer.new
  self.plugins   = PluginManager.new(self)
  self.db        = DBManager.new(self, opts)

  # Configure the thread factory
  Rex::ThreadFactory.provider = self.threads

  subscriber = FrameworkEventSubscriber.new(self)
  events.add_exploit_subscriber(subscriber)
  events.add_session_subscriber(subscriber)
  events.add_general_subscriber(subscriber)
  events.add_db_subscriber(subscriber)
  events.add_ui_subscriber(subscriber)
end

Instance Attribute Details

#auxmgrObject

The framework instance's aux manager. The aux manager is responsible for collecting and catalogging all aux information that comes in from aux modules.


178
179
180
# File 'lib/msf/core/framework.rb', line 178

def auxmgr
  @auxmgr
end

#datastoreObject

The global framework datastore that can be used by modules.


172
173
174
# File 'lib/msf/core/framework.rb', line 172

def datastore
  @datastore
end

#dbObject

The framework instance's db manager. The db manager maintains the database db and handles db events


194
195
196
# File 'lib/msf/core/framework.rb', line 194

def db
  @db
end

#eventsObject

Event management interface for registering event handler subscribers and for interacting with the correlation engine.


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

def events
  @events
end

#jobsObject

Background job management specific to things spawned from this instance of the framework.


183
184
185
# File 'lib/msf/core/framework.rb', line 183

def jobs
  @jobs
end

#modulesObject

Module manager that contains information about all loaded modules, regardless of type.


163
164
165
# File 'lib/msf/core/framework.rb', line 163

def modules
  @modules
end

#pluginsObject

The framework instance's plugin manager. The plugin manager is responsible for exposing an interface that allows for the loading and unloading of plugins.


189
190
191
# File 'lib/msf/core/framework.rb', line 189

def plugins
  @plugins
end

#sessionsObject

Session manager that tracks sessions associated with this framework instance over the course of their lifetime.


168
169
170
# File 'lib/msf/core/framework.rb', line 168

def sessions
  @sessions
end

#threadsObject

The framework instance's thread manager. The thread manager provides a cleaner way to manage spawned threads


199
200
201
# File 'lib/msf/core/framework.rb', line 199

def threads
  @threads
end

Instance Method Details

#auxiliaryObject

Returns the module set for auxiliary modules


136
137
138
# File 'lib/msf/core/framework.rb', line 136

def auxiliary
  return modules.auxiliary
end

#encodersObject

Returns the module set for encoders.


108
109
110
# File 'lib/msf/core/framework.rb', line 108

def encoders
  return modules.encoders
end

#exploitsObject

Returns the module set for exploits.


115
116
117
# File 'lib/msf/core/framework.rb', line 115

def exploits
  return modules.exploits
end

#inspectObject


101
102
103
# File 'lib/msf/core/framework.rb', line 101

def inspect
  "#<Framework (#{sessions.length} sessions, #{jobs.length} jobs, #{plugins.length} plugins#{db.active ? ", #{db.driver} database active" : ""})>"
end

#nopsObject

Returns the module set for nops


122
123
124
# File 'lib/msf/core/framework.rb', line 122

def nops
  return modules.nops
end

#payloadsObject

Returns the module set for payloads


129
130
131
# File 'lib/msf/core/framework.rb', line 129

def payloads
  return modules.payloads
end

#postObject

Returns the module set for post modules


143
144
145
# File 'lib/msf/core/framework.rb', line 143

def post
  return modules.post
end

#versionObject

Returns the framework version in Major.Minor format.


150
151
152
# File 'lib/msf/core/framework.rb', line 150

def version
  Version
end