debian8 安装 msf


修改 /etc/apt/sources.list

我这里是用的网易和腾讯云的源,内容如下:

deb http://mirrors.163.com/debian/ jessie main non-free contrib
deb http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ jessie-backports main non-free contrib
deb http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
deb-src http://mirrors.163.com/debian-security/ jessie/updates main non-free contrib
# hello
deb http://mirrors.tencentyun.com/debian jessie main contrib non-free
deb http://mirrors.tencentyun.com/debian jessie-updates main contrib non-free
deb http://mirrors.tencentyun.com/debian-security jessie/updates main
#deb http://mirrors.tencentyun.com/debian jessie-backports main contrib non-free
#deb http://mirrors.tencentyun.com/debian jessie-proposed-updates main contrib non-free

deb-src http://mirrors.tencentyun.com/debian jessie main contrib non-free
deb-src http://mirrors.tencentyun.com/debian jessie-updates main contrib non-free
deb-src http://mirrors.tencentyun.com/debian-security jessie/updates main
#deb-src http://mirrors.tencentyun.com/debian jessie-backports main contrib non-free
#deb-src http://mirrors.tencentyun.com/debian jessie-proposed-updates main contrib non-free

更新

apt-get update

安装

cd /opt
git clone https://github.com/rapid7/metasploit-framework.git
cd metasploit-framework/
cat .ruby-version
apt-get install build-essential libreadline-dev libssl-dev libpq5 libpq-dev libreadline5 libsqlite3-dev libpcap-dev openjdk-7-jre subversion git-core autoconf postgresql pgadmin3 curl zlib1g-dev libxml2-dev libxslt1-dev vncviewer libyaml-dev ruby`cat .ruby-version` nmap -y
gem install --verbose --debug pcaprub wirble pg sqlite3 msgpack activerecord redcarpet rspec simplecov yard bundler

在这里我默认安装的是 ruby 2.1.x,官方推荐为 cat .ruby-version.

安装 ruby cat .ruby-version

curl -L get.rvm.io | bash -s stable
#仔细看输出结果,是否需要导入key
source /etc/profile.d/rvm.sh 
#如果报错,请导入key
source /etc/profile.d/rvm.sh
rvm install ruby-`cat .ruby-version`
ruby -v
rvm use `cat .ruby-version` --default 

gem 安装

gem install rdoc
gem install --verbose --debug pcaprub wirble pg sqlite3 msgpack activerecord redcarpet rspec simplecov yard bundler
bash -c 'for MSF in $(ls msf*); do ln -s /opt/metasploit-framework/$MSF /usr/local/bin/$MSF;done'
bundle install

安装数据库

su postgres
createuser msf -P -S -R -D
createdb -O msf msf
exit

配置数据信息

#vi /opt/metasploit-framework/database.yml
production:
   adapter: postgresql
   database: msf
   username: msf
   password: 
   host: 127.0.0.1
   port: 5432
   pool: 75
   timeout: 5

设置环境变量

sh -c "echo export MSF_DATABASE_CONFIG=/opt/metasploit-framework/database.yml >> ~/.bashrc"

开始

msfconsole
msf > db_connect -y ./database.yml
[*] Rebuilding the module cache in the background...

引用