Commit 1ef10599 authored by William Swango's avatar William Swango

H932 love

parent 109ab1b7
Pipeline #30235720 failed with stages
in 1 minute and 32 seconds
......@@ -56,8 +56,8 @@ def find_partition(diskinfo, query):
@contextmanager
def laf_open_disk(comm):
# Open whole disk in read/write mode
open_cmd = lglaf.make_request(b'OPEN', body=b'\0')
#open_cmd = lglaf.make_request(b'OPEN', body=b'\x2f\x64\x65\x76\x2f\x62\x6c\x6f\x63\x6b\x2f\x73\x64\x65\x00\x06\xfb\x0f\x00\x00\x30\xb0\x9d\x06\x42\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x30\xb0\x9d\x06\x00\x00\x00\x00\xdd\x60\x1a\x10\x48\x52\x9f\x06\xd8\x4f\x9d\x06\x06\x00\x00\x00\x00\x00\x00\x00\x58\x52\x9f\x06\x00\x00\x00\x00\x0c\x00\x06\x00\x04\x00\x00\x00\x60\xea\xff\x03\xeb\x27\x00\x10\xdc\xea\xff\x03\x30\xb0\x9d\x06\x64\xea\xff\x03\x41\x76\x1a\x10\x00\x00\x61\x06\x00\x00\x00\x00\x30\xb0\x9d\x06\xc0\xea\xff\x03\xbe\xe4\x09\x10\x30\xb0\x9d\x06\xb6\xd9\xee\xd8\x48\x00\x00\x00\xbc\x52\xa7\x06\xdb\xe4\x09\x10\x30\xb0\x9d\x06\x30\xc0\x9d\x06\x30\xc0\x9d\x06\x00\x00\x00\x00\xdc\xea\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x00\x00\xb6\xd9\xee\xd8\xfc\xea\xff\x03\xf0\x9a\x1d\x10\x48\x00\x00\x00\x10\x00\x00\x00\x08\xeb\xff\x03\x7b\x8c\x03\x10\x10\x00\x00\x00\x8a\x8c\x03\x10\x7e\xd8\xee\xd8\xba\x8c\x03\x10\x00\x6f\x6f\x74\x00\xd9\xee\xd8\xa0\xe8\xff\x03\x9c\xec\xff\x03\x02\x00\x02\x00\xb6\x81\x00\x00\x00\x00\xb6\x01\x00\x00\x00\x00\x00\x00\x00\x00\0')
#open_cmd = lglaf.make_request(b'OPEN', body=b'\0')
open_cmd = lglaf.make_request(b'OPEN', body=b'\x2f\x64\x65\x76\x2f\x62\x6c\x6f\x63\x6b\x2f\x73\x64\x65\x00\x06\xfb\x0f\x00\x00\x30\xb0\x9d\x06\x42\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x30\xb0\x9d\x06\x00\x00\x00\x00\xdd\x60\x1a\x10\x48\x52\x9f\x06\xd8\x4f\x9d\x06\x06\x00\x00\x00\x00\x00\x00\x00\x58\x52\x9f\x06\x00\x00\x00\x00\x0c\x00\x06\x00\x04\x00\x00\x00\x60\xea\xff\x03\xeb\x27\x00\x10\xdc\xea\xff\x03\x30\xb0\x9d\x06\x64\xea\xff\x03\x41\x76\x1a\x10\x00\x00\x61\x06\x00\x00\x00\x00\x30\xb0\x9d\x06\xc0\xea\xff\x03\xbe\xe4\x09\x10\x30\xb0\x9d\x06\xb6\xd9\xee\xd8\x48\x00\x00\x00\xbc\x52\xa7\x06\xdb\xe4\x09\x10\x30\xb0\x9d\x06\x30\xc0\x9d\x06\x30\xc0\x9d\x06\x00\x00\x00\x00\xdc\xea\xff\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0f\x00\x00\x00\x00\x00\x00\x00\xb6\xd9\xee\xd8\xfc\xea\xff\x03\xf0\x9a\x1d\x10\x48\x00\x00\x00\x10\x00\x00\x00\x08\xeb\xff\x03\x7b\x8c\x03\x10\x10\x00\x00\x00\x8a\x8c\x03\x10\x7e\xd8\xee\xd8\xba\x8c\x03\x10\x00\x6f\x6f\x74\x00\xd9\xee\xd8\xa0\xe8\xff\x03\x9c\xec\xff\x03\x02\x00\x02\x00\xb6\x81\x00\x00\x00\x00\xb6\x01\x00\x00\x00\x00\x00\x00\x00\x00\0')
if comm.protocol_version >= 0x1000004 or comm.CR_NEEDED == 1:
lglaf.challenge_response(comm, 2)
open_header = comm.call(open_cmd)[0]
......
#!/bin/bash
# Cheesy wrapper script to help n00bs till I can finish lglaf
clear
echo "This will install TWRP."
echo
echo "You do NOT need to do ANYTHING!"
echo
echo "If it fails, NO damage is done to your phone."
echo
echo "If the hash check fails, it will make ${RETRIES} attempts."
echo
echo "If after ${RETRIES} attempts, it does not get a hash match, it will abort."
echo
echo "NO damage has been done to your phone."
echo
echo "You can re-run this script as many times as you want, however,"
echo "if you are not getting a hash match, you should try a different PC,"
echo "or a different cable, or a different USB port."
read -n1 -r -p "Press SPACE to continue..." KEY
if [ "$KEY" = '' ]; then
echo "Flashing... this will take a while."
else
echo "Exiting"
exit
fi
# This is for the H872 -- DO NOT MODIFY, and DO NOT run this on any other model
SRC_OFFSET=12294
DST_OFFSET=6
TWRP="h872-twrp.img"
TWRPTMP="h872-twrp-tmp.img"
TWRPTEST="test.img"
SIZE=$(stat -c%s $TWRP)
echo "Size of TWRP: "$SIZE
BS=1024
COUNT=$((SIZE / BS))
echo "Count for the dd trim: "$COUNT
TRIES=0
RETRIES=5
rm ${TWRPTMP} > /dev/null 2>&1
rm ${TWRPTEST} > /dev/null 2>&1
function flash () {
echo "Flashing TWRP to lafbak. Please wait..."
./partitions.py --restoremisc ${TWRP} lafbak
echo "Dumping lafbak for hash check..."
./partitions.py --dump ${TWRPTMP} lafbak
echo "Trimming trailing zeros"
dd if=${TWRPTMP} of=${TWRPTEST} bs=${BS} count=${COUNT} > /dev/null #2>&1 # This strips the trailing whitespace so the dump is the same size as TWRP
TMPSIZE=$(stat -c%s $TWRPTEST)
echo "Temp file size: "$TMPSIZE
SHA1=`sha256sum ${TWRP} | awk '{print $1}'`
SHA2=`sha256sum ${TWRPTEST} | awk '{print $1}'`
STRHASH1="S${SHA1}"
STRHASH2="S${SHA2}"
echo "Checking hash..."
echo "TWRP hash:" $STRHASH1
echo "Test dump hash: " $STRHASH2
if [[ "$STRHASH1" != "$STRHASH2" ]] ; then
echo
echo "Hash check failed! Retrying for ${RETRIES} times."
echo
rm ${TWRPTMP}
rm ${TWRPTEST}
until [ $TRIES -ge $RETRIES ]
do
TRIES=$[$TRIES+1] && sleep 2 && echo "Attempt ${TRIES} - Press ctrl C to break" && flash
done && echo "Hash check failed after ${RETRIES} attempts - exiting" && exit
fi
echo "Hash check passed. Copying TWRP to laf"
./lglaf.py -c '!OPEN'
FD_NUM=`./lglaf.py -c '!EXEC lsof\0' | grep sda | grep lsof | awk '{print $4}' | cut -f1 -d"u"`
./lglaf.py -c '!COPY '$FD_NUM,$SRC_OFFSET,$SIZE,$DST_OFFSET
./lglaf.py -c '!CLSE '$FD_NUM
rm ${TWRPTMP} > /dev/null 2>&1
rm ${TWRPTEST} > /dev/null 2>&1
./lglaf.py -c '!CTRL POFF'
echo "Flash sucessful! Unplug your USB cable and your phone will power off."
echo "Once your phone is off, go back into download mode - hold vol up and plug the USB cable back in."
echo "Once TWRP loads, you need to flash TWRP onto recovery. You can run step2.sh if you want"
echo "an automated root."
}
flash
#!/bin/bash
# another n00b script that roots the phone...
echo "Make sure your phone has full booted into TWRP."
echo
read -n1 -r -p "Press any key to continue..." key
if [ "$KEY" = '' ]; then
echo "Rooting your phone. It will reboot back into TWRP."
echo "Don't do anything until your phone has booted back to the OS."
else
echo "Exiting"
exit
fi
echo "Unmounting data"
adb shell umount /data
adb shell umount /sdcard
echo
echo "Formatting data"
adb shell mkfs.ext2 /dev/block/bootdevice/by-name/userdata
echo
echo "Mounting data"
adb shell mount /dev/block/bootdevice/by-name/userdata /data
adb shell mount /dev/block/bootdevice/by-name/userdata /sdcard
echo
echo "Mounting system r/w"
adb shell mount -o rw /system
echo
echo "Installing TWRP onto recovery"
adb push h872-twrp.img /sdcard/
adb shell dd if=/sdcard/h872-twrp.img of=/dev/block/bootdevice/by-name/recovery
echo
echo "Making sure recovery sticks"
adb shell rm /system/recovery-from-boot.p
echo
echo "Rooting your phone!"
echo "Your phone will reboot back into the OS once rooted."
adb push Magisk-v16.0.zip /cache/recovery
adb shell echo ""--update_package=/cache/recovery/Magisk-v16.0.zip" > /cache/recovery/command"
echo "Rebooting. Do NOT shut off your phone until it is back in the OS."
echo "Enjoy your rooted phone!"
echo "You should really install Magisk Manager now."
adb reboot recovery
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment