@@ -106,11 +106,64 @@ def init_db_opts_workspace(xopts)
106
106
107
107
public
108
108
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)
109
134
def rpc_create_cracked_credential ( xopts )
110
135
opts = fix_cred_options ( xopts )
111
136
create_credential ( opts )
112
137
end
113
138
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)
114
167
def rpc_create_credential ( xopts )
115
168
opts = fix_cred_options ( xopts )
116
169
core = create_credential ( opts )
@@ -135,6 +188,24 @@ def rpc_create_credential(xopts)
135
188
ret
136
189
end
137
190
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)
138
209
def rpc_invalidate_login ( xopts )
139
210
opts = fix_cred_options ( xopts )
140
211
invalidate_login ( opts )
0 commit comments