Class: Msf::Framework
- Inherits:
-
Object
- Object
- Msf::Framework
- Includes:
- MonitorMixin
- 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
Metasploit::Framework::Version::MAJOR
- Minor =
Metasploit::Framework::Version::MINOR
- Point =
Metasploit::Framework::Version::PATCH
- Release =
"-#{Metasploit::Framework::Version::PRERELEASE}"
- Version =
Metasploit::Framework::VERSION
- Revision =
"$Revision$"
Instance Attribute Summary collapse
-
#analyze ⇒ Object
The framework instance’s analysis utility.
-
#auxmgr ⇒ Object
The framework instance’s aux manager.
-
#browser_profiles ⇒ Object
The framework instance’s browser profile store.
-
#datastore ⇒ Object
The global framework datastore that can be used by modules.
-
#db ⇒ Metasploit::Framework::DataService::DataProxy
The framework instance’s data service proxy.
-
#events ⇒ Object
Event management interface for registering event handler subscribers and for interacting with the correlation engine.
-
#features ⇒ Object
The framework instance’s feature manager.
-
#jobs ⇒ Object
Background job management specific to things spawned from this instance of the framework.
-
#modules ⇒ Object
Module manager that contains information about all loaded modules, regardless of type.
-
#options ⇒ Hash
protected
Options passed to #initialize.
-
#plugins ⇒ Object
The framework instance’s plugin manager.
Instance Method Summary collapse
-
#auxiliary ⇒ Object
Returns the module set for auxiliary modules.
-
#eicar_corrupted? ⇒ Boolean
EICAR Canary.
-
#encoders ⇒ Object
Returns the module set for encoders.
- #evasion ⇒ Object
-
#exploits ⇒ Object
Returns the module set for exploits.
-
#initialize(options = {}) ⇒ Framework
constructor
Creates an instance of the framework context.
- #inspect ⇒ Object
-
#nops ⇒ Object
Returns the module set for nops.
-
#payloads ⇒ Object
Returns the module set for payloads.
-
#post ⇒ Object
Returns the module set for post modules.
- #search(search_string) ⇒ Object
-
#sessions ⇒ Msf::SessionManager
Session manager that tracks sessions associated with this framework instance over the course of their lifetime.
-
#threads ⇒ Msf::ThreadManager
The framework instance’s thread manager.
-
#threads? ⇒ true, false
Whether #threads has been initialized.
-
#version ⇒ Object
Returns the framework version in Major.Minor format.
Constructor Details
#initialize(options = {}) ⇒ Framework
Creates an instance of the framework context.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/msf/core/framework.rb', line 57 def initialize(={}) self. = # call super to initialize MonitorMixin. #synchronize won't work without this. super() # Allow specific module types to be loaded types = [:module_types] || Msf::MODULE_TYPES self.features = FeatureManager.instance self.features.load_config self.events = EventDispatcher.new(self) self.modules = ModuleManager.new(self,types) self.datastore = DataStore.new self.jobs = Rex::JobContainer.new self.analyze = Analyze.new(self) self.plugins = PluginManager.new(self) self.browser_profiles = Hash.new # Configure the thread factory Rex::ThreadFactory.provider = Metasploit::Framework::ThreadFactoryProvider.new(framework: self) # Configure the SSL certificate generator require 'msf/core/cert_provider' Rex::Socket::Ssl.cert_provider = Msf::Ssl::CertProvider 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
#analyze ⇒ Object
The framework instance’s analysis utility. Provide method to analyze framework objects to offer related objects/actions available.
189 190 191 |
# File 'lib/msf/core/framework.rb', line 189 def analyze @analyze end |
#auxmgr ⇒ Object
The framework instance’s aux manager. The aux manager is responsible for collecting and cataloging all aux information that comes in from aux modules.
167 168 169 |
# File 'lib/msf/core/framework.rb', line 167 def auxmgr @auxmgr end |
#browser_profiles ⇒ Object
The framework instance’s browser profile store. These profiles are generated by client-side modules and need to be shared across different contexts.
184 185 186 |
# File 'lib/msf/core/framework.rb', line 184 def browser_profiles @browser_profiles end |
#datastore ⇒ Object
The global framework datastore that can be used by modules.
161 162 163 |
# File 'lib/msf/core/framework.rb', line 161 def datastore @datastore end |
#db ⇒ Metasploit::Framework::DataService::DataProxy
The framework instance’s data service proxy
201 202 203 204 205 206 207 |
# File 'lib/msf/core/framework.rb', line 201 def db return @db if @db synchronize { @db ||= get_db } end |
#events ⇒ Object
Event management interface for registering event handler subscribers and for interacting with the correlation engine.
152 153 154 |
# File 'lib/msf/core/framework.rb', line 152 def events @events end |
#features ⇒ Object
The framework instance’s feature manager. The feature manager is responsible for configuring feature flags that can change characteristics of framework.
194 195 196 |
# File 'lib/msf/core/framework.rb', line 194 def features @features end |
#jobs ⇒ Object
Background job management specific to things spawned from this instance of the framework.
172 173 174 |
# File 'lib/msf/core/framework.rb', line 172 def jobs @jobs end |
#modules ⇒ Object
Module manager that contains information about all loaded modules, regardless of type.
157 158 159 |
# File 'lib/msf/core/framework.rb', line 157 def modules @modules end |
#options ⇒ Hash (protected)
Options passed to #initialize
273 274 275 |
# File 'lib/msf/core/framework.rb', line 273 def @options end |
#plugins ⇒ Object
The framework instance’s plugin manager. The plugin manager is responsible for exposing an interface that allows for the loading and unloading of plugins.
178 179 180 |
# File 'lib/msf/core/framework.rb', line 178 def plugins @plugins end |
Instance Method Details
#auxiliary ⇒ Object
Returns the module set for auxiliary modules
126 127 128 |
# File 'lib/msf/core/framework.rb', line 126 def auxiliary return modules.auxiliary end |
#eicar_corrupted? ⇒ Boolean
EICAR Canary
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/msf/core/framework.rb', line 251 def eicar_corrupted? path = ::File.(::File.join( ::File.dirname(__FILE__),"..", "..", "..", "data", "eicar.com") ) return true unless ::File.exist?(path) data = ::File.read(path, mode: 'rb') return true unless Digest::SHA1.hexdigest(data) == "3395856ce81f2b7382dee72602f798b642f14140" false # If anything goes wrong assume AV got us rescue ::Exception true end |
#encoders ⇒ Object
Returns the module set for encoders.
98 99 100 |
# File 'lib/msf/core/framework.rb', line 98 def encoders return modules.encoders end |
#evasion ⇒ Object
137 138 139 |
# File 'lib/msf/core/framework.rb', line 137 def evasion return modules.evasion end |
#exploits ⇒ Object
Returns the module set for exploits.
105 106 107 |
# File 'lib/msf/core/framework.rb', line 105 def exploits return modules.exploits end |
#inspect ⇒ Object
91 92 93 |
# File 'lib/msf/core/framework.rb', line 91 def inspect "#<Framework (#{sessions.length} sessions, #{jobs.length} jobs, #{plugins.length} plugins#{db.active ? ", #{db.driver} database active" : ""})>" end |
#nops ⇒ Object
Returns the module set for nops
112 113 114 |
# File 'lib/msf/core/framework.rb', line 112 def nops return modules.nops end |
#payloads ⇒ Object
Returns the module set for payloads
119 120 121 |
# File 'lib/msf/core/framework.rb', line 119 def payloads return modules.payloads end |
#post ⇒ Object
Returns the module set for post modules
133 134 135 |
# File 'lib/msf/core/framework.rb', line 133 def post return modules.post end |
#search(search_string) ⇒ Object
243 244 245 246 |
# File 'lib/msf/core/framework.rb', line 243 def search(search_string) search_params = Msf::Modules::Metadata::Search.parse_search_string(search_string) Msf::Modules::Metadata::Cache.instance.find(search_params) end |
#sessions ⇒ Msf::SessionManager
Session manager that tracks sessions associated with this framework instance over the course of their lifetime.
213 214 215 216 217 218 219 |
# File 'lib/msf/core/framework.rb', line 213 def sessions return @sessions if @sessions synchronize { @sessions ||= Msf::SessionManager.new(self) } end |
#threads ⇒ Msf::ThreadManager
The framework instance’s thread manager. The thread manager provides a cleaner way to manage spawned threads
225 226 227 228 229 230 231 |
# File 'lib/msf/core/framework.rb', line 225 def threads return @threads if @threads synchronize { @threads ||= Msf::ThreadManager.new(self) } end |
#threads? ⇒ true, false
Whether #threads has been initialized
237 238 239 240 241 |
# File 'lib/msf/core/framework.rb', line 237 def threads? synchronize { instance_variable_defined? :@threads } end |
#version ⇒ Object
Returns the framework version in Major.Minor format.
144 145 146 |
# File 'lib/msf/core/framework.rb', line 144 def version Version end |