Class: Msf::RPC::RPC_Core
- Defined in:
- lib/msf/core/rpc/v10/rpc_core.rb
Instance Attribute Summary
Attributes inherited from RPC_Base
#framework, #job_status_tracker, #service, #tokens, #users
Instance Method Summary collapse
-
#rpc_add_module_path(path) ⇒ Hash
Adds a new local file system path (local to the server) as a module path.
-
#rpc_getg(var) ⇒ Hash
Returns a global datastore option.
-
#rpc_module_stats ⇒ Hash
Returns the module stats.
-
#rpc_reload_modules ⇒ Hash
Reloads framework modules.
-
#rpc_save ⇒ Hash
Saves current framework settings.
-
#rpc_setg(var, val) ⇒ Hash
Sets a global datastore option.
-
#rpc_stop ⇒ void
Stops the RPC service.
-
#rpc_thread_kill(tid) ⇒ Hash
Kills a framework thread.
-
#rpc_thread_list ⇒ Hash
Returns a list of framework threads.
-
#rpc_unsetg(var) ⇒ Hash
Unsets a global datastore option.
-
#rpc_version ⇒ Hash
Returns the RPC service versions.
Methods inherited from RPC_Base
Constructor Details
This class inherits a constructor from Msf::RPC::RPC_Base
Instance Method Details
#rpc_add_module_path(path) ⇒ Hash
Adds a new local file system path (local to the server) as a module path. The module must be accessible to the user running the Metasploit service, and contain a top-level directory for each module type such as: exploits, nop, encoder, payloads, auxiliary, post, evasion. Also note that this will not unload modules that were deleted from the file system that were previously loaded.
123 124 125 126 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 123 def rpc_add_module_path(path) framework.modules.add_module_path(path) rpc_module_stats() end |
#rpc_getg(var) ⇒ Hash
Returns a global datastore option.
39 40 41 42 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 39 def rpc_getg(var) val = framework.datastore[var] { var.to_s => val.to_s } end |
#rpc_module_stats ⇒ Hash
Returns the module stats.
141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 141 def rpc_module_stats { 'exploits' => framework.stats.num_exploits, 'auxiliary' => framework.stats.num_auxiliary, 'post' => framework.stats.num_post, 'encoders' => framework.stats.num_encoders, 'nops' => framework.stats.num_nops, 'payloads' => framework.stats.num_payloads, 'evasions' => framework.stats.num_evasion } end |
#rpc_reload_modules ⇒ Hash
Reloads framework modules. This will take some time to complete.
101 102 103 104 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 101 def rpc_reload_modules framework.modules.reload_modules rpc_module_stats() end |
#rpc_save ⇒ Hash
Saves current framework settings.
83 84 85 86 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 83 def rpc_save framework.save_config { "result" => "success" } end |
#rpc_setg(var, val) ⇒ Hash
Sets a global datastore option.
53 54 55 56 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 53 def rpc_setg(var, val) framework.datastore[var] = val { "result" => "success" } end |
#rpc_stop ⇒ void
This method returns an undefined value.
Stops the RPC service.
28 29 30 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 28 def rpc_stop self.service.stop end |
#rpc_thread_kill(tid) ⇒ Hash
Kills a framework thread.
187 188 189 190 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 187 def rpc_thread_kill(tid) framework.threads.kill(tid.to_i) rescue nil { "result" => "success" } end |
#rpc_thread_list ⇒ Hash
Returns a list of framework threads.
165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 165 def rpc_thread_list res = {} framework.threads.each_index do |i| t = framework.threads[i] next if not t res[i] = { :status => (t.status || "dead"), :critical => t[:tm_crit] ? true : false, :name => t[:tm_name].to_s, :started => t[:tm_time].to_s } end res end |
#rpc_unsetg(var) ⇒ Hash
Unsets a global datastore option.
66 67 68 69 70 71 72 73 74 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 66 def rpc_unsetg(var) if framework.datastore.is_a?(Msf::DataStoreWithFallbacks) framework.datastore.unset(var) else framework.datastore.delete(var) end { "result" => "success" } end |
#rpc_version ⇒ Hash
Returns the RPC service versions.
14 15 16 17 18 19 20 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 14 def rpc_version { "version" => ::Msf::Framework::Version, "ruby" => "#{RUBY_VERSION} #{RUBY_PLATFORM} #{RUBY_RELEASE_DATE}", "api" => API_VERSION } end |