Hello, this is c477us. Now, what method do you use when you want to run Kali Linux? Many people will use virtual environments such as Virtual Box and VMware. In fact, it's perfect if you want to do penetration testing in a virtual environment. However, there may not be much need to build a virtual environment, such as when performing a penetration test on an external server such as HackTheBox. In that case, there is a way to install Kali Linux ** directly ** on Windows. This time, I will introduce the detailed procedure.
** The method introduced below is not a virtual environment. Since it is mounted directly on the C drive, mistakes on WSL may extend to the host side. Therefore, if you are not familiar with Linux, we strongly recommend that you first get used to it in a virtual environment. ** **
Let's actually introduce it. First, we will introduce WSL (Windows Subsystem for Linux), but before that, we will explain a little about WSL.
In Linux such as Kali, ** ELF (Executable and Linkable Format) ** is used as the file format. However, Windows does not support this format by default and cannot execute binary data in ELF format, for example.
WSL was developed there. This aims to be able to handle ELF format data without using a virtual environment, and WSL2 announced in June 2019 has achieved considerable compatibility by using the Linux kernel. -> About WSL2
Use PowerShell to deploy WSL.
First, enter ** windows powershell ** in the search bar at the bottom left, and when Windows PowerShell appears in the suggestions field, press ** [Run as administrator] **. If you can start PowerShell with administrator privileges, enter the following command. ** (Note: You will be prompted to reboot when complete) **
PowerShell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
After rebooting, enter the command below. ** (Reboot again) **
PowerShell
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
After rebooting again, fix the WSL version to the current (2021-01) latest 2.
PowerShell
wsl --set-default-version 2
This completes the introduction of WSL.
Kali Linux is distributed in the Microsoft Store. Search for Kali Linux ** at the URL below or at the ** Microsoft Store and install it.
Kali Linux https://www.microsoft.com/ja-jp/p/kali-linux/9pkr34tncv07
Now you have Kali installed. The command line is displayed when you start it like a general Windows application. This is Kali Linux.
~~ Kali itself is now installed, but if you are not familiar with CUI, let's make it work with GUI. ~~
** Addendum (2020-01-14): Kali Desktop Experience For Windows seems to be able to operate GUI without RDP. Add to the end of this item. ** **
First, the operation on the Kali side.
Kali
sudo apt update
sudo apt upgrade -y
sudo apt install kali-desktop-xfce -y
A screen for selecting the keyboard layout will be displayed, so select it according to your environment. Next, install and run xrdp to set up an RDP server.
kali
sudo apt install xrdp -y
sudo service xrdp start
Also, find out the local IP address on the Kali side.
kali
ip add //ifconfig is OK
Enter ** remote ** in the search field on the Windows side to run the application ** Remote Desktop Connection **. Enter Kali's IP to connect and log in to display the GUI.
It seems that there are many reports of errors in dbus-launch: no such files or directory, so I will also describe how to deal with it.
dbus_error
sudo service xrdp stop
sudo apt install dbus-x11
sudo service xrdp start
Kali
sudo apt install kali-win-kex -y
kex
You can operate the GUI with just this. -> Detailed explanation
When installing tools on Kali Linux installed in this way, Defender may play you. Please refer to this video when it is played.
Also, if you inadvertently damage Kali, please watch this video (https://vimeo.com/258835347) to recover.
Actually, I happened to know that Windows can handle Linux by itself, so I wrote an article. In addition, Ubuntu, openSUSE, etc. will work on WSL. If you have any questions about the article, please contact me on Twitter (@ c477us).
Kali Linux https://www.kali.org/
Windows Subsystem of Linux https://docs.microsoft.com/en-us/windows/wsl/
** References ** Kali Linux: Kali Linux in the Windows App Store https://www.kali.org/news/kali-linux-in-the-windows-app-store/
Kali Linux: Win-KeX https://www.kali.org/docs/wsl/win-kex/
NetworkChuck: Kali Linux on Windows in 5min (WSL 2 GUI) https://www.youtube.com/watch?v=AfVH54edAHU NetworkChuck: new Kali Linux GUI on Windows 10 (WSL 2) // 2020.3 Release https://www.youtube.com/watch?v=dgdOILL1184
Window Forest: "Windows 10 20H1" Build 18917 with "WSL 2" in the "Fast" ring https://forest.watch.impress.co.jp/docs/news/1190081.html
Wikipedia: Windows Subsystem for Linux https://ja.wikipedia.org/wiki/Windows_Subsystem_for_Linux#cite_note-15 Wikipedia: Executable and Linkable Format https://ja.wikipedia.org/wiki/Executable_and_Linkable_Format
Recommended Posts