*Backwards Compatibility Broken* - The session XMLRPC object now requires data for read/write to be encoded using Base64, this solves a number of issues with the builtin XMLRPC library with regards to binary data encoding. The response from read() now contains an 'encoding' element with the value 'base64', in order to differentiate from older versions.
git-svn-id: file:///home/svn/framework3/trunk@8776 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
b01f9ff233
commit
dcfdb95e5f
|
@ -40,13 +40,13 @@ class Session < Base
|
|||
end
|
||||
|
||||
if(not s.rstream.has_read_data?(0))
|
||||
{ "data" => "" }
|
||||
{ "data" => "", "encoding" => "base64" }
|
||||
else
|
||||
data = s.shell_read
|
||||
if data.length > 0
|
||||
@framework.events.on_session_output(s, data)
|
||||
end
|
||||
{ "data" => data }
|
||||
{ "data" => Rex::Text.encode_base64(data), "encoding" => "base64" }
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -56,9 +56,10 @@ class Session < Base
|
|||
if(s.type != "shell")
|
||||
raise ::XMLRPC::FaultException.new(403, "session is not a shell")
|
||||
end
|
||||
@framework.events.on_session_command(s, data)
|
||||
buff = Rex::Text.decode_base64(data)
|
||||
@framework.events.on_session_command(s, buff)
|
||||
|
||||
{ "write_count" => s.shell_write(data) }
|
||||
{ "write_count" => s.shell_write(buff) }
|
||||
end
|
||||
|
||||
def meterpreter_read(token, sid)
|
||||
|
@ -81,7 +82,7 @@ class Session < Base
|
|||
if data.length > 0
|
||||
@framework.events.on_session_output(s, data)
|
||||
end
|
||||
{ "data" => data }
|
||||
{ "data" => Rex::Text.encode_base64(data), "encoding" => "base64" }
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -98,11 +99,12 @@ class Session < Base
|
|||
s.init_ui(nil, Rex::Ui::Text::Output::Buffer.new)
|
||||
end
|
||||
|
||||
buff = Rex::Text.decode_base64(data)
|
||||
# This is already covered by the meterpreter console's on_command_proc
|
||||
# so don't do it here
|
||||
#@framework.events.on_session_command(s, data)
|
||||
#@framework.events.on_session_command(s, buff)
|
||||
|
||||
Thread.new { s.console.run_single(data) }
|
||||
Thread.new { s.console.run_single(buff) }
|
||||
|
||||
{}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue