Skip to content

Commit f6bd747

Browse files
committed
Round 4 of documentation
1 parent 6bac759 commit f6bd747

File tree

3 files changed

+76
-3
lines changed

3 files changed

+76
-3
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ module RPC
1212

1313
class Client
1414

15-
# @return [String] A login token.
15+
# @!attribute token
16+
# @return [String] A login token.
1617
attr_accessor :token
1718

18-
# @return [Hash] Login information.
19+
# @!attribute info
20+
# @return [Hash] Login information.
1921
attr_accessor :info
2022

2123

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module Msf
33
module RPC
44
class RPC_Core < RPC_Base
55

6-
# Returns the RPC versions.
6+
# Returns the RPC service versions.
77
#
88
# @return [Hash] A hash that includes the version information:
99
# * 'version' [String] Framework version

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

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,64 @@ def init_db_opts_workspace(xopts)
106106

107107
public
108108

109+
110+
# Creates a credential.
111+
#
112+
# @note Despite the fact the method name for this is called "rpc_create_cracked_credential", it
113+
# does not actually call the create_cracked_credential API in metasploit-credential. Instead,
114+
# it calls create_credential.
115+
# @todo This method needs to call create_cracked_credential, not create_credential.
116+
# @param [Hash] xopts Credential options. (See #create_credential Documentation)
117+
# @return [Metasploit::Credential::Core]
118+
# @see https://github.com/rapid7/metasploit-credential/blob/master/lib/metasploit/credential/creation.rb#L107 #create_credential Documentation.
119+
# @see #rpc_create_credential
120+
# @example Here's how you would use this from the client:
121+
# opts = {
122+
# origin_type: :service,
123+
# address: '192.168.1.100',
124+
# port: 445,
125+
# service_name: 'smb',
126+
# protocol: 'tcp',
127+
# module_fullname: 'auxiliary/scanner/smb/smb_login',
128+
# workspace_id: myworkspace_id,
129+
# private_data: 'password1',
130+
# private_type: :password,
131+
# username: 'Administrator'
132+
# }
133+
# rpc.call('db.create_cracked_credential', opts)
109134
def rpc_create_cracked_credential(xopts)
110135
opts = fix_cred_options(xopts)
111136
create_credential(opts)
112137
end
113138

139+
140+
# Creates a credential.
141+
#
142+
# @param [Hash] xopts Credential options. (See #create_credential Documentation)
143+
# @return [Hash] Credential data.
144+
# * :username [String] Username saved.
145+
# * :private [String] Password saved.
146+
# * :private_type [String] Password type.
147+
# * :realm_value [String] Realm.
148+
# * :realm_key [String] Realm key.
149+
# * :host [String] Host (Only avilable if there's a :last_attempted_at and :status)
150+
# * :sname [String] Service name (only available if there's a :last_attempted_at and :status)
151+
# * :status [Status] Login status (only available if there's a :last_attempted_at and :status)
152+
# @see https://github.com/rapid7/metasploit-credential/blob/master/lib/metasploit/credential/creation.rb#L107 #create_credential Documentation.
153+
# @example Here's how you would use this from the client:
154+
# opts = {
155+
# origin_type: :service,
156+
# address: '192.168.1.100',
157+
# port: 445,
158+
# service_name: 'smb',
159+
# protocol: 'tcp',
160+
# module_fullname: 'auxiliary/scanner/smb/smb_login',
161+
# workspace_id: myworkspace_id,
162+
# private_data: 'password1',
163+
# private_type: :password,
164+
# username: 'Administrator'
165+
# }
166+
# rpc.call('db.create_cracked_credential', opts)
114167
def rpc_create_credential(xopts)
115168
opts = fix_cred_options(xopts)
116169
core = create_credential(opts)
@@ -135,6 +188,24 @@ def rpc_create_credential(xopts)
135188
ret
136189
end
137190

191+
192+
# Sets the status of a login credential to a failure.
193+
#
194+
# @param [Hash] xopts Credential data (See #invalidate_login Documentation)
195+
# @raise [Msf::RPC::Exception] If there's an option missing.
196+
# @return [void]
197+
# @see https://github.com/rapid7/metasploit-credential/blob/master/lib/metasploit/credential/creation.rb#L492 #invalidate_login Documentation
198+
# @see https://github.com/rapid7/metasploit-model/blob/master/lib/metasploit/model/login/status.rb Status symbols.
199+
# @example Here's how you would use this from the client:
200+
# opts = {
201+
# address: '192.168.1.100',
202+
# port: 445,
203+
# protocol: 'tcp',
204+
# public: 'admin',
205+
# private: 'password1',
206+
# status: 'Incorrect'
207+
# }
208+
# rpc.call('db.invalidate_login', opts)
138209
def rpc_invalidate_login(xopts)
139210
opts = fix_cred_options(xopts)
140211
invalidate_login(opts)

0 commit comments

Comments
 (0)