max-boehm / qnap-utils

Utilities to unpack QNAP firmware images and QPKG files
60 stars 23 forks source link

PC1 tool not found; decrypt the image first by invoking on your NAS #1

Open ZakiG opened 5 years ago

ZakiG commented 5 years ago

When I try to use this tool to extract Qnap firmware, execute this command: ./extract_qnap_fw.sh TS-131P_231P_431P_X31+_20190528-4.4.1.0949.img ./qnap_firmware But I ran into this problem:

trap: ERR: bad trap SRC=TS-131P_231P_431P_X31+_20190528-4.4.1.0949.img, DEST=./qnap_firmware

PC1 tool not found; decrypt the image first by invoking on your NAS

/sbin/PC1 d QNAPNASVERSION4 TS-131P_231P_431P_X31+_20190528-4.4.1.0949.img TS-131P_231P_431P_X31+_20190528-4.4.1.0949.img.tgz

What's wrong with this? Do I need to install other dependency libraries? Thanks

max-boehm commented 5 years ago

The PC1 tool is required to decrypt the image. It is part of the NAS firmware. If you have an x86 based model you can copy the tool to Linux. On an ARM based model you'll need to do the decryption of the img file on the NAS itself (via ssh by invoking the /sbin/PC1 ... command in the directory where the firmware file is located). Thereafter you can extract the decrypted firmware tgz file by ./extract_qnap_fw.sh TS-131P_231P_431P_X31+_20190528-4.4.1.0949.img.tgz ./qnap_firmware

galaxy4public commented 2 years ago

@ZakiG , you can compile your own PC1 by downloading the pc1.c file and compiling it using the following command:

gcc -pipe -Wall -O0 -ggdb -o PC1 pc1.c

Then you either need to modify the extract_qnap_fw.sh to use a local copy of the compiled tool or just copy PC1 to a directory in your PATH (e.g. to /usr/local/bin).

P.S. I am providing the compile command as I ran it (with all the optimisation disabled and the debugging support enabled), since I had to fix a few things in the original source to work reliably with my GCC.