Skip to content

Commit ace9e79

Browse files
committed
Adding count-based print message
This commit removes the creation of a separate, timed thread for printing out status messages to the user in the case of large PASS_FILEs. This adjustment eliminates the overheard of context switching associated with spinning off separate threads, as well as the dangers associated with the Thread#kill method.
1 parent eb98ea2 commit ace9e79

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -331,22 +331,6 @@ def combine_users_and_passwords(user_array,pass_array)
331331

332332
creds = [ [], [], [], [] ] # userpass, pass, user, rest
333333
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
350334
# Move datastore['USERNAME'] and datastore['PASSWORD'] to the front of the list.
351335
# Note that we cannot tell the user intention if USERNAME or PASSWORD is blank --
352336
# maybe (and it's often) they wanted a blank. One more credential won't kill
@@ -361,9 +345,14 @@ def combine_users_and_passwords(user_array,pass_array)
361345
else
362346
creds[3] << pair
363347
end
348+
if remaining_pairs % 500000 == 0
349+
print_brute(
350+
:level => :vstatus,
351+
:msg => "Pair list is still building with #{remaining_pairs} pairs left to process"
352+
)
353+
end
364354
remaining_pairs -= 1
365355
end
366-
status.kill
367356
return creds[0] + creds[1] + creds[2] + creds[3]
368357
end
369358

0 commit comments

Comments
 (0)