Kali Linux desktop (xfce) on Windows using WSL2

I highly suggest you to install and use Windows Terminal that works with powershell, powershell core, command prompt, WSL, WSL2, …

Install WSL2 on Windows

  1. Open PowerShell as Administrator and run

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

  2. Now restart and update windows to get WSL2

    • Running Windows 10, updated to version 1903 or higher, Build 18362 or higher for x64 systems.
    • Running Windows 10, updated to version 2004 or higher, build 19041, for ARM64 systems.
    • Please note if you are on Windows 10 version 1903 or 1909 you will need to ensure that you have the proper backport, instructions can be found here.
    • Check your Windows version by selecting the Windows logo key + R, type winver, select OK. (Or enter the ver command in Windows Command Prompt). Please update to the latest Windows version if your build is lower than 18361. Get Windows Update Assistant.

  3. Enable the ‘Virtual Machine Platform’ optional component

    dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

  4. Restart and set WSL2 as your default version

    wsl –set-default-version 2

    If you see a message like WSL 2 requires an update to its kernel component follow this link https://aka.ms/wsl2kernel and install the MSI from that page.

Install Kali Linux

  1. Install Kali Linux from Microsoft Store
    https://www.microsoft.com/it-it/p/kali-linux/9pkr34tncv07?rtc=1
  2. Run Kali Linux from start menu and configure it as requested
  3. Open again Kali Linux and install the desktop using win-kex
    1. sudo apt update && sudo apt full-upgrade -y
    2. sudo apt install kali-win-kex -y
  4. Now run kex and you’re ready to go
    • kex (run a desktop and leave it running until you stop it)
    • kex stop (to stop the current desktop)
    • kex wtstart (to run a desktop connected to a windows terminal tab, when you close the tab the desktop will be killed, when you close the desktop, you can re-open it or kill)
  5. If you want a lot of more tool you can install the large edition of kali
    • sudo apt install kali-linux-large

Move Kali to Different Hard Disk Drive

  1. wsl –terminate kali-linux
  2. wsl –export kali-linux “D:\kali-linux.tar”
  3. wsl –unregister kali-linux
  4. uninstall Kali Linux from start menu, right click, uninstall
  5. wsl –import kali-linux “D:\wsl\kali-linux” “D:\kali-linux.tar”
  6. wsl –set-default kali-linux
  7. open a terminal on kali
    wsl -d kali-linux
  8. restores default user, creating this config file
    sudo nano /etc/wsl.conf
  9. add the username you have configured the first time you installed kali linux before exporting it
    [user]
    default=mdenny
  10. close the terminal
  11. wsl –terminate kali-linux
  12. reopen the terminal

Share Wifi Internet with ethernet port on Raspberry Pi (bridge)

If you want to share your wifi internet connection to a PC that doens’t have a wifi adapter, you can use a raspberry pi and follow these steps:

  1. sudo apt update
  2. sudo apt full-upgrade
  3. sudo apt dist-upgrade
  4. sudo apt install network-manager network-manager-gnome
  5. sudo systemctl stop dhcpcd
  6. sudo systemctl disable dhcpcd
  7. sudo systemctl enable NetworkManager
  8. sudo systemctl start NetworkManager
  9. sudo reboot now
  10. now connect to a wifi network using the new network manager you will find the task bar
    network-manager-icon
  11. edit the ethernet configuration and from the ipv4 settings tab change the method to “Share to other computers”
    network-manager-connections
    network-manager-editing
  12. connect a pc over ethernet port of the raspberry and enjoy the internet connection took from a wifi hotspot

 

Thanks to arer studios.

Change default language on Bash on Ubuntu on Windows

I always forgot how to change the language on ubuntu, my windows knows that I’m Italian even if my operating system is set to be in English, and installs the bash on ubuntu on windows in Italian 😦 so I always need to do these steps:

  1. Install the language pack you want

    sudo apt-get install language-pack-en language-pack-en-base manpages

  2. Change the default language

    sudo update-locale LANG=en_US.UTF8