如何正确解救此NameError

时间:2017-03-22 10:56:12

标签: ruby

我遇到了这个NameError

>> v
NameError: undefined local variable or method `v' for #<Rex::Post::Meterpreter::Ui::Console::CommandDispatcher::Core:0x00000002871728>
    from (irb):1:in `cmd_irb'
    from /home/txjoe/git/metasploit-framework/lib/rex/ui/text/irb_shell.rb:54:in `block in run'
    from /home/txjoe/git/metasploit-framework/lib/rex/ui/text/irb_shell.rb:53:in `catch'
    from /home/txjoe/git/metasploit-framework/lib/rex/ui/text/irb_shell.rb:53:in `run'
    from /home/txjoe/git/metasploit-framework/lib/rex/post/meterpreter/ui/console/command_dispatcher/core.rb:390:in `cmd_irb'
    from /home/txjoe/git/metasploit-framework/lib/rex/ui/text/dispatcher_shell.rb:430:in `run_command'
    from /home/txjoe/git/metasploit-framework/lib/rex/post/meterpreter/ui/console.rb:105:in `run_command'

我在第54行打开文件metasploit-framework/lib/rex/ui/text/irb_shell.rb,这可能导致错误:

catch(:IRB_EXIT) do
  irb.eval_input
end

鉴于这是一个名称错误,我添加了语句

catch(:IRB_EXIT) do
  begin
    irb.eval_input
  rescue NameError => e
    puts(e)
  end
end

但我仍然得到错误。我在错误的地方使用救援吗?

使用metasploit中的meterpreter会话中的irb shell时会发生这种情况。

0 个答案:

没有答案