Only clean up handles if process started

bug/bundler_fix
Meatballs 2015-01-27 21:10:31 +00:00
parent c2d15f2b31
commit 81fa509b50
No known key found for this signature in database
GPG Key ID: 5380EAF01F2F8B38
1 changed files with 2 additions and 3 deletions

View File

@ -102,9 +102,8 @@ class Metasploit3 < Msf::Post
# execute command and get output with a poor mans pipe # execute command and get output with a poor mans pipe
if priv_check if priv_check
print_status("Executing CreateProcessAsUserA...we are SYSTEM") print_status("Executing CreateProcessAsUserA...we are SYSTEM")
begin
pi = create_process_as_user(domain, user, password, nil, cmdstr) pi = create_process_as_user(domain, user, password, nil, cmdstr)
ensure if pi
session.railgun.kernel32.CloseHandle(pi[:process_handle]) session.railgun.kernel32.CloseHandle(pi[:process_handle])
session.railgun.kernel32.CloseHandle(pi[:thread_handle]) session.railgun.kernel32.CloseHandle(pi[:thread_handle])
end end