Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iAmMrGrim/3605eb6aec6f2eb812dca20e77b535eb to your computer and use it in GitHub Desktop.
Save iAmMrGrim/3605eb6aec6f2eb812dca20e77b535eb to your computer and use it in GitHub Desktop.
This Guide will help you install Kali Linux in Android, that too with a GUI Desktop Environment within Android. It uses Termux to run Kali Linux in Android with XFCE4 Desktop Environment and a Tight VNC Server, which we connect to using a VNC Viewer app in Android.

How to install Kali Linux GUI Desktop in Android using Termux:

This Guide will help you install Kali Linux in Android, that too with a GUI Desktop Environment within Android. It uses Termux to run Kali Linux in Android with XFCE4 Desktop Environment and a Tight VNC Server, which we connect to using a VNC Viewer app in Android.

Just Follow these steps to install Kali Linux with XFCE4 Desktop GUI in Android using Termux:

  • Download and install Termux in Android. (Play Store release is no more updated, so is not recommended.)

  • Open Termux and run the following commands:

    apt update && apt install python python2 openssh -y
    pkg install wget openssl-tool proot -y && hash -r && wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/Installer/Kali/kali.sh && bash kali.sh
    ./start-kali.sh
    
  • After completion of the above steps, you will be in Kali Linux Shell. Run the following commands in the Kali Shell:

    wget https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Scripts/DesktopEnvironment/Apt/Xfce4/de-apt-xfce4.sh && bash de-apt-xfce4.sh
    vncserver
    
  • When it asks, Create and confirm a new password and remember it. You will need it to login in later steps.

  • After setting the password, run the following command:

    vncserver -kill :1
    rm -f ~/.vnc/xstartup
    echo -e '#!/bin/bash\nxrdb \$HOME/.Xresources\nstartxfce4 &' > ~/.vnc/xstartup
    sudo chmod +x ~/.vnc/xstartup
    vncserver
    
  • Let Termux run in background by pressing HOME button in Android.

  • Install VNC Viewer in Android and open it.

  • In VNC Viewer, press the + button in the lower right corner.

    • Under Address type localhost:5901.
    • Under Name type any name that you want to show in the app.
    • Press Create. An Entry by the name you entered will appear.
  • Press the entry you just created in VNC Viewer.

  • Type in the password that you created in a previous step (Turn on the Remember password slider if preffered) and press continue in the upper right corner.

  • You will soon be in your Kali Linux XFCE4 Desktop Environment.

How to stop the session:

Once you have done working(hacking) using Kali-Linux, follow these steps to stop the session:

  • Swipe down from the top of the VNC Viewer app and tap the cross (X) icon.
  • Tap Disconnect when it asks you about being sure to disconect.
  • Now close the VNC Viewer app.
  • Then open Termux that was running in background.
  • To kill the VNC Server in Kali and exit from Kali, run the following commands:
    vncserver -kill:1
    exit
    
  • To exit from Termux, type exit and press Enter.

How to start a new session:

To start a new session if the installation part is already done, follow the following steps:

  • Open Termux and run the command, vncviewer.
  • Let Termux run in background by pressing HOME button in Android.
  • Open VNC Viewer and press the entry that you created during installation.
  • Type in the password created during installation (Turn on the Remember password slider if preferred) and press continue in the upper right corner.
  • You will soon be in your Kali Linux XFCE4 Desktop Environment.
  • Click here to see how to stop the session.
@iAmMrGrim
Copy link
Author

this for sure was easy to set up vnc and make it run. with the actual interface.

NOW....the source
this is any of the extra information from the source..and not all is useful...

https://www.kali.org/docs/nethunter/nethunter-rootless/#nethunter-rootless-edition

kali@kali:$ termux-setup-storage
kali@kali:
$ pkg install wget
kali@kali:$ wget -O install-nethunter-termux https://offs.ec/2MceZWr
kali@kali:
$ chmod +x install-nethunter-termux
kali@kali:~$ ./install-nethunter-termux

(next section does not work as advertised)

Command To
nethunter start Kali NetHunter command line interface
nethunter kex passwd configure the KeX password (only needed before 1st use)
nethunter kex & start Kali NetHunter Desktop Experience user sessions
nethunter kex stop stop Kali NetHunter Desktop Experience
nethunter run in NetHunter environment
nethunter -r start Kali NetHunter cli as root
nethunter -r kex passwd configure the KeX password for root
nethunter -r kex & start Kali NetHunter Desktop Experience as root
nethunter -r kex stop stop Kali NetHunter Desktop Experience root sessions
nethunter -r kex kill Kill all KeX sessions
nethunter -r run in NetHunter environment as root

Note: The command nethunter can be abbreviated to nh. Tip: If you run kex in the background (&) without having set a password, bring it back to the foreground first when prompted to enter the password, i.e. via fg - you can later send it to the background again via Ctrl + z and bg

To use KeX, start the KeX client, enter your password and click connect Tip: For a better viewing experience, enter a custom resolution under “Advanced Settings” in the KeX Client

Tips:

Run sudo apt update && sudo apt full-upgrade -y first thing after installation to [update Kali](https://www.kali.org/docs/general-use/updating-kali/). If you have plenty of storage space available you might want to run sudo apt install -y kali-linux-default as well.
All of the penetration testing tools should work but some might have restrictions, e.g. metasploit works but doesn’t have database support. If you discover any tools that don’t work, please post it in our [forums](https://forums.kali.org/forumdisplay.php?14-NetHunter-Forums).
Some utilities like “top” won’t run on unrooted phones.
Non-root users still have root access in the chroot. That’s a proot thing. Just be aware of that.
Galaxy phone’s may prevent non-root users from using sudo. Just use “su -c” instead.
Perform regular backups of your rootfs by stopping all nethunter sessions and typing the following in a termux session: tar -cJf kali-arm64.tar.xz kali-arm64 && mv kali-arm64.tar.xz storage/downloads That will put the backup in your Android download folder. Note: on older devices, change “arm64” to “armhf”
Please join us in our [forums](https://forums.kali.org/forumdisplay.php?14-NetHunter-Forums) to exchange tips and ideas and be part of a community that strives to make NetHunter even better.

Updated on: 2022-Aug-28
Author: re4son

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment