Connect to Kali NetHunter VNC Server From Local Network
Congrats, you figured out how to install Kali NetHunter on your phone. Now, you want to connect to it from your PC on the same network?
How NetHunter's kex
VNC Script Works
The KeX program that comes with NetHunter is actually just a bash script.
kex
is actually just some simple wrapping around Xtigervnc.
Try running it once, then kill it:
which kex # Shows us the location of kex, for me, that's /usr/bin/kex
cat /usr/bin/kex # Let's look inside
kex # Lets run it once, it'll make us set a password on the first run
killall Xtigervnc # End the vnc service. If you see nothing, it worked
Run a VNC Server Open to Your Local Network
Copy this one important line from that file:
(This might be different on your phone – make sure to copy it from wherever which kex
is!)
export HOME=${HOME}; export USER=${USR}; LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver $SCREEN
The important part, we're going to paste it into our terminal, but modify it by adding -localhost no
to the end.
tl;dr, The Command You Want to Run:
export HOME=${HOME}; export USER=${USR}; LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgcc_s.so.1 vncserver $SCREEN -localhost no
Troubleshooting
- Got an error about passwords? Do
vncpasswd
and set it to something, then try this command again - Got an error about a file not found? Make sure you're in the kali shell by running
nethunter
first - Something else? Try re-reading this guide carefully, try the steps in order, and google an error if you run into one