From 90500eebd1a47e5bcc1f68294468fc2854bfd25e Mon Sep 17 00:00:00 2001 From: Matt Weeks Date: Tue, 2 Nov 2010 23:33:22 +0000 Subject: [PATCH] Enable running scripts independent of console state. Fixes issue with running scripts from GUI while shell/channel is active. git-svn-id: file:///home/svn/framework3/trunk@10872 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/rpc/session.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/rpc/session.rb b/lib/msf/core/rpc/session.rb index abb896dff6..515c4c1b71 100644 --- a/lib/msf/core/rpc/session.rb +++ b/lib/msf/core/rpc/session.rb @@ -145,7 +145,14 @@ class Session < Base end def meterpreter_script(token, sid, data) - meterpreter_write(token, sid, ["run #{data}"].pack("m*")) + s = _valid_session(token,sid,"meterpreter") + + if not s.user_output.respond_to? :dump_buffer + s.init_ui(Rex::Ui::Text::Input::Buffer.new, Rex::Ui::Text::Output::Buffer.new) + end + + Thread.new(s) { |sess| sess.console.run_single("run #{data}") } + {} end protected