Skip to content

Commit e8294b4

Browse files
committed
Add tentative fixes
1 parent c0fda81 commit e8294b4

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

lib/msf/core/auxiliary/auth_brute.rb

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ 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]),
25+
OptBool.new('DB_ALL_CREDS', [false,"Try each user/password couple stored in the current database",true]),
2626
OptBool.new('DB_ALL_USERS', [false,"Add all users in the current database to the list",false]),
2727
OptBool.new('DB_ALL_PASS', [false,"Add all passwords in the current database to the list",false]),
2828
OptBool.new('STOP_ON_SUCCESS', [ true, "Stop guessing when a credential works for a host", false]),
@@ -180,32 +180,30 @@ def build_credentials_array
180180
return credentials if datastore['USERPASS_FILE'] =~ /^memory:/
181181
users = load_user_vars(credentials)
182182
passwords = load_password_vars(credentials)
183-
184-
if datastore['DB_ALL_USERS']
185-
myworkspace.creds.each do |o|
186-
users << o.user
187-
end
188-
end
189-
if datastore['DB_ALL_PASS']
190-
myworkspace.creds.each do |o|
191-
passwords << o.pass unless o.ptype =~ /hash/
192-
end
193-
end
194-
195183
cleanup_files()
196184
if datastore['USER_AS_PASS']
197185
credentials = gen_user_as_password(users, credentials)
198186
end
199187
if datastore['BLANK_PASSWORDS']
200188
credentials = gen_blank_passwords(users, credentials)
201189
end
202-
if datastore['DB_USERPASS']
203-
myworkspace.creds.each do |o|
204-
credentials << [o.user, o.pass] unless o.ptype =~ /hash/
190+
if framework.db.active
191+
if datastore['DB_ALL_CREDS']
192+
myworkspace.creds.each do |o|
193+
credentials << [o.user, o.pass] if o.ptype =~ /password/
194+
end
195+
end
196+
if datastore['DB_ALL_USERS']
197+
myworkspace.creds.each do |o|
198+
users << o.user
199+
end
200+
end
201+
if datastore['DB_ALL_PASS']
202+
myworkspace.creds.each do |o|
203+
passwords << o.pass if o.ptype =~ /password/
204+
end
205205
end
206206
end
207-
208-
209207
credentials.concat(combine_users_and_passwords(users, passwords))
210208
credentials.uniq!
211209
credentials = just_uniq_users(credentials) if @strip_passwords

0 commit comments

Comments
 (0)