更新Metasploit最新版本:
#cd /opt/metasploit/
#rm -rf msf3
#git clone --depth=1 git://github.com/rapid7/metasploit-framework msf3
执行msfupdate出错如下:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/opt/metasploit/ruby/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /opt/metasploit/postgresql/bin/pg_config
checking for libpq-fe.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/opt/metasploit/ruby/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
--without-pg-config
--with-pg_config
--without-pg_config
/opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:506:in `try_cpp'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:970:in `block in find_header'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /opt/metasploit/ruby/lib/ruby/1.9.1/mkmf.rb:969:in `find_header'
from extconf.rb:43:in `<main>'
Gem files will remain installed in /opt/metasploit/ruby/lib/ruby/gems/1.9.1/gems/pg-0.15.0 for inspection.
Results logged to /opt/metasploit/ruby/lib/ruby/gems/1.9.1/gems/pg-0.15.0/ext/gem_make.out
An error occured while installing pg (0.15.0), and Bundler cannot continue.
Make sure that `gem install pg -v '0.15.0'` succeeds before bundling.
执行msfconsole出错如下:
Run `bundle install` to install missing gems.
执行bundle install出错如下:
Make sure that `gem install pg -v '0.15.0'` succeeds before bundling.
搜索国外论坛总结下完整的BackTrack 5 R3 Metasploit更新方法, 以备后用:
#cd /opt/metasploit/
#rm -rf msf3
#git clone --depth=1 git://github.com/rapid7/metasploit-framework msf3
修改文件:
32位:/opt/metasploit/ruby/lib/ruby/1.9.1/i686-linux/rbconfig.rb
64位:/opt/metasploit/ruby/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb
找到CONFIG["LIBRUBYARG_STATIC"] = "-Wl,-R -Wl,$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static"
改为CONFIG["LIBRUBYARG_STATIC"] = "-Wl,-R -Wl,$(libdir) -L$(libdir) "
然后执行(一定要在/opt/metasploit/msf3目录下执行):
#cd /opt/metasploit/msf3
#./msfupdate
执行上面命令后会自动检查安装更新msf3所依赖的ruby模块,更新Metasploit一直出错在pg-0.15.0的问题迎刃而解@@
附更新后数据库错误问题解决办法:
msf > search ms13
[!] Database not connected or cache not built, using slow search msf > db_rebuild_cache
[*] Purging and rebuilding the module cache in the background...