jeanbmar / sc-compression

A Node.js module to decompress and compress game assets from Supercell games
41 stars 10 forks source link

Cannot decrypt Clash of Clans v15.0.3 apk sc files #14

Closed anno73 closed 1 year ago

anno73 commented 1 year ago

Hi!

When trying to decrypt clash-of-clans-15-0-3.apk/assets/sc/buildings.sc I get following error:

apk$ node decompress.mjs
enter a filepath or a directory:clash-of-clans-15-0-3.apk/assets/sc/buildings.sc
decompressing clash-of-clans-15-0-3.apk/assets/sc/buildings.sc...
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[LZMA_FORMAT_ERROR: File format not recognized] {
  code: 7,
  desc: 'File format not recognized'
}

Node.js v18.12.0

Any idea? Thanks!

jeanbmar commented 1 year ago

Hey there and thanks for reporting the issue!

I've checked the header, it seems a new compression has been added.

This is the file causing troubles:

53 43 00 00 00 04 00 00 00 03 00 00 00 10 B4 09
8C D1 49 52 EC 71 0D 8F B1 21 43 AC 4A 72 28 B5
2F FD

The 28 B5 2F FD bytes are a signature of a zstd compression.

For comparison, this is a file with sc2 signature.

53 43 00 00 00 04 00 00 00 01 00 00 00 10 83 96
A2 3A 8B 2B C4 2F 6F 68 87 73 5D B5 18 56 5D 00
00 04

I don't have much time to work on it for now, but any PR is welcome :).

anno73 commented 1 year ago

Thanks for quick reply. As a totally non nodejs guy, I wanted to give it a try. As it happens, I am even not able to call modified code from decompress.mjs %-} So basics really ... I suppose I will have to wait until you find some time to enhance ^.^.

jeanbmar commented 1 year ago

Closed by https://github.com/jeanbmar/sc-compression/pull/15, feedback welcome :)