diff --git a/modules/encoders/encoder_test.rb.ut.rb b/modules/encoders/encoder_test.rb.ut.rb index dc72b8d5af..941fae1ef2 100644 --- a/modules/encoders/encoder_test.rb.ut.rb +++ b/modules/encoders/encoder_test.rb.ut.rb @@ -23,7 +23,7 @@ $framework.encoders.each_module { |name, mod| 1000.times { - if (MachineTest.testraw(buf = e.encode("\xcc"))) + if (MachineTest.testraw(buf = e.to_native(e.encode("\xcc")))) failed += 1 $stderr.puts("#{name.ljust(25)}: failure: #{Rex::Text.to_hex(buf)}") else diff --git a/modules/encoders/x86/unicode_mixed.rb b/modules/encoders/x86/unicode_mixed.rb index 1b298270b1..67518c0429 100644 --- a/modules/encoders/x86/unicode_mixed.rb +++ b/modules/encoders/x86/unicode_mixed.rb @@ -51,6 +51,14 @@ class UnicodeMixed < Msf::Encoder::Alphanum def encode_end(state) state.encoded += Rex::Encoder::Alpha2::UnicodeMixed::add_terminator() end + + # + # Returns the unicode version of the supplied buffer. + # + def to_native(buffer) + Rex::Text.to_unicode(buffer) + end + end end end end diff --git a/modules/encoders/x86/unicode_upper.rb b/modules/encoders/x86/unicode_upper.rb index af9fd10045..52dbbd1e5b 100644 --- a/modules/encoders/x86/unicode_upper.rb +++ b/modules/encoders/x86/unicode_upper.rb @@ -51,6 +51,14 @@ class UnicodeUpper < Msf::Encoder::Alphanum def encode_end(state) state.encoded += Rex::Encoder::Alpha2::UnicodeUpper::add_terminator() end + + # + # Returns the unicode version of the supplied buffer. + # + def to_native(buffer) + Rex::Text.to_unicode(buffer) + end + end end end end