added to_native for unicode

git-svn-id: file:///home/svn/incoming/trunk@3319 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Matt Miller 2006-01-06 15:34:51 +00:00
parent caa535bd95
commit b5b9e2ac1f
3 changed files with 17 additions and 1 deletions

View File

@ -23,7 +23,7 @@ $framework.encoders.each_module { |name, mod|
1000.times { 1000.times {
if (MachineTest.testraw(buf = e.encode("\xcc"))) if (MachineTest.testraw(buf = e.to_native(e.encode("\xcc"))))
failed += 1 failed += 1
$stderr.puts("#{name.ljust(25)}: failure: #{Rex::Text.to_hex(buf)}") $stderr.puts("#{name.ljust(25)}: failure: #{Rex::Text.to_hex(buf)}")
else else

View File

@ -51,6 +51,14 @@ class UnicodeMixed < Msf::Encoder::Alphanum
def encode_end(state) def encode_end(state)
state.encoded += Rex::Encoder::Alpha2::UnicodeMixed::add_terminator() state.encoded += Rex::Encoder::Alpha2::UnicodeMixed::add_terminator()
end end
#
# Returns the unicode version of the supplied buffer.
#
def to_native(buffer)
Rex::Text.to_unicode(buffer)
end
end end
end end end end end end

View File

@ -51,6 +51,14 @@ class UnicodeUpper < Msf::Encoder::Alphanum
def encode_end(state) def encode_end(state)
state.encoded += Rex::Encoder::Alpha2::UnicodeUpper::add_terminator() state.encoded += Rex::Encoder::Alpha2::UnicodeUpper::add_terminator()
end end
#
# Returns the unicode version of the supplied buffer.
#
def to_native(buffer)
Rex::Text.to_unicode(buffer)
end
end end
end end end end end end