Skip to content

Commit 6bac759

Browse files
committed
Round 3 of documentation
1 parent 39f206b commit 6bac759

File tree

4 files changed

+283
-33
lines changed

4 files changed

+283
-33
lines changed

lib/msf/core/rpc/v10/rpc_console.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def initialize(*args)
1717

1818
# Creates a new framework console.
1919
#
20-
# @param [Hash] opts (Optional) See Msf::Ui::Web::Driver#create_console
20+
# @param [Hash] opts See Msf::Ui::Web::Driver#create_console
2121
# @return [Hash] Information about the new console, such as:
2222
# * 'id' [Fixnum] The console's ID.
2323
# * 'prompt' [String] The framework prompt (example: 'msf > ')
@@ -38,7 +38,7 @@ def rpc_create(opts={})
3838
# Returns a list of framework consoles.
3939
#
4040
# @return [Hash] Console information.
41-
# * 'consoles' [Array] consoles, each element is another hash that includes:
41+
# * 'consoles' [Array<Hash>] consoles, each element is another hash that includes:
4242
# * 'id' [Fixnum] The console's ID
4343
# * 'prompt' [String] The framework prompt (example: 'msf > ')
4444
# * 'busy' [TrueClass] The console's busy state, or
@@ -151,6 +151,8 @@ def rpc_tabs(cid, line)
151151
# * 'result' [String] A value that says 'failure'.
152152
# If the console ID is valid, you will get the following that indicates the action was successful.
153153
# * 'result' [String] A value that says 'success'.
154+
# @example Here's how you would use this from the client:
155+
# rpc.call('console.session_kill', 4)
154156
def rpc_session_kill(cid)
155157
cid = cid.to_s
156158
return { 'result' => 'failure' } if not @console_driver.consoles[cid]
@@ -164,10 +166,12 @@ def rpc_session_kill(cid)
164166
# @param [Fixnum] cid Framework console ID.
165167
# @return [Hash] There are two different hashes you might get:
166168
#
167-
# If the console ID is invalid, you will get a hash like the following:
168-
# * 'result' [String] A value that says 'failure'.
169-
# If the console ID is valid, you will get the following that indicates the action was successful.
170-
# * 'result' [String] A value that says 'success'.
169+
# If the console ID is invalid, you will get a hash like the following:
170+
# * 'result' [String] A value that says 'failure'.
171+
# If the console ID is valid, you will get the following that indicates the action was successful.
172+
# * 'result' [String] A value that says 'success'.
173+
# @example Here's how you would use this from the client:
174+
# rpc.call('console.session_detach', 4)
171175
def rpc_session_detach(cid)
172176
cid = cid.to_s
173177
return { 'result' => 'failure' } if not @console_driver.consoles[cid]

lib/msf/core/rpc/v10/rpc_module.rb

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class RPC_Module < RPC_Base
77
# Returns a list of exploit names.
88
#
99
# @return [Hash] A list of exploit names.
10-
# * 'modules' [Array] Exploit names, for example: ['windows/wins/ms04_045_wins']
10+
# * 'modules' [Array<string>] Exploit names, for example: ['windows/wins/ms04_045_wins']
1111
# @example Here's how you would use this from the client:
1212
# rpc.call('module.exploits')
1313
def rpc_exploits
@@ -18,7 +18,7 @@ def rpc_exploits
1818
# Returns a list of auxiliary module names.
1919
#
2020
# @return [Hash] A list of auxiliary module names.
21-
# * 'modules' [Array] Auxiliary module names, for example: ['vsploit/pii/web_pii']
21+
# * 'modules' [Array<string>] Auxiliary module names, for example: ['vsploit/pii/web_pii']
2222
# @example Here's how you would use this from the client:
2323
# rpc.call('module.auxiliary')
2424
def rpc_auxiliary
@@ -29,7 +29,7 @@ def rpc_auxiliary
2929
# Returns a list of payload module names.
3030
#
3131
# @return [Hash] A list of payload module names.
32-
# * 'modules' [Array] Payload module names, for example: ['windows/x64/shell_reverse_tcp']
32+
# * 'modules' [Array<string>] Payload module names, for example: ['windows/x64/shell_reverse_tcp']
3333
# @example Here's how you would use this from the client:
3434
# rpc.call('module.payloads')
3535
def rpc_payloads
@@ -40,7 +40,7 @@ def rpc_payloads
4040
# Returns a list of encoder module names.
4141
#
4242
# @return [Hash] A list of encoder module names.
43-
# * 'modules' [Array] Encoder module names, for example: ['x86/unicode_upper']
43+
# * 'modules' [Array<string>] Encoder module names, for example: ['x86/unicode_upper']
4444
# @example Here's how you would use this from the client:
4545
# rpc.call('module.encoders')
4646
def rpc_encoders
@@ -51,7 +51,7 @@ def rpc_encoders
5151
# Returns a list of NOP module names.
5252
#
5353
# @return [Hash] A list of NOP module names.
54-
# * 'modules' [Array] NOP module names, for example: ['x86/single_byte']
54+
# * 'modules' [Array<string>] NOP module names, for example: ['x86/single_byte']
5555
# @example Here's how you would use this from the client:
5656
# rpc.call('module.nops')
5757
def rpc_nops
@@ -62,7 +62,7 @@ def rpc_nops
6262
# Returns a list of post module names.
6363
#
6464
# @return [Hash] A list of post module names.
65-
# * 'modules' [Array] Post module names, for example: ['windows/wlan/wlan_profile']
65+
# * 'modules' [Array<string>] Post module names, for example: ['windows/wlan/wlan_profile']
6666
# @example Here's how you would use this from the client:
6767
# rpc.call('module.post')
6868
def rpc_post
@@ -280,17 +280,18 @@ def rpc_encode_formats
280280
# @param [String] data Data to encode.
281281
# @param [encoder] encoder Encoder module name. For example: 'x86/single_byte'.
282282
# @param [Hash] options Encoding options, such as:
283-
# * 'format' [String] Encoding format.
284-
# * 'badchars' [String] Bad characters.
285-
# * 'platform' [String] Platform.
286-
# * 'arch' [String] Architecture.
287-
# * 'ecount' [Fixnum] Number of times to encode.
288-
# * 'inject' [TrueClass] To enable injection.
289-
# * 'template' [String] The template file (an executable).
290-
# * 'template_path' [String] Template path.
291-
# * 'addshellcode' [String] Custom shellcode.
292-
# @raise [Msf::RPC::Exception] Invalid format (Error 500).
293-
# @raise [Msf::RPC::Exception] Failure to encode (Error 500).
283+
# @option options [String] 'format' Encoding format.
284+
# @option options [String] 'badchars' Bad characters.
285+
# @option options [String] 'platform' Platform.
286+
# @option options [String] 'arch' Architecture.
287+
# @option options [Fixnum] 'ecount' Number of times to encode.
288+
# @option options [TrueClass] 'inject' To enable injection.
289+
# @option options [String] 'template' The template file (an executable).
290+
# @option options [String] 'template_path' Template path.
291+
# @option options [String] 'addshellcode' Custom shellcode.
292+
# @raise [Msf::RPC::Exception] Error could be one of these:
293+
# * 500 Invalid format
294+
# * 500 Failure to encode
294295
# @return The encoded data
295296
# * 'encoded' [String] The encoded data in the format you specify.
296297
# @example Here's how you would use this from the client:

lib/msf/core/rpc/v10/rpc_plugin.rb

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,19 @@ module Msf
33
module RPC
44
class RPC_Plugin < RPC_Base
55

6+
# Loads a framework plugin.
7+
#
8+
# @param [String] path The plugin filename (without the extension). It will try to find your plugin
9+
# in either one of these directories:
10+
# * msf/plugins/
11+
# * ~/.msf4/plugins/
12+
# @param [Hash] xopts Options to pass to the plugin.
13+
# @return [Hash] A hash indicating whether the action was successful or not.
14+
# * 'result' [String] A value that either says 'success' or 'failure'.
15+
# @example Here's how you would use this from the client:
16+
# # Load the nexpose plugin
17+
# rpc.call('plugin.load', 'nexpose')
618
def rpc_load(path, xopts = {})
7-
819
opts = {}
920

1021
xopts.each do |k,v|
@@ -35,6 +46,14 @@ def rpc_load(path, xopts = {})
3546

3647
end
3748

49+
50+
# Unloads a framework plugin.
51+
#
52+
# @param [String] name The plugin filename (without the extension). For example: 'nexpose'.
53+
# @return [Hash] A hash indicating whether the action was successful or not.
54+
# * 'result' [String] A value that either says 'success' or 'failure'.
55+
# @example Here's how you would use this from the client:
56+
# rpc.call('plugin.unload', 'nexpose')
3857
def rpc_unload(name)
3958
self.framework.plugins.each { |plugin|
4059
# Unload the plugin if it matches the name we're searching for
@@ -47,6 +66,13 @@ def rpc_unload(name)
4766

4867
end
4968

69+
70+
# Returns a list of plugins loaded by framework.
71+
#
72+
# @return [Hash] All the plugins loaded.
73+
# * 'plugins' [Array<string>] A list of plugin names.
74+
# @example Here's how you would use this from the client:
75+
# rpc.call('plugin.loaded')
5076
def rpc_loaded
5177
ret = {}
5278
ret[:plugins] = []

0 commit comments

Comments
 (0)