VPS搭建msf教程
VPS搭建msf教程
20231215记录
弄好VPS后,先更新yum:
yum -y update
之后执行下面的命令即可(好像连postgres都不用管就可以连接数据库):
wget https://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run
end
2022年5月16日
19:30
这里使用的是centos7搭建的vps,搭建完毕之后按照以下步骤执行即可:
1、切换到root权限之后找一个合适目录下载msf,这里我在home目录里面下载的。
wget https://downloads.metasploit.com/data/releases/metasploit-latest-linux-x64-installer.run
给权限:
chmod +x metasploit-latest-linux-x64-installer.run
运行:
./metasploit-latest-linux-x64-installer.run
2、安装postgresql
yum install -y postgresql-server
配置数据库:
[root@localhost ~]# postgresql-setup initdb
[root@localhost ~]# su - postgres
-bash-4.2$ whoami
postgres
-bash-4.2$ pg_ctl -D /var/lib/pgsql/data start
-bash-4.2$ psql -p 5432
新密码:
postgres=# \password postgres
创建msf数据库:
postgres=# create user msf with password 'msf';
postgres=# create database msf owner msf;
postgres=# alter role msf login;
退出数据库:
\q
修改配置文件:
[root@localhost ~]# find / -name pg_hba.conf
[root@localhost ~]# vi /var/lib/pgsql/data/pg_hba.conf
最重要的环节:
重启数据库:
[root@localhost ~]# su - postgres
-bash-4.2$ pg_ctl -D /var/lib/pgsql/data restart
切换root用户,测试连接是否正常:
[root@localhost ~]# psql -U msf -d msf -h 127.0.0.1 -p 5432
修改msf配置链接数据文件:
[root@localhost ~]# find / -name database.yml.example
/opt/metasploit/apps/pro/ui/config/database.yml.example
/opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit-framework-4.17.73/config/database.yml.example
/opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit-credential-2.0.14/spec/dummy/config/database.yml.example
/opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit_data_models-2.0.17/spec/dummy/config/database.yml.example
/opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit-model-2.0.4/spec/dummy/config/database.yml.example
[root@localhost ~]# cp /opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit-framework-4.17.73/config/database.yml.example /opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit-framework-4.17.73/config/database.yml
[root@localhost ~]# vi /opt/metasploit/apps/pro/vendor/bundle/ruby/2.6.0/gems/metasploit-framework-4.17.73/config/database.yml
修改配置文件内容:
development: &pgsql
adapter: postgresql
database: msf
username: msf
password: msf
host: localhost
port: 5432
pool: 200
timeout: 5
重启msf、重启postgresql
登陆msf,查看状态即可:
db_connect msf:msf@localhost/msf
db_connect msf:msf@127.0.0.1/msf
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库