@@ -71,7 +71,6 @@ def run_host(ip)
71
71
passwords << ""
72
72
passwords = passwords . uniq
73
73
74
-
75
74
self . udp_sock = Rex ::Socket ::Udp . create ( { 'Context' => { 'Msf' => framework , 'MsfExploit' => self } } )
76
75
add_socket ( self . udp_sock )
77
76
@@ -180,18 +179,8 @@ def run_host(ip)
180
179
write_output_files ( rhost , username , sha1_salt , sha1_hash )
181
180
182
181
# Write the rakp hash to the database
183
- report_auth_info (
184
- :host => rhost ,
185
- :port => rport ,
186
- :proto => 'udp' ,
187
- :sname => 'ipmi' ,
188
- :user => username ,
189
- :pass => "#{ sha1_salt } :#{ sha1_hash } " ,
190
- :source_type => "captured" ,
191
- :active => true ,
192
- :type => 'rakp_hmac_sha1_hash'
193
- )
194
-
182
+ hash = "#{ rhost } #{ username } :$rakp$#{ sha1_salt } $#{ sha1_hash } "
183
+ core_id = report_hash ( username , hash )
195
184
# Write the vulnerability to the database
196
185
unless reported_vuln
197
186
report_vuln (
@@ -216,17 +205,7 @@ def run_host(ip)
216
205
print_good ( "#{ rhost } :#{ rport } - IPMI - Hash for user '#{ username } ' matches password '#{ pass } '" )
217
206
218
207
# Report the clear-text credential to the database
219
- report_auth_info (
220
- :host => rhost ,
221
- :port => rport ,
222
- :proto => 'udp' ,
223
- :sname => 'ipmi' ,
224
- :user => username ,
225
- :pass => pass ,
226
- :source_type => "cracked" ,
227
- :active => true ,
228
- :type => 'password'
229
- )
208
+ report_cracked_cred ( username , pass , core_id )
230
209
break
231
210
end
232
211
end
@@ -265,6 +244,45 @@ def write_output_files(rhost, username, sha1_salt, sha1_hash)
265
244
end
266
245
end
267
246
247
+ def service_data
248
+ {
249
+ address : rhost ,
250
+ port : rport ,
251
+ service_name : 'ipmi' ,
252
+ protocol : 'udp' ,
253
+ workspace_id : myworkspace_id
254
+ }
255
+ end
256
+
257
+ def report_hash ( user , hash )
258
+ credential_data = {
259
+ module_fullname : self . fullname ,
260
+ origin_type : :service ,
261
+ private_data : hash ,
262
+ private_type : :nonreplayable_hash ,
263
+ jtr_format : 'rakp' ,
264
+ username : user ,
265
+ } . merge ( service_data )
266
+
267
+ login_data = {
268
+ core : create_credential ( credential_data ) ,
269
+ status : Metasploit ::Model ::Login ::Status ::UNTRIED
270
+ } . merge ( service_data )
271
+
272
+ cl = create_credential_login ( login_data )
273
+ cl . core_id
274
+ end
275
+
276
+ def report_cracked_cred ( user , password , core_id )
277
+ cred_data = {
278
+ core_id : core_id ,
279
+ username : user ,
280
+ password : password
281
+ }
282
+
283
+ create_cracked_credential ( cred_data )
284
+ end
285
+
268
286
#
269
287
# Helper methods (these didn't quite fit with existing mixins)
270
288
#
@@ -292,5 +310,4 @@ def rhost
292
310
def rport
293
311
datastore [ 'RPORT' ]
294
312
end
295
-
296
313
end
0 commit comments