script enhance, bug fix

This commit is contained in:
HappyZ 2018-12-08 01:27:04 -06:00
parent d1ec7a4158
commit d9cbfe6543
2 changed files with 6 additions and 2 deletions

View File

@ -35,7 +35,7 @@
# params
INDIR=$1 # input folder
TMPDIR=$INDIR
PKGFILE=$1/repacked.pkg # output pkg file
PKGFILE=$1/FwUpdater.pkg # output pkg file
SHA256KEY="./key.pub"
SIGKEY="./key.private" # we use data encryption key (ignored anyway)
DATAKEY_D="./key.private"
@ -101,3 +101,7 @@ printf "%.8x" $((OFFSET_DATA)) | sed -E 's/(..)(..)(..)(..)/\4\3\2\1/' | xxd -r
echo "* add file header"
printf "DPUP" | cat - $TMPDIR/tmp.step5 > $PKGFILE
# remove tmp files
rm $TMPDIR/tmp.step*
rm $INDIR/repacked_pkg.tar.gz

View File

@ -101,7 +101,7 @@ dd if=$1 of=$IV bs=1 skip=${IV_OFFSET} count=32 2>/dev/null
########################################
# decrypt data and extract directory tree
########################################
dd if=$1 bs=$(($DATA_OFFSET)) skip=1 2>/dev/null | head -c $(($BODY_SIZE)) | openssl enc -d -aes-256-cbc -K "cat ${AES256_KEY}" -iv "cat ${IV}" | tar -xz -C $2
dd if=$1 bs=$(($DATA_OFFSET)) skip=1 2>/dev/null | head -c $(($BODY_SIZE)) | openssl enc -d -aes-256-cbc -K `cat ${AES256_KEY}` -iv `cat ${IV}` | tar -xz -C $2
########################################