Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decryption fails? #15

Open
user8547 opened this issue Jan 5, 2024 · 4 comments
Open

Decryption fails? #15

user8547 opened this issue Jan 5, 2024 · 4 comments

Comments

@user8547
Copy link

user8547 commented Jan 5, 2024

Using latest source code as of 2024-01-05, it is not possible to unzip the downloaded and decrypted firmware:

$ ./TheAirBlow.Syndical.Application -m DownloadDecrypt -v G970FXXSGHWC1/G970FOXMGHWA3/G970FXXSGHWB3 -M SM-G970F -r SEB -I RF8M81TZ4VB -f
Device: SM-G970F/SEB
Firmware: G970FXXSGHWC1/G970FOXMGHWA3/G970FXXSGHWB3/G970FXXSGHWC1
Connecting to FUS server...
Verifying firmware version...
Fetching firmware information...
Initializing download...
Destination: SM-G970F_5_20230303113410_3xhglg47s4_fac.zip
WANRING: No hash check will be performed.
Firmware download & decryption done!                                                                                   
                                                                                                                       
Downloading & Decrypting firmware ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 5.9 GB 43.2 MB/s 00:00:00 00:03:42     
                                                                                                                       
$ unzip SM-G970F_5_20230303113410_3xhglg47s4_fac.zip
Archive:  SM-G970F_5_20230303113410_3xhglg47s4_fac.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of SM-G970F_5_20230303113410_3xhglg47s4_fac.zip or
        SM-G970F_5_20230303113410_3xhglg47s4_fac.zip.zip, and cannot find SM-G970F_5_20230303113410_3xhglg47s4_fac.zip.ZIP, period.
@user8547
Copy link
Author

user8547 commented Jan 5, 2024

$ md5sum SM-G970F_5_20230303113410_3xhglg47s4_fac.zip
c4b1969e8b18e89369e2c4985ade54b3  SM-G970F_5_20230303113410_3xhglg47s4_fac.zip

@TheRealMrWicked
Copy link
Contributor

Hey so I am not sure if the problem is with the decryption of the file, but it appears that the header of the zip file has an error in it.

I usually extract these files using 7-Zip on windows and the program has not issue with extracting it, however on Linux using the most common programs (unzip, tar, 7z) all fail to extract it.

But I have found a solution to the issue, you need to fix the archive using the zip program.

Firstly download the program from your repo using the respective package manager:

sudo apt install zip or sudo pacman install zip

Then run the fix command (this may take up to 10 minutes):

zip -FF inputarchive --out outputarchive

Example Usage:

zip -FF SM-G970F_5_20230303113410_3xhglg47s4_fac.zip --out Firmware.zip

Then you can decompress the newly created archive as usual using unzip:

unzip Firmware.zip

Hope this helps you solve the problem.

@TheAirBlow
Copy link
Collaborator

TheAirBlow commented Jan 5, 2024

$ md5sum SM-G970F_5_20230303113410_3xhglg47s4_fac.zip
c4b1969e8b18e89369e2c4985ade54b3  SM-G970F_5_20230303113410_3xhglg47s4_fac.zip

Check if you get the same corrupted zip when using Bifrost.

This project is basically in maintenance only for now (two new libraries soon), so I'm piggybanking off them.

@user8547
Copy link
Author

user8547 commented Jan 6, 2024

Bitfrost after decryption produced a different zip file which unzips fine:

$ md5sum SM-G970F_5_20230303113410_3xhglg47s4_fac_G970FXXSGHWC1_G970FOXMGHWA3_G970FXXSGHWB3_G970FXXSGHWC1_SEB.zip
abe8b002c6394eefd9d2fab4927e5983  SM-G970F_5_20230303113410_3xhglg47s4_fac_G970FXXSGHWC1_G970FOXMGHWA3_G970FXXSGHWB3_G970FXXSGHWC1_SEB.zip

$ unzip SM-G970F_5_20230303113410_3xhglg47s4_fac_G970FXXSGHWC1_G970FOXMGHWA3_G970FXXSGHWB3_G970FXXSGHWC1_SEB.zip 
Archive:  SM-G970F_5_20230303113410_3xhglg47s4_fac_G970FXXSGHWC1_G970FOXMGHWA3_G970FXXSGHWB3_G970FXXSGHWC1_SEB.zip
  inflating: BL_G970FXXSGHWC1_CL25257816_QB62768393_REV01_user_low_ship.tar.md5  
  inflating: AP_G970FXXSGHWC1_CL25257816_QB62768393_REV01_user_low_ship_meta_OS12.tar.md5

TheRealMrWicked: Thank you for looking into it! zip -FF was not able to fix the zip file, but you are correct that 7z on windows is able to decompress that corrupted zip just fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants