WSL 2 + Kali : The EASY Way - Pentestmag

WSL 2 + Kali : The EASY Way

WSL 2 + Kali : The EASY Way

by Ash Noor, aka [ ryn0f1sh ]


Hello Friends,
One of my fellow hackers introduced me to Windows Subsystem for Linux, or WSL for short, and I have to say, this has been a game changer. In a nutshell, this allows you to run Linux commands from your CLI Terminal, without having to start a Linux Virtual Machine. What!!?

It was actually made by Microsoft themselves, so it is a legit product, which makes a lot of difference when trying to do things that are cross-platform like this. I’ll walk you through the steps that I KNOW work, because I’ve tried a few things, and after chatting with some of my friends, these steps gave us the results without the crazy hurdles. Let's go.

// Setting Up The Environment.

On your Windows 10 machine do the following:
Open Powershell as an Administrator. (If you Right Click on Powershell, you should see that option).

Run these two commands, individually of course:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

We also need to make sure that we are set to WSL 2, so run this command:

wsl --set-default-version 2

NOTE:
If your computer is a fresh install, or you have not used WSL before, you may need to install it first by running this command:

wsl --install

// Installing Kali

NOTE:
I know that you can find Powershell commands to install it from the terminal, but when I tried that, for some reason, the install was looking at the wrong Kali repository and I couldn’t install updates or anything, so do that at your own risk.

1. Go the Microsoft App store. (If you click your Windows search bar and type ‘store’ it will come up.)
2. Search for “Kali”.
3. Install it.
4. Launch it.
Go through the set up.

The Kali Linux App in the Microsoft App Store.

NOTE:
After its installed, you will need to set up your root password for Kali.
Should look something like this.

sudo passwd root
New password: # Enter a root password
Re-type password: # Re-type your root password

// Installing the Kali Security Tools

First things first.
Run: sudo apt-get update && sudo apt-get upgrade -y

This will make sure that your Kali is up to date, and more importantly, it will make sure that any dependencies are installed, otherwise you may get an error when the “install everything” command.

After some research, it turned out (as of the writing of this post) the command to install all the tools has changed, it is no longer kali-linux-all. This is the new command:

apt-get install kali-linux-everything

This will take a LONG time, I’m talking 40 minutes or more, so make sure you have another project to work on while this finishes. But once its done, your Pen Testing game will be on a whole NEW level.

BONUS:
For added Geekness, also install Microsoft’s “Terminal”. This will actually allow you to open up multiple tabs of different CLIs. i.e. One tab can be “Powershell”, another tab can be the “Kali”, so on and so forth! SUPER helpful.

The Windows Terminal App in the Microsoft App Store.

// Conclusion

There you go.
This has been a HUGE help in my Pen Testing journey, no longer do I have to start a Kali or Parrot OS VM to do my testing, and have to deal with moving files back and forth between the VM and the host machine, this just streamlined the whole thing.

Also, if you did the BONUS install of the Windows Terminal, you can actually set Kali to be the default window in the Settings area, so any time I open up terminal BAM! my Kali terminal is up and I’m ready to start typing in commands right away.

I hope that was helpful.
Go (ethically) Hack The Planet.
[R/F]


Originally published at: https://ryn0f1sh.medium.com/wsl-2-kali-the-easy-way-1c4b23f4bfe0

November 10, 2022
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments

© HAKIN9 MEDIA SP. Z O.O. SP. K. 2013