@@ -159,7 +159,8 @@ def parse_userlist(data)
159
159
del_cmd = 'rm '
160
160
del_cmd << data
161
161
system ( del_cmd )
162
- return creds , imap , pop3
162
+ result = [ creds , imap , pop3 ]
163
+ return result
163
164
end
164
165
165
166
def report_cred ( creds )
@@ -170,30 +171,28 @@ def report_cred(creds)
170
171
port : 25 ,
171
172
service_name : 'smtp' ,
172
173
protocol : 'tcp' ,
174
+ workspace_id : myworkspace_id
173
175
}
174
176
# Iterate through credentials
175
177
creds . each do |cred |
176
178
# Build credential information
177
179
credential_data = {
178
- origin_type : :service ,
180
+ origin_type : :session ,
179
181
session_id : session_db_id ,
180
182
post_reference_name : self . refname ,
181
183
private_type : :password ,
182
184
private_data : cred [ 4 ] ,
183
185
username : cred [ 1 ] ,
184
- workspace_id : myworkspace_id ,
185
186
module_fullname : self . fullname
186
187
}
187
- print_status ( "Debug 1: #{ credential_data } " )
188
188
credential_data . merge! ( service_data )
189
- print_status ( "Debug 2: #{ credential_data } " )
190
189
credential_core = create_credential ( credential_data )
191
190
192
191
# Assemble the options hash for creating the Metasploit::Credential::Login object
193
192
login_data = {
194
193
core : credential_core ,
195
194
status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
196
- workspace_id : myworkspace_id
195
+ # workspace_id: myworkspace_id
197
196
}
198
197
199
198
login_data . merge! ( service_data )
@@ -208,38 +207,36 @@ def report_cred(creds)
208
207
print_status ( "SMPT credentials saved in: #{ loot_path } " )
209
208
end
210
209
211
- def report_pop3 ( pop3 )
210
+ def report_pop3 ( creds )
212
211
# Build service information
213
212
service_data = {
214
213
# address: session.session_host, # Gives internal IP
215
214
address : session . tunnel_peer . partition ( ':' ) [ 0 ] , # Gives public IP
216
215
port : 110 ,
217
216
service_name : 'pop3' ,
218
217
protocol : 'tcp' ,
218
+ workspace_id : myworkspace_id
219
219
}
220
220
# Iterate through credentials
221
- pop3 . each do |cred |
221
+ creds . each do |cred |
222
222
# Build credential information
223
223
credential_data = {
224
- origin_type : :service ,
224
+ origin_type : :session ,
225
225
session_id : session_db_id ,
226
226
post_reference_name : self . refname ,
227
227
private_type : :password ,
228
228
private_data : cred [ 4 ] ,
229
229
username : cred [ 1 ] ,
230
- workspace_id : myworkspace_id ,
231
230
module_fullname : self . fullname
232
231
}
233
- vprint_status ( "Debug 1: #{ credential_data } " )
234
232
credential_data . merge! ( service_data )
235
- vprint_status ( "Debug 2: #{ credential_data } " )
236
233
credential_core = create_credential ( credential_data )
237
234
238
235
# Assemble the options hash for creating the Metasploit::Credential::Login object
239
236
login_data = {
240
237
core : credential_core ,
241
238
status : Metasploit ::Model ::Login ::Status ::UNTRIED ,
242
- workspace_id : myworkspace_id
239
+ # workspace_id: myworkspace_id
243
240
}
244
241
245
242
login_data . merge! ( service_data )
@@ -254,31 +251,29 @@ def report_pop3(pop3)
254
251
print_status ( "POP3 credentials saved in: #{ loot_path } " )
255
252
end
256
253
257
- def report_imap ( imap )
254
+ def report_imap ( creds )
258
255
# Build service information
259
256
service_data = {
260
257
# address: session.session_host, # Gives internal IP
261
258
address : session . tunnel_peer . partition ( ':' ) [ 0 ] , # Gives public IP
262
259
port : 143 ,
263
260
service_name : 'imap' ,
264
261
protocol : 'tcp' ,
262
+ workspace_id : myworkspace_id
265
263
}
266
264
# Iterate through credentials
267
- imap . each do |cred |
265
+ creds . each do |cred |
268
266
# Build credential information
269
267
credential_data = {
270
- origin_type : :service ,
268
+ origin_type : :session ,
271
269
session_id : session_db_id ,
272
270
post_reference_name : self . refname ,
273
271
private_type : :password ,
274
272
private_data : cred [ 4 ] ,
275
273
username : cred [ 1 ] ,
276
- workspace_id : myworkspace_id ,
277
274
module_fullname : self . fullname
278
275
}
279
- vprint_status ( "Debug 1: #{ credential_data } " )
280
276
credential_data . merge! ( service_data )
281
- vprint_status ( "Debug 2: #{ credential_data } " )
282
277
credential_core = create_credential ( credential_data )
283
278
284
279
# Assemble the options hash for creating the Metasploit::Credential::Login object
@@ -312,10 +307,9 @@ def get_mdaemon_creds(userlist)
312
307
'Mail Dir' ,
313
308
'Password'
314
309
] )
315
- creds , imap , pop3 = parse_userlist ( userlist )
316
- report_cred ( creds )
317
- report_pop3 ( pop3 )
318
- report_imap ( imap )
319
-
310
+ result = parse_userlist ( userlist )
311
+ report_cred ( result [ 0 ] )
312
+ report_pop3 ( result [ 1 ] )
313
+ report_imap ( result [ 2 ] )
320
314
end
321
315
end
0 commit comments