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. Also note that this will not unload modules that were deleted from the file system that were previously loaded.
116 117 118 119 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 116 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.
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 133 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 } end |
#rpc_reload_modules ⇒ Hash
Reloads framework modules. This will take some time to complete.
95 96 97 98 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 95 def rpc_reload_modules framework.modules.reload_modules rpc_module_stats() end |
#rpc_save ⇒ Hash
Saves current framework settings.
78 79 80 81 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 78 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.
178 179 180 181 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 178 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.
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 156 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 |
# File 'lib/msf/core/rpc/v10/rpc_core.rb', line 66 def rpc_unsetg(var) framework.datastore.delete(var) { "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 |