Skip to content

Commit eb98ea2

Browse files
committed
Large pass_file hangs login modules
SeeRM rapid7#8704 When running a *_login module that contains a large PASS_FILE the module appears to hang while it is creating the combinations over such a large dataset. The solution proposed in the Redmine task requested that the user be alerted with some sort of progress feedback if the process takes an excessive amount of time. I have added a message that logs to the console that contains the number of pairs left to be constructed before the module will continue. The verbiage is fairly arbitrary and should probably be updated to something that might be more descriptive. Likewise, the sleep interval may need to be adjusted.
1 parent 829b9ff commit eb98ea2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,23 @@ def combine_users_and_passwords(user_array,pass_array)
330330
end
331331

332332
creds = [ [], [], [], [] ] # userpass, pass, user, rest
333+
remaining_pairs = combined_array.length # counter for our occasional output
334+
status = Thread.new do
335+
loop do
336+
# Ruby's sleep function is not terribly accurate.
337+
# Since all we are trying to do is let the user know
338+
# that the process is still working and giving them
339+
# an estimate as to how many pairs are left,
340+
# precision may not be of the utmost necessity
341+
sleep 100
342+
# Let the user know the combined pair list is still building
343+
# and tell them how many pairs are left to process.
344+
print_brute(
345+
:level => :vstatus,
346+
:msg => "Pair list is still building with #{remaining_pairs} pairs left to process"
347+
)
348+
end
349+
end
333350
# Move datastore['USERNAME'] and datastore['PASSWORD'] to the front of the list.
334351
# Note that we cannot tell the user intention if USERNAME or PASSWORD is blank --
335352
# maybe (and it's often) they wanted a blank. One more credential won't kill
@@ -344,7 +361,9 @@ def combine_users_and_passwords(user_array,pass_array)
344361
else
345362
creds[3] << pair
346363
end
364+
remaining_pairs -= 1
347365
end
366+
status.kill
348367
return creds[0] + creds[1] + creds[2] + creds[3]
349368
end
350369

0 commit comments

Comments
 (0)