解决 Metasploit 启动及使用过程中一直出现警告信息的问题

问题描述

运行 msfconsole,即报如下警告信息:

➜  recon msfconsole
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil
/usr/share/metasploit-framework/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb:84: warning: deprecated Object#=~ is called on Integer; it always returns nil

警告信息会在使用过程中一直出现,扰乱阅读。

解决方法

打开 /opt/metasploit/vendor/bundle/ruby/2.7.0/gems/activerecord-4.2.11.1/lib/active_record/connection_adapters/abstract_adapter.rb 文件,找到 84 行,将 if config =~ SIMPLE_INT" 改成 if config.to_i.to_s == config 即可。

测试问题已解决。


EDIT:

修改文件之后发现这一个错误警告解决了,但是还有其他,不能一个一个文件改。

最终解决方案,在 bashrc 中做一个 alias

alias msfconsole="RUBYOPT='-W:no-deprecated -W:no-experimental' msfconsole"

所有问题解决。

EDIT2:

发现 msfvenom 还是会报警告,所以应该把 RUBYOPT='-W:no-deprecated -W:no-experimental' 放到 bashrc 里面。就不需要做 alias 了。正常使用 msf1msfvenom 即可。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值