Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msfconsole cannot input Chinese characters, and pasting Chinese characters will result in an error #19513

Open
sunlewuyou opened this issue Sep 28, 2024 · 3 comments
Assignees
Labels
bug confirmed Issues confirmed by a committer

Comments

@sunlewuyou
Copy link

Steps to reproduce

How'd you do it?

  1. run msfconsole

Expected behavior

Can input Chinese characters

Current behavior

The console cannot input Chinese characters. If you forcibly paste Chinese characters, an error will be reported as follows:

msf6 > /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/unicode.rb:137:in `encode': "\xE8" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/unicode.rb:137:in `split_by_width'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/line_editor.rb:300:in `split_by_width'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/line_editor.rb:439:in `wrapped_cursor_position'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/line_editor.rb:1182:in `scroll_into_view'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:358:in `block (3 levels) in inner_readline'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:354:in `each'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:354:in `block (2 levels) in inner_readline'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:405:in `block in read_io'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:392:in `loop'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:392:in `read_io'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:352:in `block in inner_readline'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:351:in `loop'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:351:in `inner_readline'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:291:in `block (2 levels) in readline'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/ansi.rb:162:in `block in with_raw_input'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/ansi.rb:162:in `raw'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline/ansi.rb:162:in `with_raw_input'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:290:in `block in readline'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:288:in `synchronize'
	from /opt/metasploit-framework/embedded/lib/ruby/gems/3.2.0/gems/reline-0.5.8/lib/reline.rb:288:in `readline'
	from /opt/metasploit-framework/embedded/lib/ruby/3.2.0/forwardable.rb:240:in `readline'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/input/readline.rb:146:in `readline_with_output'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/input/readline.rb:91:in `pgets'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:344:in `get_input_line'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:145:in `block in run'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:312:in `block in with_history_manager_context'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell/history_manager.rb:35:in `with_context'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:309:in `with_history_manager_context'
	from /opt/metasploit-framework/embedded/framework/lib/rex/ui/text/shell.rb:136:in `run'
	from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/console.rb:54:in `start'
	from /opt/metasploit-framework/embedded/framework/lib/metasploit/framework/command/base.rb:82:in `start'
	from /opt/metasploit-framework/bin/../embedded/framework/msfconsole:25:in `<main>'

Metasploit version

metasploit v6.4.28-dev-

@sunlewuyou sunlewuyou added the bug label Sep 28, 2024
@cn-kali-team
Copy link
Contributor

您好,怎么复现这个错误呢?可以提供一下详细的操作步骤吗?

@sunlewuyou
Copy link
Author

sunlewuyou commented Sep 29, 2024

@cn-kali-team

  1. run msfconsole
  2. force paste Chinese characters into the console

@bcoles bcoles added the confirmed Issues confirmed by a committer label Sep 29, 2024
@adfoster-r7
Copy link
Contributor

Similar issue with tab completion too:

sf6 > ls
[*] exec: ls

メタスプロイトが大好きです
msf6 > use linux/x64/meterpreter/reverse_tcp
msf6 payload(linux/x64/meterpreter/reverse_tcp) > ;s
[-] Unknown command: ;s. Run the help command for more details.
msf6 payload(linux/x64/meterpreter/reverse_tcp) > ls
[*] exec: ls

メタスプロイトが大好きです
msf6 payload(linux/x64/meterpreter/reverse_tcp) > generate -f elf -o meterpreter.elf
[-] Payload generation failed: One or more options failed to validate: LHOST.
msf6 payload(linux/x64/meterpreter/reverse_tcp) > set lhost 127.0.0.1
lhost => 127.0.0.1
msf6 payload(linux/x64/meterpreter/reverse_tcp) > generate -f elf -o meterpreter.elf
[*] Writing 250 bytes to meterpreter.elf...
msf6 payload(linux/x64/meterpreter/reverse_tcp) > generate -f elf -o ./<TAB>/home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/unicode.rb:127:in `encode': "\\xE3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/unicode.rb:127:in `calculate_width'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/line_editor.rb:60:in `block in lines'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/line_editor.rb:60:in `map'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/line_editor.rb:60:in `lines'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/line_editor.rb:509:in `render_differential'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/line_editor.rb:569:in `rerender'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:369:in `block in inner_readline'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:351:in `loop'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:351:in `inner_readline'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:291:in `block (2 levels) in readline'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/ansi.rb:162:in `block in with_raw_input'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/ansi.rb:162:in `raw'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline/ansi.rb:162:in `with_raw_input'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:290:in `block in readline'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:288:in `synchronize'
	from /home/kali/.rvm/gems/ruby-3.1.5@metasploit-framework/gems/reline-0.5.8/lib/reline.rb:288:in `readline'
	from /home/kali/.rvm/rubies/ruby-3.1.5/lib/ruby/3.1.0/forwardable.rb:238:in `readline'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/input/readline.rb:146:in `readline_with_output'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/input/readline.rb:91:in `pgets'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/shell.rb:344:in `get_input_line'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/shell.rb:145:in `block in run'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/shell.rb:312:in `block in with_history_manager_context'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/shell/history_manager.rb:35:in `with_context'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/shell.rb:309:in `with_history_manager_context'
	from /home/kali/Documents/github/metasploit-framework/lib/rex/ui/text/shell.rb:136:in `run'
	from /home/kali/Documents/github/metasploit-framework/lib/metasploit/framework/command/console.rb:54:in `start'
	from /home/kali/Documents/github/metasploit-framework/lib/metasploit/framework/command/base.rb:82:in `start'
	from ./msfconsole:25:in `<main>'
                                                                                                                                                                       
┌──(kali㉿kali)-[~/Documents/github/metasploit-framework]
└─$        

Replicating with generate with -o ./<TAB>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed Issues confirmed by a committer
Projects
Status: No status
Development

No branches or pull requests

5 participants