Run Kali Linux on Windows with GUI (without VirtualBox)

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.

Addendum (2021-01-20): Warning

** 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. ** **

Introduce Kali

Let's actually introduce it. First, we will introduce WSL (Windows Subsystem for Linux), but before that, we will explain a little about WSL.

What is WSL (Windows Subsystem for Linux)?

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

Introduction of WSL

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.

Introduction of Kali

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.

When you also want a GUI

~~ 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.

When throwing a dbus-launch error

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

PS: Use Kali Desktop Experience For Windows

Kali


sudo apt install kali-win-kex -y

kex

You can operate the GUI with just this. -> Detailed explanation

important point

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.

Summary

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

Run Kali Linux on Windows with GUI (without VirtualBox)
Run SwitchBot on Windows 10 with Bleak
Using Kali Linux Gui with WSL2
Run servo with Python on ESP32 (Windows)
Run Keycloak on Amazon Linux 2 without Docker
Run Linux on ARM architecture with QEMU
Organize files on Windows with Linux commands-using WSL-
Linux (WSL) on Windows
Run Jupyter on Ubuntu on Windows
Run Openpose on Python (Windows)
Run python with PyCharm (Windows)
Linux on Windows -1-: debian introduction
Run Amazon Linux 2 in VirtualBox
Run Jupyter Notebook on windows
Run FreeBSD on Linux + qemu
Use Linux on Windows 10 (WSL2)
Blogging with Pelican on Windows
Memo of Linux environment construction using VirtualBox + Vagrant on Windows 10
[Cyberduck] How to exchange files on Linux (CentOS7) started by VirtualBox with mac using GUI
Run MuJoCo on WSL (2) (also GUI)
WSL2 ~ Linux on Windows ~ (Part 1: Introduction)
Run Tensorflow natively supported on windows
Run a Linux server on GCP
[Linux] I installed CentOS on VirtualBox
Create a Linux environment on Windows 10
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
Run XGBoost on Bash on Ubuntu on Windows
Getting started with USD on Windows
[Note] Run Django on Amazon Linux 2
Install PyStan on Windows without Anaconda
Run docker-compose on Amazon Linux2 on ARM64
Getting started with Python 3.8 on Windows
pykintone on Windows Subsystem for Linux
Run cron on Amazon Linux (set on Linux)
Put MeCab binding for Python with pip on Windows, mac and Linux
Run a batch of Python 2.7 with nohup on Amazon Linux AMI on EC2
Create a permanent write area on Kali Linux with USB memory boot
Rock-paper-scissors with Python Let's run on a Windows local server for beginners
Install scipy on Linux without internet connection
Run Radeon GPU on Windows on QEMU / KVM
Install wsl2 and master linux on windows
Use Tabpy with Cloud Run (on GKE)
X86 assembler on Linux (linkage with C)
Django + Apache with mod_wsgi on Windows Server 2016
[C] [python] Read with AquesTalk on Linux
Supports JIS keyboard on Kali Linux ver2020.4
Use without installing python 2.x on Windows
Run bootgen on Debian GNU / Linux, Ubuntu
Install Mecab on Linux (CentOS) with brew
Run py.test on Windows Anaconda and MinGW
Create a Linux virtual machine on Windows
Run (legacy) Windows apps with Windows Application Driver
Run matplotlib on a Windows Docker container
I want to realize something like AutoHotkey with AutoKey on Ubuntu (Kali Linux)
Run Debian (Linux) & LXQt on Athlon 200GE (AMD)
Install and run Python3.5 + NumPy + SciPy on Windows 10
Run django applications on Windows + Apache + mod_wsgi + services.
Put MicroPython on Windows to run ESP32 on Python
Install Windows 10 from a Linux server with PXE
Open a ZIP created on Windows in Linux
Set up golang with goenv on GNU / Linux