KALI AND WSL: USEFUL GUIDE AND COMMANDS
1. Setting Up Kali Linux on WSL
- Install Kali Linux on WSL: Open PowerShell as Administrator and run:
Code
wsl --install -d kali-linuxCode
sudo apt update && sudo apt upgrade -y2. Installing Essential Tools
Many Kali tools are not pre-installed in WSL. Use `kali-linux-large` or install individual packages:
- Install the complete toolset:
Code
sudo apt install kali-linux-largeCode
sudo apt install nmap3. Running GUI Tools
WSL supports GUI apps (Windows 11 or Windows 10 build 21364 or later).
- Install Wireshark:
Code
sudo apt install wiresharkCode
wiresharkCode
sudo dpkg-reconfigure wireshark-common
sudo usermod -aG wireshark $USER4. Examples of Common Tools
a. Nmap
Nmap is a network scanning tool.
- Scan a local network for active devices:
Code
sudo nmap -sn 192.168.1.0/24Code
sudo nmap -sV 192.168.1.101b. Metasploit Framework
Metasploit is a penetration testing framework.
- Install Metasploit:
Code
sudo apt install metasploit-frameworkCode
msfconsoleCode
use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 192.168.1.102
runc. Aircrack-ng
Aircrack-ng is used for Wi-Fi auditing.
- Install Aircrack-ng:
Code
sudo apt install aircrack-ngCode
sudo airodump-ng wlan0mond. Hydra
Hydra is a password-cracking tool.
- Install Hydra:
Code
sudo apt install hydraCode
hydra -l admin -P /usr/share/wordlists/rockyou.txt ssh://192.168.1.103e. Wireshark (CLI Version – Tshark)
Use Tshark for packet analysis when GUI is unavailable.
- Install Tshark:
Code
sudo apt install tsharkCode
sudo tshark -i eth0f. SQLmap
SQLmap automates SQL injection testing.
- Install SQLmap:
Code
sudo apt install sqlmapCode
sqlmap -u "http://example.com?id=1" --dbs5. Enhancing the WSL Environment
- Access Windows file system:
Code
cd /mnt/c/- Customize your shell with Zsh:
Code
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"6. Troubleshooting Tips
- Networking Issues: Restart WSL network interface:
Code
wsl --shutdown
wsl- External Wi-Fi Adapters: Use USB adapters for tools like Aircrack-ng with Hyper-V.
7. Best Practices
- Use tools only with explicit permission.
- Regularly update WSL, Kali Linux, and tools.
- Keep logs for auditing during penetration testing.
With these examples, you can use Kali Linux tools through WSL effectively and ethically!

