VPS安装metasploit-framework

一、安装过程

 在/etc/apt/sources.list添加kali源:

root@localhost:~# cat >> /etc/apt/sources.list << EOF
#Kali Source
deb http://http.kali.org/kali kali-rolling main non-free contrib
deb-src http://http.kali.org/kali kali-rolling main non-free contrib
EOF
root@localhost:~# apt-get update

##如果出现GPG error,参考这里

或执行下面的命令

 

wget -q -O - https://archive.kali.org/archive-key.asc | apt-key add

 

##注意,有的网站的教程,kali-rolling这个位置使用kali或者sana。这个位置表示发行代号。我去官方源站点中看了一下,并没有kali这个代号,而且官方网站已经停止对sana源的支持,推荐使用2016年1月推出的kali-rolling代号,这也应该是我朋友上面的404 错误的原因。以后读到这篇文章的小伙伴,出现404错误的话,记得注意一下你的发行代号是否已经没有或者停止支持了。

 

后面的部分就和其它网站上的教程如出一辙了

  • 安装postgresql数据库

root@localhost:~# apt-get install postgresql
root@localhost:~# su - postgres -c "psql"              #切换到postgres用户并登陆数据库
##有的教程中使sudo -u postgres psql也是可以的
postgres=# alter user postgres with password ‘postgrespass‘;   #修改数据库密码为postgrespass
postgres=# \q           #退出数据库

 

  •  安装metasploit

root@localhost:~# apt-get install metasploit-framework

# 这里会装一大堆东西,而且会更新libc之类软件,如果你的系统还装有其它软件,请谨慎安装

 

  • 配置metasploit

root@localhost:~# msconfig
msf > db_connect postgres:postgrespass@127.0.0.1/msfbook    #使msf连接到postgresql数据库
[*] Rebuilding the module cache in the background...      #这句话的意思是在后台重建模块缓存。
msf > db_status                #查看数据库连接状态
[*] postgresql connected to msfbook       #这个时候就可以正常使用msf了。

msf > search smb
[!] Module database cache not built yet, using slow search
##如果出现了这个信息,意思是说数据库中没有模块的缓存,使用缓慢的搜索(直接搜索磁盘)。
##出现这个情况有可能是后台重建缓存未完成,只需稍等片刻再尝试,也可能是数据库连接不正常,
##导致无法重建/读取缓存。

以上部分来自:http://www.bubuko.com/infodetail-1760180.html&&http://www.bubuko.com/infodetail-1760180.html

二、关于出现公钥错误的解决办法

当使用非官方debian源的时候,会出现gpg error的问题:

W: GPG error: http://ftp.sjtu.edu.cn ./ Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 73E6B0FAA42A6CF5
W: You may want to run apt-get update to correct these problems

(1)倒数第二行的73E6B0FAA42A6CF5即为缺失的公钥,使用如下命令获得公钥:
gpg --keyserver pgp.mit.edu --recv-keys 73E6B0FAA42A6CF5
公钥服务器可更换为其他,如wwwkeys.eu.pgp.net,视自己的网络状况决定。
获得公钥后的输出如下:
Juno:/etc/apt# gpg --keyserver pgp.mit.edu --recv-keys 73E6B0FAA42A6CF5
gpg: requesting key A42A6CF5 from hkp server pgp.mit.edu
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key A42A6CF5: public key "shame (beryl repository) <shame@sidux>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1

(2)将公钥导入apt
gpg --armor --export A42A6CF5 | apt-key add -

(3)再次运行apt-get update

以上部分来自:http://blog.chinaunix.net/uid-16938570-id-2841664.html

三、其他问题

我安装的过程中,在处理公钥的时候遇到一个报错:
gpg: directory '/root/.gnupg' created
gpg: can't open '/usr/share/gnupg/dirmngr-conf.skel': No such file or directory
gpg: new configuration file '/root/.gnupg/gpg.conf' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory
gpg: connecting dirmngr at '/run/user/0/gnupg/S.dirmngr' failed: No such file or directory
gpg: keyserver receive failed: No dirmngr

是因为没有安装dirmngr,只要进行安装就好了

apt-get install dirmngr

 

posted @ 2017-09-12 23:44  隐念笎  阅读(2103)  评论(0编辑  收藏  举报