Page 1 of 1

Miracle Nikki - .ktx file doesn't open

Posted: Fri Mar 05, 2021 4:11 pm
by Lucy
I have taken textures/sprites from a mobile game (Miracle Nikki) but I can't open them. They are in .ktx format but PVRTexTool doesn't open the files, tells that it is a wrong format or corrupted. I thought maybe its deciphered in some way, but I don't know anything about that so I can't know for sure, so I need some help with that ^^'
Attached is on of the textures.. :)

Re: .ktx file doesn't open

Posted: Fri Mar 05, 2021 7:14 pm
by ikskoks
Yeah, it is not standard KTX Image.
You can see here how it should look like http://wiki.xentax.com/index.php/KTX_Image

The one you have posted is encrypted in some way.

Re: .ktx file doesn't open

Posted: Sat Mar 06, 2021 3:27 pm
by aspadm
Lucy wrote: Fri Mar 05, 2021 4:11 pm I have taken textures/sprites from a mobile game (Miracle Nikki) but I can't open them.
This is custom made file format with blowfish encryption that was reverse engineered several times.
Latest version was deleted as tencent started the pursuit of enthusiasts.

Re: .ktx file doesn't open

Posted: Sat Mar 06, 2021 3:31 pm
by ikskoks
@aspadm, can you link to some documentation or at least some discussion regarding this format?

Also, what do you mean by "deleted"?

Re: .ktx file doesn't open

Posted: Sat Mar 06, 2021 3:58 pm
by aspadm
ikskoks wrote: Sat Mar 06, 2021 3:31 pm @aspadm, can you link to some documentation or at least some discussion regarding this format?
Ow, looks like they changed format.
Previous was like this:

Code: Select all

byte data[len-8]; // len = file size, must be a multiple of 8
char sign[2]; // "dr"
unsigned char version_a;
unsigned char version_b;
unsigned char trim; // number (0-7) of padding bytes
char ftype[3]; // "lua" of "png"
data is the blowfish encrypted (ECB for "png", CBC for "lua").
version_a and version_b is used in app to chose parts for key generation.

Decrypted data can be packed with LZ4.
Also, what do you mean by "deleted"?
Some time ago there was a thread on xentax where somebody :) posted a tool that decrypt files of MN (also known as "Love Nikki" etc.).
After that, one of the users (presumably from Vietnam) used this to publish information about the game events that have not yet been released, which is why tencent launched an investigation in the direction of localizers and others. The topic was removed from the forum, as the author of the tool asked for it.

Re: Miracle Nikki - .ktx file doesn't open

Posted: Mon Mar 08, 2021 7:59 pm
by Lucy
Thanks everyone for responses :) Thing is I know that the older version, that used .png was decrypted. But the tools for cracking the old one (at least the ones I tried before they were scrapped from internet or the ones that are still there) don't seem to work with the .ktx version. (I mean, duh, they weren't made for .ktx)

Re: Miracle Nikki - .ktx file doesn't open

Posted: Mon Mar 08, 2021 8:03 pm
by aspadm
From which game version did you take sample .ktx file?
"png" signature also was in .ktx files, it's just flag for chosing right encryption method.

Re: Miracle Nikki - .ktx file doesn't open

Posted: Mon Mar 08, 2021 8:14 pm
by Lucy
It's from miracle nikki for mainland china.

Re: Miracle Nikki - .ktx file doesn't open

Posted: Fri Mar 19, 2021 12:01 pm
by lunar23
hope someone can decrypt the ktx file :cry:

Nikki Games .ktx file help

Posted: Sun Mar 21, 2021 4:20 am
by lunar23
I have several ktx files encoded from png files (the current png file is also an encrypted file but I can decrypt them). I used some softwares like Mali or PVRTexTool but can't open ktx file.
I hope someone can help me method to decode this ktx file. Attachments include the ktx file and the original png file.
https://drive.google.com/drive/folders/ ... sp=sharing

Re: Nikki Games .ktx file help

Posted: Tue Mar 23, 2021 12:23 pm
by aspadm
lunar23 wrote: Sun Mar 21, 2021 4:20 am I hope someone can help me method to decode this ktx file. Attachments include the ktx file and the original png file.
Well, this is the encrypted textures. You can see characters "dr***png" at the end of files.
They have known file structure, but sharing the decryption keys is prohibited.

Re: Miracle Nikki - .ktx file doesn't open

Posted: Thu Apr 15, 2021 9:21 pm
by lunar23
I desperately sought the decoding. I think the old key still works, but the script structure in bms doesn't match the new structure. Hope someone can help write a code that is suitable for the new structure. :( :( :(

Re: Miracle Nikki - .ktx file doesn't open

Posted: Thu Apr 15, 2021 9:33 pm
by aspadm
Well, old script or LN_decode still works for files that use old key.
For the files encrypted with new keys you must change script AND aquire 26*26-1 = 675 new keys. After that you must use right key that chosed by version_a/b fields.
Sorry, but I can't say more as it will against forum rules (rule item 3, as the keys is a part of application).