This article demonstrates how to install the Metasploit Framework with Kali Linux on WSL version 2. When installing Kali Linux for WSL2 using Microsoft Store, its file size is minimised by including the bare essentials by default.
Pre-requisites This example assumes that you have the following:
Windows Subsystem For Linux version 2 (WSL2) - This example is not tested on WSL version 1 Kali Linux for WSL2
Instructions STEP 1 - UPDATE THE REPOSITORIES
sudo apt update
STEP 2 - INSTALL AND ENABLE POSTGRESQL
sudo apt install postgresql
sudo /etc/init.d/postgresql start
STEP 3 - DOWNLOAD THE METASPLOIT FRAMEWORK INSTALLATION FILE
wget https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb
STEP 4 - INSTALL THE METASPLOIT FRAMEWORK
./msfupdate.erb
or
sudo bash ./msfupdate.erb
STEP 5 -VERIFY THE INSTALLATION To confirm that the Metasploit Framework was successfully installed, attempt to launch components supported by the framework.
To launch the Metasploit Framework command-line interface, run:
msfconsole
The below screen capture displays msfconsole launched with an ASCII-art banner.
You can use exit to exit msfconsole and attempt to launch the msfvenom, the command-line instance of Metasploit.
msfconsole
If the installation was successful, the help page will be displayed as demonstrated below.
Steps to install Metasploit on Windows 10 using the Windows Subsystem for Linux
1.) Enable Developer Mode
C:\> reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /f /v "AllowDevelopmentWithoutDevLicense" /d "1"
2.) Enable Windows Subsystem for Linux
C:\> DISM /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux
3.) Reboot
4.) Type "bash" at cmd line to get into Windows Subsystem for Linux and create a new password for your user.
5.) Install Metasploit
test@Desktop:/mnt/c$ curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && ./msfinstall