环境:
centos8 腾讯云
操作步骤:
下载erb文件,国内下载不了,需要借助第三方的下载平台:
https://ghproxy.com/
具体流程:
访问
https://ghproxy.com/
在输入框输入erb文件的下载地址,并点击下载
https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb
返回页面会将该文件的内容全部显示出来,将页面的内容全选复制
在centos8的root目录下新建msfinstall文件
vim msfinstall
将刚刚全选复制的内容粘贴到msfinstall文件中,然后保存(:wq)
在root目录下,给msfinstall文件赋予执行权限
chmod +x msfinstall
运行msfinstall文件
./msfinstall
切换到普通用户,如果没有普通用户,新建普通用户,然后切换到普通用户
useradd test
su test
初始化数据库
msfdb init
在初始化过程中的配置
Would you like to init the webservice? (Not Required) [no]: yes
Initial MSF web service account username? [painter]:输入你要设置的数据库用户名
Initial MSF web service account password? (Leave blank for random password): 输入你要设置的数据库密码
保存好你的密匙
MSF web service username: xxx
MSF web service password: xxx
MSF web service user API token: xxxxx
查看你的数据库版本
msfconsole --version
在root用户下升级metasploit
msfupdate
启动metasploit
msfconsole
具体使用方式这里不过多介绍
后记
之后的一个更新中,使用msfupdate后,再输入msfconsole,提示-bash: msfconsole: 未找到命令
解决方法:
编辑环境变量
vim /etc/profile
在文件末尾添加如下语句,并保存后退出
export PATH="/opt/metasploit-framework/bin:$PATH"
应用环境变量
source /etc/profile
再次输入msfconsole成功启动