Skip to content

Instantly share code, notes, and snippets.

@jmingov
Forked from binkybear/NETHUNTEROS.MD
Created November 26, 2016 17:10
Show Gist options
  • Save jmingov/4fd6d02ae75cdedd62144623725ef6e6 to your computer and use it in GitHub Desktop.
Save jmingov/4fd6d02ae75cdedd62144623725ef6e6 to your computer and use it in GitHub Desktop.
Nethunter ROM on Nexus 5 (testing only)

Nethunter OS on Nexus 5

Here are instructions to install Nethunter (as a ROM) with working native monitor mode in the chroot using Nexmon. The ROM is a modified CM 14.1 (nougat) base with custom kernel which supports: HID, Drivedroid, Kexec, and external wireless.

What you need

You will need the following 3 items (maybe 4):

SHA512 for Nethunter: 1253c8fb6c0844c31ae8393313ce03f3087db195446e7a17d430985da7eaf6defca89b134c68c5bcb2e3ea7a6dc54ca60b44ed1f941de12ecaed55328a8def38

SHA512 for kalifs is updated and should match https://images.offensive-security.com/version.txt or version.txt on github https://github.com/offensive-security/kali-nethunter/blob/master/version.txt

(If you get an error then possibly latest radio image): http://www.mediafire.com/file/ld8vvfj774sx6xy/NEXUS5_M4B30X_RADIO.zip

How to unlock device & flash recovery

Have you flashed Cyanogenmod before? If you can flash CM or a ROM its exactly the same way.

There is the easy way:using the Nexus Root Toolkit

There is the harder way:

  1. Download ADB and fastboot (depends on OS/distro)
  2. Put phone into fastboot by holding down vol down + power
  3. Warning this will wipe device In terminal on computer: fastboot oem unlock && fastboot reboot
  4. Reboot back into fastboot
  5. In terminal on computer: fastboot flash recovery [name of downloaded TWRP image]
  6. Now boot into recovery by either using menu in fastboot or holding volume up + power.

Flashing in TWRP

If you have made into recovery you will want to copy the NethunterOS zip file to your device and maybe also the radio zip file.

  • Always make a backup of a working OS under the backup tab. Select system/data/boot
  • Wipe any previous ROMs by going to wipe tab. Select Advanced Wipe & system/data/cache
  • Finaly go to install button and select NethunterOS zip file.

Setting Up

Reboot your device. When it starts up the first time it will reboot once, don't be nervours.

After your device loads go through the normal CM set up. Copy the kalifs-full.tar.xz from your computer to your device. Then:

  1. Go to the Nethunter app
  2. Go to "Kali Chroot Manger" after accepting permissions. If previous Chroot was found click "Remove Chroot" first.
  3. Click on "Install Chroot" > Use SDCARD > Use Full
  4. Exit out of app and run Nethunter terminal app and launch into Kali terminal

Nexus 5 monitor mode specifics

There is a specific binary file for loading mointior mode inside chroot. To run it inside Kali terminal:

source monstart-nh

To stop run:

source monstop-nh

Since we are using LD_PRELOAD the monitor mode is essentialy tied to the terminal window. So if you open a new window make sure you rerun script.

The technical explanation is we need to set LD_PRELOAD to our ioctl intercept that was compiled inside chroot. When the chroot is run we have to unset LD_PRELOAD and we are essentially telling the terminal to run LD_PRELOAD before each command.

It's a simple bash script and you can view it in /system/xbin/monstart-nh

Updating ROM

If new versions come out you can flash ROM without having to go through most of the early steps. You can just go straight into recovery and install the zip file over ROM.

Todo

Here are things that need to be done for Nethunter OS:

  • Add extra apks to Nethunter OS (drivedroid etc)
  • Add a native updater
  • Fix wallpaper offset

Sources

Source files can be found @:

https://github.com/nethunteros

Kernel Source

Device Source

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