Sonicomi(*.npk)

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
happyend
Posts: 157
Joined: Sun Aug 24, 2014 8:54 am

Sonicomi(*.npk)

Post by happyend »

Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Sonicomi(*.npk)

Post by Ekey »

Encrypted with AES/256/CBC + Vector (IV) from archive. File datas chunked, encrypted and compressed (deflate)

Code: Select all

static unsigned char m_Key[32] = {
       0x65, 0xAB, 0xB4, 0xA8, 0xCD, 0xE0, 0xC8, 0x10, 0xBB, 0x4A, 0x26, 0x72, 0x37, 0x54, 0xC3, 0xA7,
       0xE4, 0x3D, 0xE9, 0xEA, 0x7F, 0x5B, 0xB8, 0x43, 0x50, 0x1D, 0x05, 0xAB, 0xCF, 0x08, 0xD9, 0xC1};


Code: Select all

struct NPKHeader
{
   uint32_t   dwID; //Always NPK2
   uint32_t   dwFlag; //1 = Encrypted ?
   uint8_t    m_Vector[16]; //AES Vector (IV)
   uint32_t   dwTotalFiles;
   uint32_t   dwTableSize;
};
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

A couple of things to fix (read header of the script):
http://aluigi.org/bms/sonicomi.bms
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Sonicomi(*.npk)

Post by Ekey »

Maybe this 32 bytes is key for decrypt file data? :)

Code: Select all

    getdstring IV 16 MEMORY_FILE2   # ???
    getdstring HASH 16 MEMORY_FILE2 # ???
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

Eh no, the key is right or the whole file is garbage.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Sonicomi(*.npk)

Post by Ekey »

Well key and vector from header are correct for decrypt file data.
Last edited by Ekey on Mon Jul 11, 2016 3:31 pm, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

Everything is correct except the first 16 bytes of the extracted files.
BlueBird
Posts: 4
Joined: Mon Jul 11, 2016 2:17 pm

Re: Sonicomi(*.npk)

Post by BlueBird »

I keep getting an error every time:
Image

Btw, arc_unpacker just added Sonicomi support, and I can confirm it works:
https://github.com/vn-tools/arc_unpacker

You may want to look at the source code to see if it helps you correct the problems with sonicomi.bms, especially this part:
https://github.com/vn-tools/arc_unpacker/tree/master/src/dec/nitroplus

I'd do it myself, but I'm not very savvy on QuickBMS scripts or compression and encryption algorithms :(

But I would find it a huge help if the problems with the script were solved, as arc_unpacker can't be used to pack files, and the game doesn't support loading unpacked files.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Sonicomi(*.npk)

Post by Ekey »

I guess that script not valid for reimport files back.
BlueBird
Posts: 4
Joined: Mon Jul 11, 2016 2:17 pm

Re: Sonicomi(*.npk)

Post by BlueBird »

I actually get an error both when unpacking and reimporting. Does the former work for you? If so, I must be doing something wrong. Do you have to use the command line in this case? Because I've been using the GUI.
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Sonicomi(*.npk)

Post by Ekey »

BlueBird wrote:I actually get an error both when unpacking and reimporting.

Currently, this script does not work

BlueBird wrote:If so, I must be doing something wrong. Do you have to use the command line in this case? Because I've been using the GUI.

aluigi wrote:A couple of things to fix (read header of the script)
BlueBird
Posts: 4
Joined: Mon Jul 11, 2016 2:17 pm

Re: Sonicomi(*.npk)

Post by BlueBird »

Oh ok, just checking :lol:
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

The problem with the bytes of the extracted files was my fault.
Script 0.2 works perfectly but needs quickbms 0.7.5 which is not available yet.
BlueBird
Posts: 4
Joined: Mon Jul 11, 2016 2:17 pm

Re: Sonicomi(*.npk)

Post by BlueBird »

I see, so it's just a matter of waiting now.

Thank you for your efforts, and same goes for Ekey :D
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

That arc_unpacker supports many formats, would be interesting to have quickbms scripts for every format supported there.
Anyone interested in doing this huge conversion work? :D
Ekey
Posts: 1383
Joined: Sat Aug 09, 2014 2:34 pm

Re: Sonicomi(*.npk)

Post by Ekey »

Game Extractor supported over 1000 formats. Do you want doing this huge conversion work? :D
Last edited by Ekey on Wed Jul 13, 2016 12:35 am, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

I already checked it and it does NOT support 1000 formats.
It supports maybe 1000 games where most of them use just ZIP or the same format.
Additionally they are all old games for which already exist a script (xentax_cs on my website) or other solutions.
Anyway it's a good challenge :D
happyend
Posts: 157
Joined: Sun Aug 24, 2014 8:54 am

Re: Sonicomi(*.npk)

Post by happyend »

Wait QuickBMS 0.75 release,thx aluigi&Ekey
Methanol
Posts: 7
Joined: Fri Dec 19, 2014 5:08 pm

Re: Sonicomi(*.npk)

Post by Methanol »

So after upgrading QuickBMS this works fine for sound.npk, but has the same error trying to extract font.npk and 3d.npk.

Here's what extracting 3d.npk looks like (tries only 1 file):
Image

Sine 3d.npk is too big but font.npk has a similar issue, I give font.npk as a sample:
http://www100.zippyshare.com/v/fX0le6wc/file.html
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: Sonicomi(*.npk)

Post by aluigi »

I'm checking it but in the meantime I highly suggest you to use arc_unpacker that works with that file:
https://github.com/vn-tools/arc_unpacker (I used the latest nighly build)

Code: Select all

arc_unpacker.exe --dec=nitroplus/npk2 --plugin=sonicomi font.npk