├── README.md ├── mksquashfs ├── modify.sh ├── padjffs2 └── unsquashfs /README.md: -------------------------------------------------------------------------------- 1 | padavan-firmware-modify-tool 2 | ----------------------------- 3 | 4 | This is someone else's work. Get it from there: 5 | 6 | But that guy didnt metion where it came from. 7 | 8 | Padavan is an open-source, GPL licened router firmware, but there are people 9 | who modified the project without open sourcing it. You can use this tool 10 | to see what is changed. 11 | 12 | If you know where this tool comes from, pls tell me 13 | 14 | ## Usage ## 15 | 16 | extract: `modify.sh e firmware.trx` 17 | 18 | re-create: `modify.sh c /path/to/unpacked/firmware/folder` 19 | -------------------------------------------------------------------------------- /mksquashfs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerTemp/padavan-firmware-modify-tool/9040e9147dabbaaeb87cbe74f5c75bf0206b6895/mksquashfs -------------------------------------------------------------------------------- /modify.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo echo "Starting..." 3 | MKSQSHFS4='./mksquashfs' 4 | PADJFFS2='./padjffs2' 5 | UNSQSHFS='./unsquashfs' 6 | case "$1" in 7 | 'extract'|'e') 8 | offset1=`grep -oba hsqs $2 | grep -oP '[0-9]*(?=:hsqs)'` 9 | offset2=`wc -c $2 | grep -oP '[0-9]*(?= )'` 10 | size2=`expr $offset2 - $offset1` 11 | #echo $offset1 " " $offset2 " " $size2 12 | dd if=$2 of=kernel.bin bs=1 ibs=1 count=$offset1 13 | dd if=$2 of=secondchunk.bin bs=1 ibs=1 count=$size2 skip=$offset1 14 | sudo rm -rf squashfs-root 2>&1 15 | sudo $UNSQSHFS -d squashfs-root secondchunk.bin 16 | rm secondchunk.bin 17 | ;; 18 | 'create'|'c') 19 | sudo $MKSQSHFS4 ./squashfs-root ./newsecondchunk.bin 20 | sudo chown $USER ./newsecondchunk.bin 21 | cat kernel.bin newsecondchunk.bin > $2 22 | $PADJFFS2 $2 23 | rm newsecondchunk.bin 24 | ;; 25 | *) 26 | echo 'run 27 | "modify-firmware.sh extract firmware.bin" 28 | You will find file "kernel.bin" and folder "squashfs-root". 29 | Modify "squashfs-root" as you like,after everything is done,run 30 | "modify-firmware.sh create newfirmware.bin" 31 | And you will get a modified firmware named newfirmware.bin. 32 | ' 33 | ;; 34 | esac 35 | 36 | -------------------------------------------------------------------------------- /padjffs2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerTemp/padavan-firmware-modify-tool/9040e9147dabbaaeb87cbe74f5c75bf0206b6895/padjffs2 -------------------------------------------------------------------------------- /unsquashfs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TylerTemp/padavan-firmware-modify-tool/9040e9147dabbaaeb87cbe74f5c75bf0206b6895/unsquashfs --------------------------------------------------------------------------------