Please follow this tutorial for educational purposes and at your own risk. This is something i did on my personal device and decided to share my experience on the blog. It may or may not work on your device but you follow the general guidelines.
Nethunter distribution is available as zip and can be downloaded from the official page. The goal is to be able to flash this zip file on to your device.
In Order to do this, we need to follow the steps given below:
- Unlock bootloader of android device
- Install a custom recovery mode on the device. TWRP is preferred for nethunter.
- Flash Magisk and in some cases Disable dm-verity and encryption.
- Finally flash nethunter zip file. You can update the application once installed to match up the android version. In my case i was running Pixel 2 XL with Android 11. So i flashed Nexus 6P oreo and later updated the application using nethunter app store.
Each of the 4 stages are explained in more detail below:
STEP 1: Unlocking bootloader
You need to install Google USB driver, ADB and fastboot on a laptop in order to unlock bootloader. Best way to setup this is to use android studio SDK manager and setup the necessary tools needed. The adb and fastboot are exe file which will be in default android sdk location. You can launch a terminal and switch to the directory where adb and fastboot exe are located.
Now you need to make sure you have Android Developer Mode, OEM unlock, USB Debugging enabled on the phone. Connect your phone to laptop using a good quality USB cable (yes it does matter in some cases). And run the commands as shown below:
#Check version should be same if you have used sdk manager
#Check version to ensure the tools are running
adb --version
fastboot --version#Check if your device is showing up. If not you need to make sure #you have proper Google USB driver installed and Device manager #should not show any warning. If everything is alright you can see #android device in device manager without any warning
adb devices#To switch to bootloader mode use this command. You can #alternatively use pwr+vol_down, but i prefer using adb.
adb reboot bootloader #Once bootloader has started run the command below to make sure #fastboot command can detect your device.
fastboot devices#Now you can unlock your bootloader
fastboot flashing unlock
STEP 2: Install Custom Recovery TWRP and flash necessary files
Download latest zip and img file for the TWRP files
Download Magisk latest apk file from link and change the extension to .zip
Download DM-Verity, Force Encryption and Disk Quota Disabler from link. This was needed for Pixel phone running android 9, 10 or 11. You may or may need this. You can check the notes column on the nethunter page. This has to be done before installing Nethunter as it may fail while setting up kali file system.
Any other mods can be downloaded and copied to the Phones Internal Storage.
Now to launch the recovery mode for the first time we will use .img file. No need to copy this file. We will run it once and then install the Recovery App from Zip. For running the TRWP img file see the command below:
Your mobile should reboot and go into recovery mode and it looks some like screenshot shown below:
Click INSTALL > Select all the zip files > Reboot > System
For this stage you can refer the video.
You may need to input your security PIN that you would normally use to unlock your phone.
Now using this recovery module you can flash any zip files for any mods. You need to flash magisk and update it. Then use Magisk to install nethunter
Now you can goto magisk. Magisk is a app store/app manager for apps that need root access. You can search for nethunter zip file on phone internal storage and let magisk install it. You can see 3 icons installed. Use Nethunter App Store to update the nethunter binaries. Now you can open nethunter app and run CHROOT which will complete the setup
Found this video helpful at this stage.
References:
https://developer.android.com/studio/run/win-usb
https://highonandroid.com/android-smartphones/how-to-root-android-p9-0-pixelpixel-xlpixel-2pixel-2xl/ (the files are a bit outdated)