Permalink
Browse files

Merge branch 'master' of github.com:rapid7/metasploit-framework into …

…HEAD

git-svn-id: https://www.metasploit.com/svn/framework3/trunk@15268 4d416f70-5f16-0410-b530-b9f4589650da
  • Loading branch information...
rapid7
rapid7 committed May 14, 2012
1 parent f8e1f37 commit 9ad15ca8c3f5b5335ed14c849fc94b4b2d8e6582
Showing with 14 additions and 2 deletions.
  1. +14 −2 modules/post/windows/gather/hashdump.rb
@@ -58,6 +58,8 @@ def initialize(info={})
end
def run
+ tries = 0
+
begin
print_status("Obtaining the boot key...")
@@ -93,8 +95,18 @@ def run
rescue ::Interrupt
raise $!
rescue ::Rex::Post::Meterpreter::RequestError => e
- print_error("Meterpreter Exception: #{e.class} #{e}")
- print_error("This script requires the use of a SYSTEM user context (hint: migrate into service process)")
+ # Sometimes we get this invalid handle race condition.
+ # So let's retry a couple of times before giving up.
+ # See bug #6815
+ if tries < 5 and e.to_s =~ /The handle is invalid/
+ print_status("Handle is invalid, retrying...")
+ tries += 1
+ retry
+
+ else
+ print_error("Meterpreter Exception: #{e.class} #{e}")
+ print_error("This script requires the use of a SYSTEM user context (hint: migrate into service process)")
+ end
#rescue ::Exception => e
# print_error("Error: #{e.class} #{e} #{e.backtrace}")
end

0 comments on commit 9ad15ca

Please sign in to comment.