首先说明,msf最好还是安装在linux下,安装在windows下的话问题实在太多了。
1. Metasploit-framework v6.2.19 Setup Wizard ended prematurely
截图如下:
出现这个的原因其实很简单:权限不够。
所以,只需要切换成administrator,或者以管理员权限运行cmd,在cmd中执行安装文件即可。
2. msfdb init失败
报错如下:
<internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': 126: The specified module could not be found. - C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg_ext.so (LoadError) from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:49:in `block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:32:in `rescue in block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:26:in `block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:42:in `<module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:6:in `<top (required)>' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require' from C:/metasploit-framework/bin/../embedded/framework/msfdb:15:in `<main>' <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': 126: The specified module could not be found. - C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg_ext.so (LoadError) from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:49:in `block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/dll_directory.rb:67:in `initialize' from C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in `new' from C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/ruby_installer/runtime/singleton.rb:12:in `add_dll_directory' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:28:in `block in <module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:42:in `<module:PG>' from C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/pg-1.4.3/lib/pg.rb:6:in `<top (required)>' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require' from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:149:in `require' from C:/metasploit-framework/bin/../embedded/framework/msfdb:15:in `<main>' <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- pg (LoadError) from <internal:C:/metasploit-framework/embedded/lib/ruby/site_ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require' from C:/metasploit-framework/bin/../embedded/framework/msfdb:15:in `<main>'
出现这种报错就是因为第1个错误,也就是msf的相关文件没有安装完全。
同时,这个错误反应在msfconsole中就是使用db_status等命令时提示:No database driver installed
3.msfdb init出现以下错误:
别看数据库在启动,但是永远也启动不了。目前这个错误原因还不是很清楚,也没找到直接的解决方法。
只想到了一个替代方案:安装一个postgresql,然后让msf连接到这个安装的postgresql上。
但是后续还有很多麻烦的地方。所以,msf的数据库问题我就放弃了,还是乖乖用kali上的msf吧。
标签:metasploit,gems,lib,Windows,framework,pg,ruby From: https://www.cnblogs.com/brilliantHongXi/p/16746330.html