Dont rescue Exception
parent
6c36d14be1
commit
fcc5cfb155
|
@ -47,8 +47,6 @@ module Exploit::Remote::SMB::Psexec
|
|||
# {Exploit::FileDropper#cleanup} and
|
||||
# {Exploit::FileDropper#on_new_session} handlers do it for you.
|
||||
#
|
||||
# @todo Figure out the actual exceptions this needs to deal with
|
||||
# instead of all the ghetto "rescue ::Exception" madness
|
||||
# @param command [String] Should be a valid windows command
|
||||
# @param disconnect [Boolean] Disconnect afterwards
|
||||
# @return [Boolean] Whether everything went well
|
||||
|
@ -66,7 +64,7 @@ module Exploit::Remote::SMB::Psexec
|
|||
if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil
|
||||
scm_handle = dcerpc.last_response.stub_data[0,20]
|
||||
end
|
||||
rescue ::Exception => e
|
||||
rescue Rex::Proto::DCERPC::Exceptions::Fault => e
|
||||
print_error("#{peer} - Error getting scm handle: #{e}")
|
||||
return false
|
||||
end
|
||||
|
@ -95,7 +93,7 @@ module Exploit::Remote::SMB::Psexec
|
|||
svc_handle = dcerpc.last_response.stub_data[4,20]
|
||||
svc_status = dcerpc.last_response.stub_data[24,4]
|
||||
end
|
||||
rescue ::Exception => e
|
||||
rescue Rex::Proto::DCERPC::Exceptions::Fault => e
|
||||
print_error("#{peer} - Error creating service: #{e}")
|
||||
return false
|
||||
end
|
||||
|
@ -106,7 +104,7 @@ module Exploit::Remote::SMB::Psexec
|
|||
response = dcerpc.call(0x13, stubdata)
|
||||
if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil
|
||||
end
|
||||
rescue ::Exception => e
|
||||
rescue Rex::Proto::DCERPC::Exceptions::Fault => e
|
||||
print_error("#{peer} - Error starting service: #{e}")
|
||||
return false
|
||||
end
|
||||
|
@ -116,13 +114,13 @@ module Exploit::Remote::SMB::Psexec
|
|||
response = dcerpc.call(0x02, stubdata)
|
||||
if dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil
|
||||
end
|
||||
rescue ::Exception => e
|
||||
rescue Rex::Proto::DCERPC::Exceptions::Fault => e
|
||||
print_error("#{peer} - Error removing service: #{e}")
|
||||
end
|
||||
vprint_status("#{peer} - Closing service handle...")
|
||||
begin
|
||||
response = dcerpc.call(0x0, svc_handle)
|
||||
rescue ::Exception => e
|
||||
rescue Rex::Proto::DCERPC::Exceptions::Fault => e
|
||||
print_error("#{peer} - Error closing service handle: #{e}")
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue