Skip to content

Commit dcae55e

Browse files
Give auth_brute ability to try credentials stored in db
Added two options: DB_USER_PASS: this will try each user/pass couple stored in the db DB_ADD_ALL: this will add each user and password to the lists. By setting this to true, auth_brute will try every user with every known password.
1 parent e05b55f commit dcae55e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ def initialize(info = {})
2222
OptBool.new('VERBOSE', [ true, "Whether to print output for all attempts", true]),
2323
OptBool.new('BLANK_PASSWORDS', [ false, "Try blank passwords for all users", true]),
2424
OptBool.new('USER_AS_PASS', [ false, "Try the username as the password for all users", true]),
25+
OptBool.new('DB_USERPASS', [false,"Try each user/password couple stored in the current database",true]),
26+
OptBool.new('DB_ADD_ALL', [false,"Add all user and passwords in the current database to the lists (This will try every user with every password)",false]),
2527
OptBool.new('STOP_ON_SUCCESS', [ true, "Stop guessing when a credential works for a host", false]),
2628
], Auxiliary::AuthBrute)
2729

@@ -177,13 +179,28 @@ def build_credentials_array
177179
return credentials if datastore['USERPASS_FILE'] =~ /^memory:/
178180
users = load_user_vars(credentials)
179181
passwords = load_password_vars(credentials)
182+
183+
if datastore['DB_ADD_ALL']
184+
myworkspace.creds.each do |o|
185+
users << o.user
186+
passwords << o.pass unless o.ptype =~ /hash/
187+
end
188+
end
189+
180190
cleanup_files()
181191
if datastore['USER_AS_PASS']
182192
credentials = gen_user_as_password(users, credentials)
183193
end
184194
if datastore['BLANK_PASSWORDS']
185195
credentials = gen_blank_passwords(users, credentials)
186196
end
197+
if datastore['DB_USERPASS']
198+
myworkspace.creds.each do |o|
199+
credentials << [o.user, o.pass] unless o.ptype =~ /hash/
200+
end
201+
end
202+
203+
187204
credentials.concat(combine_users_and_passwords(users, passwords))
188205
credentials.uniq!
189206
credentials = just_uniq_users(credentials) if @strip_passwords

0 commit comments

Comments
 (0)