From a70c77c9eb09939e736d2b7dba5e905ccd6929da Mon Sep 17 00:00:00 2001 From: sinn3r Date: Sat, 8 Feb 2014 15:51:11 -0600 Subject: [PATCH] Handle some more exceptions --- .../extensions/stdapi/webcam/webcam.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb b/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb index 7848a22e9a..286be2ac5c 100644 --- a/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb +++ b/lib/rex/post/meterpreter/extensions/stdapi/webcam/webcam.rb @@ -67,7 +67,6 @@ class Webcam allow_remote_webcam(remote_browser_path) ready_status = init_video_chat(remote_browser_path, offerer_id) - #select(nil, nil, nil, 1) connect_video_chat(offerer_id) end @@ -168,8 +167,13 @@ class Webcam tmp_dir = session.sys.config.getenv("TEMP") - write_file("#{tmp_dir}\\interface.html", interface) - write_file("#{tmp_dir}\\api.js", api) + begin + write_file("#{tmp_dir}\\interface.html", interface) + write_file("#{tmp_dir}\\api.js", api) + rescue ::Exception => e + elog("chat_request failed. #{e.class} #{e.to_s}") + raise RuntimeError, "Unable to initialize the interface on the target machine" + end args = '' if remote_browser_path =~ /Chrome/ @@ -181,7 +185,12 @@ class Webcam exec_opts = {'Hidden' => false, 'Channelized' => false} - session.sys.process.execute(remote_browser_path, "#{args} #{tmp_dir}\\interface.html", exec_opts) + begin + session.sys.process.execute(remote_browser_path, "#{args} #{tmp_dir}\\interface.html", exec_opts) + rescue ::Exception => e + elog("chat_request failed. #{e.class} #{e.to_s}") + raise RuntimeError, "Unable to start the remote browser: #{e.message}" + end end