123456abcdef / cr-sc-dump

Python script to extract pngs from Supercell’s *.sc, *_dl.sc, *_tex.sc, *.csv, *.ktx, and *.sctx files.
87 stars 33 forks source link

.csv encryption help! #5

Closed CamC9 closed 7 years ago

CamC9 commented 7 years ago

OK so i was recently able to decrypt the .csv files in clash royale using a script somewhat simillar to this one.
I am trying to reverse the script, but i can't find a way to do it. I am also trying to do the same for the _tex.sc files. And this seems to be the only place where I can get any help, So any help would be appreciated! csv decoder link: https://github.com/proydakov/supercell_resource_decoder/blob/master/decoder_csv.py

123456abcdef commented 7 years ago

I never really tried to figure out how to compress the data again. I think it is just a matter of finding the correct settings.

filters = [{'id': lzma.FILTER_LZMA1, "preset": 9, 'dict_size': 262144}]  # ??
compressor = lzma.LZMACompressor(format=lzma.FORMAT_ALONE, filters=filters)
out1 = compressor.compress(decompressed)
out2 = compressor.flush()
compressed = out1 + out2

I don't know how lzma exactly works, but I assume using this reference (ftp://ftp.uni-bayreuth.de/pub/packages/tools/lzma/tukaani.org/lzma/header-format-12.txt) you should be able to extract the settings from the header? But I can't really help :P

CamC9 commented 7 years ago

Ok thanks that's fine. I'm just glad someone can respond