Metasploit mailing list archives
Locale in non-English exploit shell
From: nagos1 at gmail.com (Vladimir Yakovlev)
Date: Wed, 12 Nov 2008 19:17:40 +0300
When you explit non-English Windows, some text appear in wrong charset. On russain Windows cmd.exe runs in cp866, meterpeter in cp1251. My Linux box run on UTF-8. So i needed recode cp866->UTF-8 in bindshell, and cp1251->UTF-8 in meterpeter. To cd/download/... non-english dirs all commands must be transcoded back. So whai is my patch. Charsets are hardcoded. Good idea is place charsets in config, or autodetect from windows version. svn diff Index: lib/rex/ui/interactive.rb =================================================================== --- lib/rex/ui/interactive.rb (revision 5886) +++ lib/rex/ui/interactive.rb (working copy) @@ -147,7 +147,7 @@ # def _stream_read_remote_write_local(stream) data = stream.get - + data=Iconv.iconv("utf-8","cp866", data).join(" ") user_output.print(data) end @@ -156,7 +156,7 @@ # def _stream_read_local_write_remote(stream) data = user_input.gets - + data=Iconv.iconv("cp866","utf-8", data).join(" ") stream.put(data) end Index: lib/rex/ui/text/dispatcher_shell.rb =================================================================== --- lib/rex/ui/text/dispatcher_shell.rb (revision 5886) +++ lib/rex/ui/text/dispatcher_shell.rb (working copy) @@ -62,7 +62,7 @@ # Wrapps shell.print # def print(msg = '') - shell.print(msg) + shell.print(Iconv.iconv("utf-8","cp1251", msg).join(" ")) end # @@ -178,6 +178,7 @@ # Run a single command line. # def run_single(line) + line=Iconv.iconv("cp1251","utf-8", line).join(" ") arguments = parse_line(line) method = arguments.shift found = false @@ -361,4 +362,4 @@ end end -end \ No newline at end of file +end -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.metasploit.com/pipermail/framework/attachments/20081112/532412a0/attachment.htm>
Current thread:
- Locale in non-English exploit shell Vladimir Yakovlev (Nov 12)
- Locale in non-English exploit shell H D Moore (Nov 12)
- Locale in non-English exploit shell Vladimir Yakovlev (Nov 12)
- Locale in non-English exploit shell H D Moore (Nov 14)
- Locale in non-English exploit shell takuan (Nov 14)
- Locale in non-English exploit shell H D Moore (Nov 12)