WSL2 Kali Linux Commands

Some useful commands

Install Kali Win-Kex2

sudo apt upgrade && sudo apt install -y kali-win-kex

Install all default tools

sudo apt install kali-linux-default

Start Win-Kex (in kali terminal)

kex

Find out what port windows RDP is using (powershell command)

Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber"

Output as shown here

portnumber

Change Remote Desktop Port (powershell)

Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "PortNumber" -Value 3390

Access WSL2 from local LAN

netsh interface portproxy add v4tov4 listenport=3390 listenaddress=0.0.0.0 connectport=3390 connectaddress=<kali-machine-ip>

Find out Kali Private IP

ip addr | grep eth0

Add Firewall Rules in Windows

New-NetFirewallRule -DisplayName 'RDPPORTLatest' -Profile 'Public' -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3390