199 字
1 分钟
Installing Metasploit in WSL
https://mirrors.tuna.tsinghua.edu.cn/help/debian/Tsinghua’s Debian domestic mirror
Change the system language to Chinese
sudo dpkg-reconfigure locales#勾上zh_CN GB2312 zh_CN.GBK GBK zh_CN.UTF-8 UTF-8#重启生效Install metasploit-framework
sudo nano /etc/apt/sources.list#加入下面这一行deb http://mirrors.aliyun.com/kali kali-rolling main non-free contribsudo wget -q -O - https://archive.kali.org/archive-key.asc | sudo apt-key addsudo apt updatesudo apt install metasploit-frameworkConnect to the database
Connecting metasploit to a database in WSL is a bit troublesome. If you follow the normal procedure, you’ll get the error below.
msfconsole>db_statuspostgresql selected,no connect>msfdb initSystem has not been booted with systemd as init system (PID 1). Can't operate.The reason is that WSL doesn’t have systemd when it starts.
Solution
Start the database service
msfdb initsudo service postgresql startsudo service postgresql statusManually create the database user and database
#cd /etc/postgresql/13/mainsudo -u postgres psqlalter user postgres password 'root';create user msf with password 'metasploit' createdb;create database msf with owner=msf;quitConnect in metasploit
msfconsole#db_connect 数据库用户名:数据库密码@数据库ip[:数据库端口]/数据库名db_connect msf:metasploit@127.0.0.1:5958/msfdb_statusSet up automatic connection
sudo nano /usr/share/metasploit-framework/config/database.ymlChange username and password inside to the ones you set.
Installing Metasploit in WSL
https://tski.uk/blog/en/wsl-metasploit-config/