Clash Royale .sc files decrypt

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
HeniX
Posts: 4
Joined: Sat Nov 26, 2016 12:24 pm

Re: Clash Royale .sc files decrypt

Post by HeniX »

Sounds cool :)
Can anyone make me a whole process step by step (with pictures)
my Gmail:- blackberryto47@gmail.com
Thank You
Johnny
Posts: 16
Joined: Fri Oct 28, 2016 9:54 am

Re: Clash Royale .sc files decrypt

Post by Johnny »

CamC999 wrote:I am likely to make a video tutorial on YouTube soon, since there are no tutorials that seem to support this topic. I will say that it takes a lot of patience and is not so easy. Anyways, I will give further notice about the video tutorial. I hope this helps!

Can't wait to see the tutorial. You're a real savior :D
Xhulio
Posts: 5
Joined: Mon Nov 14, 2016 4:20 pm

Re: Clash Royale .sc files decrypt

Post by Xhulio »

Cam999 i will be glad if u will share your convnerted .sc files with me
:(
email:torbenernesti@gmail.com
Xhulio
Posts: 5
Joined: Mon Nov 14, 2016 4:20 pm

Re: Clash Royale .sc files decrypt

Post by Xhulio »

Please help me :c :( :|
rus_lol_
Posts: 18
Joined: Sun Nov 06, 2016 6:33 am

Re: Clash Royale .sc files decrypt

Post by rus_lol_ »

I decompiling all _tex.sc to .png.Download here
Ember
Posts: 6
Joined: Wed Nov 30, 2016 5:52 pm

Re: Clash Royale .sc files decrypt

Post by Ember »

Help me plz!
My mail zhe.chet@gmail.com
Ember
Posts: 6
Joined: Wed Nov 30, 2016 5:52 pm

Re: Clash Royale .sc files decrypt

Post by Ember »

Can someone convert png to sc?
rus_lol_
Posts: 18
Joined: Sun Nov 06, 2016 6:33 am

Re: Clash Royale .sc files decrypt

Post by rus_lol_ »

Ember wrote:Can someone convert png to sc?

i came here with this question.. :cry:
Ember
Posts: 6
Joined: Wed Nov 30, 2016 5:52 pm

Re: Clash Royale .sc files decrypt

Post by Ember »

rus_lol_ wrote:
Ember wrote:Can someone convert png to sc?

i came here with this question.. :cry:

Ты из России?
CamC999
Posts: 19
Joined: Tue Nov 22, 2016 9:25 pm

Re: Clash Royale .sc files decrypt

Post by CamC999 »

rus_lol_ wrote:
Ember wrote:Can someone convert png to sc?

i came here with this question.. :cry:


I can't figure it out. If anyone knows, it would be barbossa42 (the creator of dumpsc.py script) or aluigi. It would be incredible if that was possible, because then you can create your own texture packs for clash royale!
barbossa42
Posts: 11
Joined: Thu Oct 20, 2016 11:18 am

Re: Clash Royale .sc files decrypt

Post by barbossa42 »

It is VERY unlikely that the client (CR app) would accept modified resource files, since it validates their hash against the server.
Now, if there were some alternative server around, like the Ultrapowa Clash Server, it wouldn't be hard to reverse the process: change the textures, update the texture map if necessary, save a stream of pixels in the correct format, compress with LZMA and remove a part of the header, so the file would behave just like CR's .sc files.
Also, I'm not the creator of dumpsc, just fixed a bug ;-)
Ember
Posts: 6
Joined: Wed Nov 30, 2016 5:52 pm

Re: Clash Royale .sc files decrypt

Post by Ember »

barbossa42 wrote:It is VERY unlikely that the client (CR app) would accept modified resource files, since it validates their hash against the server.
Now, if there were some alternative server around, like the Ultrapowa Clash Server, it wouldn't be hard to reverse the process: change the textures, update the texture map if necessary, save a stream of pixels in the correct format, compress with LZMA and remove a part of the header, so the file would behave just like CR's .sc files.
Also, I'm not the creator of dumpsc, just fixed a bug ;-)

But we can change font and sounds ;)
CamC999
Posts: 19
Joined: Tue Nov 22, 2016 9:25 pm

Re: Clash Royale .sc files decrypt

Post by CamC999 »

barbossa42 wrote:It is VERY unlikely that the client (CR app) would accept modified resource files, since it validates their hash against the server.
Now, if there were some alternative server around, like the Ultrapowa Clash Server, it wouldn't be hard to reverse the process: change the textures, update the texture map if necessary, save a stream of pixels in the correct format, compress with LZMA and remove a part of the header, so the file would behave just like CR's .sc files.
Also, I'm not the creator of dumpsc, just fixed a bug ;-)


So I found that the .sc files have a fingerprint and hash on them, not allowing you to edit them, however, the _tex.sc files don't. I was able to replace the chr_princess_tex.sc with chr_electro_wiz_tex.sc and it worked using filza on jailbreak. The problem is that the normal .sc files can't be changed, so it ends up trying to perform an animation meant for the princess texture, on the electro wizard, making the textures offset and out of place.

I am trying to find a way to use LZMA and the dumpsc.py script to reencrypt edited .png files that will save them as the correct encrypted .sc files. Do you know enough about the script to reverse the process? :?
rus_lol_
Posts: 18
Joined: Sun Nov 06, 2016 6:33 am

Re: Clash Royale .sc files decrypt

Post by rus_lol_ »

Ember wrote:
rus_lol_ wrote:
Ember wrote:Can someone convert png to sc?

i came here with this question.. :cry:

Ты из России?

Да! 8-)
barbossa42
Posts: 11
Joined: Thu Oct 20, 2016 11:18 am

Re: Clash Royale .sc files decrypt

Post by barbossa42 »

CamC999 wrote:So I found that the .sc files have a fingerprint and hash on them, not allowing you to edit them, however, the _tex.sc files don't. I was able to replace the chr_princess_tex.sc with chr_electro_wiz_tex.sc and it worked using filza on jailbreak. The problem is that the normal .sc files can't be changed, so it ends up trying to perform an animation meant for the princess texture, on the electro wizard, making the textures offset and out of place.

I am trying to find a way to use LZMA and the dumpsc.py script to reencrypt edited .png files that will save them as the correct encrypted .sc files. Do you know enough about the script to reverse the process? :?


As I said before, the reverse process is relatively simple. Unfortunately I'm a bit busy at work to code it, but here is an outline:

0- Change your PNG file as wished; to keep it simple, keep the image dimensions the same.

1- Load the image using PIL/pillow, convert it to an 1D array of pixels, encoded as 4 bytes per pixel (RGBA)
2- Write the header:
2.1- byte 0 is 0x01
2.2- bytes 1-4 should be the number of pixels * the number of bytes per pixel (4), little endian notation
2.3- byte 5 should be 0x00
2.4- bytes 6-7 are the image width, little endian
2.5- bytes 8-9 are the image height, little endian

3- Write header + image data to a file, compress using LZMA
4- Remove 4 0x00 bytes from position 9 of the compressed file
5- Save as .sc

Some sprite map files have the image pixel format in them, this could probably cause some errors; you would need to note the pixel format of the source image and re-encode the pixels in the original format, but this is outside my knowledge, the instructions above are for RGBA8888. Check the convert_pixel function and reverse the binary operations there.
rus_lol_
Posts: 18
Joined: Sun Nov 06, 2016 6:33 am

Re: Clash Royale .sc files decrypt

Post by rus_lol_ »

barbossa42 wrote:
CamC999 wrote:So I found that the .sc files have a fingerprint and hash on them, not allowing you to edit them, however, the _tex.sc files don't. I was able to replace the chr_princess_tex.sc with chr_electro_wiz_tex.sc and it worked using filza on jailbreak. The problem is that the normal .sc files can't be changed, so it ends up trying to perform an animation meant for the princess texture, on the electro wizard, making the textures offset and out of place.

I am trying to find a way to use LZMA and the dumpsc.py script to reencrypt edited .png files that will save them as the correct encrypted .sc files. Do you know enough about the script to reverse the process? :?


As I said before, the reverse process is relatively simple. Unfortunately I'm a bit busy at work to code it, but here is an outline:

0- Change your PNG file as wished; to keep it simple, keep the image dimensions the same.

1- Load the image using PIL/pillow, convert it to an 1D array of pixels, encoded as 4 bytes per pixel (RGBA)
2- Write the header:
2.1- byte 0 is 0x01
2.2- bytes 1-4 should be the number of pixels * the number of bytes per pixel (4), little endian notation
2.3- byte 5 should be 0x00
2.4- bytes 6-7 are the image width, little endian
2.5- bytes 8-9 are the image height, little endian

3- Write header + image data to a file, compress using LZMA
4- Remove 4 0x00 bytes from position 9 of the compressed file
5- Save as .sc

Some sprite map files have the image pixel format in them, this could probably cause some errors; you would need to note the pixel format of the source image and re-encode the pixels in the original format, but this is outside my knowledge, the instructions above are for RGBA8888. Check the convert_pixel function and reverse the binary operations there.

Thanks man!but I'd rather wait for the script) :D
Ember
Posts: 6
Joined: Wed Nov 30, 2016 5:52 pm

Re: Clash Royale .sc files decrypt

Post by Ember »

rus_lol_ wrote:
barbossa42 wrote:
CamC999 wrote:So I found that the .sc files have a fingerprint and hash on them, not allowing you to edit them, however, the _tex.sc files don't. I was able to replace the chr_princess_tex.sc with chr_electro_wiz_tex.sc and it worked using filza on jailbreak. The problem is that the normal .sc files can't be changed, so it ends up trying to perform an animation meant for the princess texture, on the electro wizard, making the textures offset and out of place.

I am trying to find a way to use LZMA and the dumpsc.py script to reencrypt edited .png files that will save them as the correct encrypted .sc files. Do you know enough about the script to reverse the process? :?


As I said before, the reverse process is relatively simple. Unfortunately I'm a bit busy at work to code it, but here is an outline:

0- Change your PNG file as wished; to keep it simple, keep the image dimensions the same.

1- Load the image using PIL/pillow, convert it to an 1D array of pixels, encoded as 4 bytes per pixel (RGBA)
2- Write the header:
2.1- byte 0 is 0x01
2.2- bytes 1-4 should be the number of pixels * the number of bytes per pixel (4), little endian notation
2.3- byte 5 should be 0x00
2.4- bytes 6-7 are the image width, little endian
2.5- bytes 8-9 are the image height, little endian

3- Write header + image data to a file, compress using LZMA
4- Remove 4 0x00 bytes from position 9 of the compressed file
5- Save as .sc

Some sprite map files have the image pixel format in them, this could probably cause some errors; you would need to note the pixel format of the source image and re-encode the pixels in the original format, but this is outside my knowledge, the instructions above are for RGBA8888. Check the convert_pixel function and reverse the binary operations there.

Thanks man!but I'd rather wait for the script) :D

У тебя есть вк :?:
rus_lol_
Posts: 18
Joined: Sun Nov 06, 2016 6:33 am

Re: Clash Royale .sc files decrypt

Post by rus_lol_ »

У тебя есть вк :?:

https://vk.com/ruslol1
rus_lol_
Posts: 18
Joined: Sun Nov 06, 2016 6:33 am

Re: Clash Royale .sc files decrypt

Post by rus_lol_ »

Well, the script is there?
CamC999
Posts: 19
Joined: Tue Nov 22, 2016 9:25 pm

Re: Clash Royale .sc files decrypt

Post by CamC999 »

I Really don't know how to do what barbossa42 said, but I would rather wait for a script. Thanks!