PDA

View Full Version : NetHunter OnePlus 7 Pro Mclaren All you need to Root w/compiled kernel wifi modules



Xpltr
2022-05-19, 19:36
The OnePlus 7 Pro Mclaren EU HD1913 edition is perfect for Nethunter and PenTesters, 256GB storage, 12GB RAM, 2 sim cards, 48MP camera, etc.

Here is everything you need to get a fully functional Nethunter Mclaren, with all wifi modules compiled in the kernel for external wifi cards.

If you just need a kernel compiled with external wifi & usb modules, you can download the .tar file & use just the kernel. Flash it in TWRP per install button.

The Nethunter Kernel included in the .tar file is for Android OS 10 & will work on the OnePlus 7 Pro, OP 7 Pro Mclaren & OP 7T.

Packet wifi injection works also, but be sure you download these drivers after kernel install & reboot:

apt install realtek-rtl88xxau-dkms, realtek-rtl8188eus-dkms, realtek-rtl8814au-dkms.


Some say you must get an "unlock token" from oneplus to unlock bootloader on the Mclaren, BUT I did not have this issue, it was straight without any token.


Here is the Nethunter bundle download link: This one contains all files except MSM tool.

The MSM link is after & contains a stock Android 10 os. The MSM download may be needed if your current OP 7 phone does not have the Android 10 OS.

This may work with Android 11, 12, etc, but haven't tried it yet. If you have Android 10 already then MSM download is not needed unless you brick the phone.

NOTE: Some of the files may have been compressed with "xz".

You must decompress them first, then use the "zip" version of the file for the installation instructions.

THE ONLY FILE TO NOT DECOMPRESS is the Kalifs-arm64-full.tar.xz. You will use the whole file as is, with the "xz" to install the kali chroot.

To decompress these "xz" files do this command:

xz -d name_of_file.zip.xz

https://www.mediafire.com/file/sxx36mc860131an/Mclaren_Nethunter.tar

To open: tar -xvf Mclaren_Nethunter.tar

The files are:

1. TWRP -> for the EU version

2. Dm-verity -> disable Dm-verity encryption.

3. System_rwBundle zip -> Make read/write System, Product, Vendor.

4. NetHunter Kernel -> Compiled with all the wifi modules for external wifi cards, Alfa cards.

5. Magisk -> Root manager

6. Nethunter Apps -> Nethunter GUI, Terminal, Kex-client, Store.

7. MSM download tool -> In case you brick your phone, restore it thru MSM. This needs a windows computer tho.


The following download is the MSM tool with the stock Android 10 version. In case you brick the phone, this will reset it.

https://www.mediafire.com/file/mzi0b5am6pc8r7k/MSM_Oneplus7_AndroidOS_10.0.13.zip

You must boot into TWRP or EDL to reinstall the Oxygen Os:


On windows computer, transfer & extract the MSM tool.

Right click on MSM tool, click "run as administrator" it'll open up the dialog.

In upper left, choose EU version then set your cursor over the "start" button

Have a usb cable connected to the Windows machine ready to connect the Mclaren

On Mclaren, in TWRP mode, choose Reboot option, then click EDL

Plug phone in immediately to Windows, it'l recognize it, click Start

The phone will then reinstall the OS, & wipe it clean. Then you must repeat all the steps to reinstall TWRP, Nethunter, Magisk, etc.




Starting on the OnePlus Mclaren:

1. Settings -> About Phone:

a....tap "Build Number" 7 times to enable "Developer Mode".


2. Settings -> System -> Developer Options:

a.Turn on "OEM unlocking", "USB debugging" & turn off "Automatic system Updates"

b. Scroll to "Default USB configuration", select "File Transfer"

c. You can also turn off "Verify apps over USB"


3. Once those are set, plug in phone to Kali Linux computer, "allow usb debugging"


a. In command line, type without quotes "adb reboot bootloader"

b. This will put phone in "Fastboot mode", then in fastboot mode..

c. Type "fastboot flashing unlock"

d. Agree to unlock the bootloader, phone WIPES YOUR DATA then reboots.


4. Go thru motions to set up phone, then REPEAT steps 1 & 2.


5. Now, we are gonna boot into TWRP to install it.


6. Plug phone back into Kali, type again "adb reboot bootloader"


7. This will put you in "Fastboot mode" again:


a. Make sure you're in the TWRP directory on Linux: Type "fastboot boot twrp.img" //This boots the image to the Mclaren

b. Now push the "twrp.zip" onto the Mclaren: Type "adb push twrp.zip sdcard/"

c. In TWRP app, go to install, choose "twrp.zip", install.

d. IMPORTANT!!!! AFTER TWRP INSTALL, BOOT BACK INTO RECOVERY not into system.

e. TWRP is installed, now you can boot into system


8. Next, power off phone, boot into TRWP recovery by holding volume down & power key till you see TRWP logo.


9. Plug phone into Kali laptop, push Disable-DM-verity to phone.


adb push Disable_Dm-Verity_ForceEncrypt_11.02.2020.zip /sdcard/

In TWRP, choose install Disable-Dm-verity.

Reboot into system.


10. Next, we make the "vendor, product & system" directories writable. You need this bcuz by default they are read only"


a. Using ADB in Kali, "adb push systemrw_1.32_BUNDLE_proper.zip onto the Mclaren to /data/local/tmp directory, then reboot into TWRP.

b. In TWRP, choose "Advanced->Terminal" navigate to /data/local/tmp

c. Unzip the bundle, then -> unzip systemrw_1.32_flashable.zip -> cd to the systemrw_1.32 dir

d. Make file executable: type "chmod +x systemrw.sh"

e. You can specify a size for each directory, the programs op says 15mb is good, but I chose 150MB which works.

Type " ./systemrw.sh size=150 "

f. This will automatically make all the directories read/write... Make sure you got battery on your phone

g. Reboot into system


11. Now we'll install the Nethunter Kernel. It has the wifi modules already compiled.


a. Be in TWRP recovery mode:

b. From Kali, push the kernel onto Mclaren: -> adb push anykernel-NetHunter.zip /sdcard/

c. Click install & install the zip, then reboot to system.

d. Go to Settings->About Phone->Android Version to check the Nethunter kernel install


12. Next, reboot into TRWP to install Magisk


a. From Kali, push Magisk to Mclaren: "adb push Magisk-v23.0.zip /sdcard/

b. Install Magisk.

c. After Magisk is installed, still in TWRP, go to "Wipe" -> Format Data -> type "yes", then reboot into system.


13. At this point, you'll need to set up the phone again. I refuse all the analytics, & unset all the Google options in the phone.


a. Important!! BEFORE YOU CONNECT TO WIFI to update Magisk, you have to disable "Automatic Updates" on the Mclaren.

I also disable "Find my Device" & all of the Google features including Google Play Scanner.

b. Settings -> System -> System Updates -> Uncheck the "Automatic Updates over wifi" button.

c. Repeat steps 1 & 2 again, especially uncheck the "automatic updates" in "developer options"

d. Turn off "Find my Device" -> Settings -> Google -> Find my Device check to off

e. In Settings, search for Google play, Turn off Google play scan.

f. I turn off all the Google features in Settings->Google. Its all spyware ****


14. Once that is done, connect to wifi, and click Magisk app to update. It'll update the app, then in Magisk, click Install-> Direct Install -> Reboot.


15. Now you have Magisk ready, & can install Nethunter.


a. From Kali, push "update-nethunter" file to Mclaren in system mode, not TWRP.

adb push update-nethunter-20220211_172614-oneplus7-oos-ten.zip /sdcard/

b. Open Magisk->Modules->Install from Storage-> choose "update-nethunter" file, and done.


16. Nethunter & the Nethunter apps will be installed, but you must update Nethunter thru the Nethunter Store first

a. Open Nethunter Store app -> Updates -> Refresh till update appears, Update then reboot.


17. Nethunter is installed but the chroot kali is not.


a. From Kali, push the kalifs-arm64-full.tar.xz onto the Mclaren to the /storage/emulated/0/ directory

adb push kalifs-arm64-full.tar.xz storage/emulated/0/

b. Go to Nethunter GUI -> Kali Chroot Manager -> Install chroot, -> choose to install from backup.

c. IMPORTANT TO NOTICE: The file that shows up IS NOT the one you just pushed so backspace & change the name to "kalifs-arm64-full.tar.xz

d. Click install. Once its done, ready to go.


18. There will be some issues at first, but easy to solve following these instructions. The Nethunter terminal may throw an error for kali term

because of some 'security key' function.


a. Open Nethunter terminal, select "AndroidSU".

b. Type "bootkali_bash" //this will put you into Kali linux shell inside Android shell.

c. To fix the perms, navigate to /etc/pam.d/ & Comment out the following line in each of these files

# session optional pam_keyinit.so force revoke

Files: su-l, login, runuser-l, and sshd. This will solve the Kali terminal issue.


19. Next, lets fix the permissions on the Postgresql directories. Use the following command on all of the directoris


chown -R postgres:postgres postgresql/

Directories: "/var/lib/postgresql", "/etc/postgresql", & "/usr/lib/postgresql" Now postgresql will work.


20. Lets fix the iptables legacy error to have iptables working: In Kali shell type:


update-alternatives --config iptables

Choose the iptables-legacy option

Same for ipv6

update-alternatives --config ip6tables

The android firewalls are complex, check them: iptables -n -v -L

I delete all default android firewalls, up to you. iptables -F; iptables -Z; iptables -X //do same with ipv6


21. IMPORTANT there is a program that uses high CPU usage that has to be disabled immediately. You can use "top" process monitor to check this.

Its the @brain-service. Don't panic, use the command below to stop it.


a. Lets make this command start at boot. Navigate to NetHunter GUI -> Custom Commands -> ADD

Name: whatever, can be "stop_brain".

Command: su -c resetprop ctl.stop oneplus_brain_service

Send to: android

Exec: background

Run on boot: yes


b. That command will bring the cpu down to 2%. There are more program/services to stop, based on not wanting oneplus spy stuff. here are a few. Use the same command above & make it as a startup.

su -c resetprop ctl.stop soter-1-0

su -c resetprop ctl.stop oneplus.engineer-1-0

su -c resetprop ctl.stop opdiagnose


22. There are many programs to uninstall, some are mandatory, others optional. There are numerous lists of bloatware to uninstall, located on the Internet, one link at end of post.

But, think before you uninstall, you may want or still need the package. But the following programs you have to uninstall-> spyware


a. The way to uninstall these is in the AndroidSu shell. Don't use the '-k' flag, bcuz it keeps cache & data of uninstalled pkges.



b. Some commands:

pm list packages // lists pkges. Tack a "-d" to the end to see disabled pkges.

pm disable --user 0 com.package.name //disables the package

pm uninstall --user 0 com.package.name //uninstalls the package

pm clear --user 0 com.package.name //clears data left from package


c. Necessary uninstall:

net.oneplus.odm

net.oneplus.odm.provider

com.oneplus.ses


d. Necessary Disable: // You can disable or uninstall, but must disable to avoid being updated by Oneplus

Command: pm disable --user 0 com.oneplus.backup

com.oneplus.backup

cn.oneplus.nvbackup



23. After all that, you can go to Nethunter GUI, -> chroot Manager -> Add Metapackage


Choose "kali-linux-nethunter" & "kali-linux-default" to update to base installation. After install all you want.



24. Here is a link to remove some bloatware:

https://technastic.com/oneplus-bloatware-list-oxygen-os-debloater/