This commit makes the new unicode string encoding optional, it can be disabled by setting EnableUnicodeEncoding to false or through the 'disable_unicode_encoding' console command in the Meterpreter shell. Fixes #4986

git-svn-id: file:///home/svn/framework3/trunk@13278 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
HD Moore 2011-07-21 15:44:54 +00:00
parent ce862cf999
commit 3046896204
4 changed files with 11 additions and 7 deletions

View File

@ -145,9 +145,9 @@ class Meterpreter < Rex::Post::Meterpreter::Client
timeout = 5
etime = ::Time.now.to_f + timeout
buff = ""
# Keep reading data until no more data is available or the timeout is
# reached.
# Keep reading data until no more data is available or the timeout is
# reached.
while (::Time.now.to_f < etime)
res = shell_read(-1, timeout)
break unless res
@ -298,7 +298,7 @@ class Meterpreter < Rex::Post::Meterpreter::Client
# The rest of this requires a database, so bail if it's not
# there
return if not (framework.db and framework.db.active)
return if not (framework.db and framework.db.active)
framework.db.report_note({
:type => "host.os.session_fingerprint",

View File

@ -17,6 +17,7 @@ module MeterpreterOptions
OptString.new('InitialAutoRunScript', [false, "An initial script to run on session creation (before AutoRunScript)", '']),
OptString.new('AutoRunScript', [false, "A script to run automatically on session creation.", '']),
OptBool.new('AutoSystemInfo', [true, "Automatically capture system information on initialization.", true]),
OptBool.new('EnableUnicodeEncoding', [true, "Automatically encode UTF-8 strings as hexadecimal", true])
], self.class)
end
@ -30,6 +31,9 @@ module MeterpreterOptions
# Defer the session initialization to the Session Manager scheduler
framework.sessions.schedule Proc.new {
# Configure unicode encoding before loading stdapi
session.encode_unicode = ( datastore['EnableUnicodeEncoding'] ? true : false )
session.init_ui(self.user_input, self.user_output)
if (datastore['AutoLoadStdapi'] == true)

View File

@ -79,7 +79,7 @@ class Driver < Msf::Ui::Driver
prompt = self.framework.datastore['Prompt']
prompt_char = self.framework.datastore['PromptChar'] || DefaultPromptChar
end
# Call the parent
super(prompt, prompt_char, histfile, framework)

View File

@ -373,14 +373,14 @@ class Client
# Encodes (or not) a UTF-8 string
#
def unicode_filter_encode(str)
self.encode_unicode ? client.unicode_filter_encode(str) : str
self.encode_unicode ? Rex::Text.unicode_filter_encode(str) : str
end
#
# Decodes (or not) a UTF-8 string
#
def unicode_filter_decode(str)
self.encode_unicode ? client.unicode_filter_decode(str) : str
self.encode_unicode ? Rex::Text.unicode_filter_decode(str) : str
end
#