From fc833ea8df544a884712c7acc3620efdb6d993ba Mon Sep 17 00:00:00 2001 From: sinn3r Date: Mon, 28 Jan 2013 10:30:59 -0600 Subject: [PATCH] Catch exceptions and return value --- .../meterpreter/ui/console/command_dispatcher/core.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb b/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb index 8005b3b66d..6d8fc9ae3a 100644 --- a/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb +++ b/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb @@ -342,8 +342,15 @@ class Console::CommandDispatcher::Core return end - server = client.sys.process.open - print_status("Migrating from #{server.pid} to #{pid}...") + begin + server = client.sys.process.open + rescue TimeoutError => e + elog(e.to_s) + rescue RequestError => e + elog(e.to_s) + end + + server ? print_status("Migrating from #{server.pid} to #{pid}...") : print_status("Migrating to #{pid}") # Do this thang. client.core.migrate(pid)