@@ -149,7 +149,7 @@ def parse_new_config_file(raw_xml)
149
149
db [ :Namespace ] = "" ;
150
150
end
151
151
# save
152
- dbs << db if ( db [ :Alias ] and db [ :Type ] and db [ :Server ] and db [ :Port ] )
152
+ dbs << db if ( db [ :Alias ] and db [ :Type ] and db [ :Server ] and db [ :Port ] )
153
153
db = { }
154
154
end
155
155
@@ -205,6 +205,13 @@ def parse_new_config_file(raw_xml)
205
205
end
206
206
207
207
db_table << [ db [ :Alias ] , db [ :Type ] , db [ :Server ] , db [ :Port ] , db [ :Database ] , db [ :Namespace ] , db [ :UserID ] , db [ :Password ] ]
208
+ report_cred (
209
+ ip : db [ :Server ] ,
210
+ port : db [ :Port ] . to_i ,
211
+ service_name : db [ :Type ] ,
212
+ username : db [ :UserID ] ,
213
+ password : db [ :Password ]
214
+ )
208
215
end
209
216
return db_table
210
217
end
@@ -278,12 +285,20 @@ def parse_old_config_file(raw_xml)
278
285
# Fill the tab
279
286
dbs . each do |db |
280
287
if ( db [ :URL ] =~ /[\S +\s +]+[\/ ]+([\S +\s +]+):[\S +]+/i )
281
- if ::Rex ::Socket . is_ipv4? ( $1. to_s )
282
- print_good ( "Reporting #{ $1} " )
283
- report_host ( :host => $1. to_s )
288
+ server = $1
289
+ if ::Rex ::Socket . is_ipv4? ( server )
290
+ print_good ( "Reporting #{ server } " )
291
+ report_host ( :host => server )
284
292
end
285
293
end
286
294
db_table << [ db [ :Alias ] , db [ :Type ] , db [ :URL ] , db [ :UserID ] , db [ :Password ] ]
295
+ report_cred (
296
+ ip : server ,
297
+ port : '' ,
298
+ service_name : db [ :Type ] ,
299
+ username : db [ :UserID ] ,
300
+ password : db [ :Password ]
301
+ )
287
302
end
288
303
return db_table
289
304
end
@@ -297,6 +312,32 @@ def find_version(tag)
297
312
found
298
313
end
299
314
315
+ def report_cred ( opts )
316
+ service_data = {
317
+ address : opts [ :ip ] ,
318
+ port : opts [ :port ] ,
319
+ service_name : opts [ :service_name ] ,
320
+ protocol : 'tcp' ,
321
+ workspace_id : myworkspace_id
322
+ }
323
+
324
+ credential_data = {
325
+ post_reference_name : self . refname ,
326
+ session_id : session_db_id ,
327
+ origin_type : :session ,
328
+ private_data : opts [ :password ] ,
329
+ private_type : :password ,
330
+ username : opts [ :username ]
331
+ } . merge ( service_data )
332
+
333
+ login_data = {
334
+ core : create_credential ( credential_data ) ,
335
+ status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
336
+ } . merge ( service_data )
337
+
338
+ create_credential_login ( login_data )
339
+ end
340
+
300
341
def decrypt_password ( enc_password )
301
342
enc_password = Rex ::Text . decode_base64 ( enc_password )
302
343
dk , iv = get_derived_key
0 commit comments