最新 centos 系统安装、卸载与更新 Metasploit 最新版msf安装手记

【注意:此文章为博主原创文章!转载需注意,请带原文链接,至少也要是txt格式!】
首先说说坑,网上找了N多资料,但是多半都是废废。。。各种问题。
我这个经过了多次实验。必须是最新的Centos系统哦。
更新系统至最新的命令:
yum -y update
安装metasploit,具体命令如下
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall
chmod 755 msfinstall
./msfinstall
Metasploit数据库配置:
cd /opt/metasploit-framework/bin/
useradd msf
passwd msf #然后输入两次密码,随便,也可以输入123
su msf
./msfdb init #中间有任何需要输入 如果是账户就是msf 密码就是123 剩下如果不懂就各种回车就行
exit ##退出 换成root用户
cp /home/msf/.msf4/database.yml /opt/metasploit-framework/embedded/framework/config/
####cp:是否覆盖"/opt/metasploit-framework/embedded/framework/config/database.yml"? y
以上过程完成后,msf再次启动测试正常,数据库连接正常
msf5 > db_status
[*] Connected to msf. Connection type: postgresql.
--------------过程中遇到的坑---------------
第一个坑:重启
重启后再次进入msfconsole ,是不连接数据库的。
你可以通过root用户看一下端口进程:
netstat -napA inet
那我们就需要进入到msf用户里面来启动数据库。
su msf
cd /usr/bin/
/usr/bin/msfdb start
###正常应该可以看到如下显示:
###Starting database at /home/msf/.msf4/db...success
###Attempting to start MSF web service...success
###MSF web service started and online
exit ##换成root用户
此步可以不做,,再次查看端口应该与配置一样
netstat -napA inet
cd /opt/metasploit-framework/embedded/framework/config/
cat database.yml
参考:https://zhuanlan.kanxue.com/article-8774.htm
https://qiita.com/sanyamarseille/items/6b81ca9424517e5d8007
------------Metasploit卸载------------
我想完全删除并重新安装Metasploit,因为我搞砸了。
但是我找不到像该文档所说的卸载脚本:https : //metasploit.help.rapid7.com/docs/uninstalling-metasploit。
所以我在:
/home/.msf4和删除了两个文件夹/opt/metasploit-framework。
因此,我尝试使用每夜安装程序重新安装它:
curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \ chmod 755 msfinstall && \ ./msfinstall
它返回阻止我的我:
chmod 755 msfinstall && \ ./msfinstall % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 5525 100 5525 0 0 12672 0 --:--:-- --:--:-- --:--:-- 12672 Switching to root user to update the package Checking for and installing update.. Reading packets list... Done Building dependencies tree.. Reading state information... Done metasploit-framework is already the latest version (4.17.0+20180815103558.git.3.27bab54~1rapid7-1).
所以我被封锁了。
Metasploit版本
4.17.6开发
我的最终解决方案是:
yum remove metasploit-framework
参考来源:https://github.com/rapid7/metasploit-framework/issues/10535
---------------Metasploit更新------------------

安装过程很简单,只需要等待几分钟便可。

问题出现在更新完成之后,提示找不到这样的文件或目录

这个时候只需要找到msf安装的路径,我的安装路径在:/opt/metasploit-framework/bin
然后对/etc/profile 进行编辑,在最后一行添加环境变量:
export PATH="/opt/metasploit-framework/bin:$PATH"

更新环境变量source /etc/profile,重启msf成功

参考来源:https://www.jianshu.com/p/c4210eb8cab5

布施恩德可便相知重
微信扫一扫打赏
支付宝扫一扫打赏