diff --git a/.gitignore b/.gitignore index 979ae06..8f1e90e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ extracted_apk secrets .DS_Store *.pyc -mkbootimg \ No newline at end of file +mkbootimg +fw_updater_packer_unpacker/pkg_example/official_cp1_1.4.02.09061 +fw_updater_packer_unpacker/pkg_example/official_rp1_1.4.01.16100 diff --git a/fw_updater_packer_by_shankerzhiwu/FwUpdater/eufwupdater.sh b/fw_updater_packer_by_shankerzhiwu/FwUpdater/eufwupdater.sh new file mode 100755 index 0000000..808b13a --- /dev/null +++ b/fw_updater_packer_by_shankerzhiwu/FwUpdater/eufwupdater.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +LOG_FP="/root/updater_$(date +%s).log" +exec &>"$LOG_FP" + +UPDATER_BASE=$(dirname ${0}) +cd "$UPDATER_BASE" + +YAFT_PID=0 +./yaft /tmp/pty.txt & +YAFT_PID=$! +pty="" +for i in $(seq 1 10); do + pty="$(cat /tmp/pty.txt)" + if [ -n "$pty" ]; then + break; + fi + sleep 1 +done + +if [ -z "$pty" ]; then + echo "openpty failed" + kill -INT $YAFT_PID + exit 0; +fi + +echo "will open pty $pty" +rm "/tmp/_fifo" +mkfifo "/tmp/_fifo" +tee "$pty" < /tmp/_fifo & + +exec &>"/tmp/_fifo" + +echo "success" +echo "This is a demo update package which does nothing." +echo "enjoy" + +for i in $(seq 10 -1 1); do + echo "will done in ${i} seconds." + sleep 1 +done + +exit 0 diff --git a/fw_updater_packer_by_shankerzhiwu/FwUpdater/yaft b/fw_updater_packer_by_shankerzhiwu/FwUpdater/yaft new file mode 100755 index 0000000..40b71b2 Binary files /dev/null and b/fw_updater_packer_by_shankerzhiwu/FwUpdater/yaft differ diff --git a/fw_updater_packer_by_shankerzhiwu/Makefile b/fw_updater_packer_by_shankerzhiwu/Makefile new file mode 100644 index 0000000..3096abf --- /dev/null +++ b/fw_updater_packer_by_shankerzhiwu/Makefile @@ -0,0 +1,20 @@ +all: fw.pkg + +fw.pkg: base.pkg payload.tar.gz + echo 12836160f229d466bf4f051ba26fb46697bfa748e81b279b69ad9a5bd340958e $< | openssl sha256 -c + cp $< $@ + echo "55 -none -in /tmp/anim_sig.dat" | dd bs=8 count=4 seek=67 of=$@ conv=notrunc + echo "00 00 00 00" | xxd -r -p >> $@ + echo "00 00 00 00" | xxd -r -p >> $@ + printf '%08x' $$(wc -c < payload.tar.gz) | sed -E 's/(..)(..)(..)(..)/\4\3\2\1/' | xxd -r -p | head -c 4 >> fw.pkg + cat payload.tar.gz >> $@ + + +payload.tar.gz: FwUpdater + [ -x $> $@ + echo "00 00 00 00" | xxd -r -p >> $@ + printf '%08x' $$(wc -c < payload.tar.gz) | \ + sed -r 's/(..)(..)(..)(..)/\4\3\2\1/' | \ + xxd -r -p | head -c 4 >> fw.pkg + cat payload.tar.gz >> $@ + + +payload.tar.gz: FwUpdater + [ -x $> $@ + echo "00 00 00 00" | xxd -r -p >> $@ + printf '%08x' $$(wc -c < payload.tar.gz) | sed -E 's/(..)(..)(..)(..)/\4\3\2\1/' | xxd -r -p | head -c 4 >> fw.pkg + cat payload.tar.gz >> $@ + + +payload.tar.gz: FwUpdater + [ -x $