@@ -22,7 +22,7 @@ def initialize(info = {})
22
22
OptBool . new ( 'VERBOSE' , [ true , "Whether to print output for all attempts" , true ] ) ,
23
23
OptBool . new ( 'BLANK_PASSWORDS' , [ false , "Try blank passwords for all users" , true ] ) ,
24
24
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 ] ) ,
26
26
OptBool . new ( 'DB_ALL_USERS' , [ false , "Add all users in the current database to the list" , false ] ) ,
27
27
OptBool . new ( 'DB_ALL_PASS' , [ false , "Add all passwords in the current database to the list" , false ] ) ,
28
28
OptBool . new ( 'STOP_ON_SUCCESS' , [ true , "Stop guessing when a credential works for a host" , false ] ) ,
@@ -180,32 +180,30 @@ def build_credentials_array
180
180
return credentials if datastore [ 'USERPASS_FILE' ] =~ /^memory:/
181
181
users = load_user_vars ( credentials )
182
182
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
-
195
183
cleanup_files ( )
196
184
if datastore [ 'USER_AS_PASS' ]
197
185
credentials = gen_user_as_password ( users , credentials )
198
186
end
199
187
if datastore [ 'BLANK_PASSWORDS' ]
200
188
credentials = gen_blank_passwords ( users , credentials )
201
189
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
205
205
end
206
206
end
207
-
208
-
209
207
credentials . concat ( combine_users_and_passwords ( users , passwords ) )
210
208
credentials . uniq!
211
209
credentials = just_uniq_users ( credentials ) if @strip_passwords
0 commit comments