Labels

Android (1) bash (2) boost (2) C (34) C++ (2) cheatsheet (2) CLion (6) css (3) Debian (33) DL (17) Docker (1) Dreamweaver (2) Eclipse (3) fail2ban (4) git (5) GitHub (4) Hacking (3) html (8) http (1) iOS (1) iPad (1) IRC (1) Java (30) javascript (3) Linux (164) Mac (19) Machine Learning (1) mySQL (47) Netbeans (4) Networking (1) Nexus (1) OpenVMS (6) Oracle (1) Pandas (3) php (16) Postgresql (8) Python (9) raid (1) RedHat (14) Samba (2) Slackware (45) SQL (14) svn (1) tar (1) ThinkPad (1) Virtualbox (3) Visual Basic (1) Visual Studio (1) Windows (2)

Friday 2 February 2024

Nexus 5

Unlocking, rooting, installing a custom recovery, installing Kali and reverting my Nexus 5 back to stock.

 

1 - Unlocking Bootloader

Download the Android Development Studio, here: https://developer.android.com/studio

Locate the sdk tools, on my mac, they were here: /Users/plisken/library/Android/sdk/platform-tools

Turn the phone off and then boot it into the bootloader/fastboot mode by holding volume down + power. ( I done vol up + vol down + power)

Plug the phone into your computer and then navigate to the platform-tools, then run;

./fastboot devices which should show your device is connected, if not, check cable and you may need drivers (not covered here).

If the device is showing, then do;

./fastboot oem unlock

You then need to confirm on the phone, once complete, do;

./fastboot reboot

This may take some time but phone should boot into Android (eventually).


2 - Installing a Custom Recovery

Download recovery image, I used; https://eu.dl.twrp.me/hammerhead/

and place in the platform-tools directory, rename to recovery.img and run the following;

fastboot flash recovery recovery.img

Note: I'm not so sure it's necessary to rename it to recovery.img, I was just following along to some random YouTube video as I was taking notes for this part. I'm pretty sure you could just use the filename.

If successful, restart bootloader and once the bootloader reloads, scroll to Recovery Mode, this should then launch your new custom recovery.


3 - Rooting

Download Magisk from here: https://github.com/topjohnwu/Magisk?tab=readme-ov-file

and install the apk file, you may need to allow "install from unknown sources" or similar. Once installed, follow instructions. (TBA)


4 - Installing Kali

Download from https://www.kali.org/get-kali/#kali-mobile

Copy onto phone and reboot into recovery, then install the downloaded image.

The first time I done this, it failed saying there was not enough memnory on system, I tried it a second time and it completed ok. Or so I thought. I then found that I had no wifi on the phone, which may or may not have been down to the flashing process as this particular headset previously had an issue with no wifi, but was repaired or replaced back in 2015 after which it sat in my desk drawer unused.


5 - Reverting to stock

Following instructions from here

Download thee image here (TBA)

Unzip and copy directory over to the platform-tools directory.

Run the following (assuming that the files are in the ;

./fastboot flash bootloader hammerhead-m4b30z/bootloader-hammerhead-hhz20h.img

./fastboot reboot-bootloader

./fastboot flash radio hammerhead-m4b30z/radio-hammerhead-m8974a-2.0.50.2.30.img

./fastboot reboot-bootloader

./fastboot -w update hammerhead-m4b30z/image-hammerhead-m4b30z.zip

The above seems to finish with a Segmentation fault, but also seems to have fixed the wifi.


2nd attempt at installing Kali

A - Repeat stage 2 from above.

B - Get the boot.img file from the stock image (step 5 above) and copy it onto phone. Install Magisk as per step 3 from above. This time however choose the boot.img file to patch.

C - Once complete, boot into recovery and locate the boot.img file (/sdcard/Downloads or similar) and rename it to boot-old.img.

D - Then choose to Install an Image and choose the newly created file from step B

E - Once complete, reboot and open Magisk where I was instructed to reboot one more time to complete.

F - With Kali zip on my device as per 4 above, I flashed but again got an error that there was not enough space of /system

TBC

https://assume-breach.medium.com/home-grown-red-team-installing-nethunter-on-a-nexus-5-like-its-2013-29c0951eba0











No comments:

Post a Comment

Note: only a member of this blog may post a comment.