Skip to content

Commit e1d76b8

Browse files
committed
Add more error handling
1 parent ffb54a1 commit e1d76b8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

modules/post/windows/manage/priv_migrate.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,13 @@ def migrate(target_pid, proc_name, current_pid)
107107
client.core.migrate(target_pid)
108108
print_good("Successfully migrated to #{client.sys.process.open.name} (#{client.sys.process.open.pid}) as: #{client.sys.config.getuid}")
109109
return true
110-
rescue ::Rex::Post::Meterpreter::RequestError => error
110+
rescue ::Rex::Post::Meterpreter::RequestError => req_error
111111
print_error("Could not migrate to #{proc_name}.")
112-
print_error(error.to_s)
112+
print_error(req_error.to_s)
113+
return false
114+
rescue ::Rex::RuntimeError => run_error
115+
print_error("Could not migrate to #{proc_name}.")
116+
print_error(run_error.to_s)
113117
return false
114118
end
115119
end

0 commit comments

Comments
 (0)