ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Jun 14, 2021 9:43 pm

All times are UTC




Post new topic  Reply to topic  [ 26 posts ]  Go to page 1 2 Next
Author Message
 Post subject: Onigiri Online
PostPosted: Sun Aug 10, 2014 9:05 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
http://aluigi.org/papers/bms/others/onigiri_online.bms

Script for the kxr archives of Onigiri Online.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Aug 10, 2014 9:24 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1197
Yes local archives do not contain the filenames. They contained in other kxr archive which will downloaded from server while start game.

  • cobralaunch.kxr
  • pkg.json // <- Filenames

Mega Encryption for kxr. Also seems used for decrypt pnut files :)

Code:
int oni_decrypt(unsigned int dwOffset, int pBuffer)
{
  unsigned int Offset;
  unsigned int Buffer;
  int dwSize;
  int Size;
  int result;
  int i;
  char Seed;
  unsigned int NextKey;
  int j;

  Offset = dwOffset;
  Buffer = *(DWORD *)pBuffer;
  dwSize = 4 * *(DWORD *)(pBuffer + 8) / 4;
  Size = dwSize + *(DWORD *)pBuffer;
  if ( *(DWORD *)pBuffer < (unsigned int)Size )
  {
    do
    {
      *(DWORD *)Buffer ^= Offset;
      Buffer += 4;
      Offset = ~(unsigned __int8)((Offset ^ (Offset >> 3)) >> 13) & 1 | 2 * Offset;
    }
    while ( Buffer < Size );
  }
  result = *(DWORD *)(pBuffer + 8) - dwSize;
  i = 0;
  if ( result > 0 )
  {
    Seed = 0;
    j = 0;
    do
    {
      NextKey = Offset >> Seed;
      ++i;
      Seed = j + 8;
      *(BYTE *)(i + Buffer - 1) ^= NextKey;
      j += 8;
    }
    while ( i < result );
  }
  return result;
}


Values endian big.

Code:
struct KXRHeader {
 DWORD dwID; // kxrf
 DWORD dwNull; // null
 DWORD dwTableOffset;
 DWORD dwTableSize;
};

   KXRHeader pHeader;
   fread(&pHeader, sizeof(pHeader), 1, fi);
   fseek(fi, pHeader.dwTableOffset, SEEK_SET);

   unsigned char* pBuffer = new unsigned char[pHeader.dwTableSize];
   memset(pBuffer , 0, pHeader.dwTableSize);
   fread(pBuffer, pHeader.dwTableSize, 1, fi);
   
   oni_decrypt(pHeader.dwOffset, (int)pBuffer);


for kotori.pnut

Code:
   oni_decrypt(0x3716F028u, (int)pBuffer);


Last edited by Ekey on Mon Aug 11, 2014 5:20 am, edited 3 times in total.

Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Aug 10, 2014 10:45 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
oh come on, that's not fair :)
I went offline to make the job and when I return online I see you did the same.

Anyway I have updated the post.
The only missing thing is the compression algorithm.
My scanner found nothing already existent in the quickbms compression algorithms.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Aug 10, 2014 11:20 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1197
Well compressed data featured in this code (see attach). Seems it's zlib.. Maybe modified? :?


Last edited by Ekey on Mon Aug 11, 2014 11:50 am, edited 1 time in total.

Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Aug 10, 2014 11:24 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
That algorithm is clearly zlib, but type 0 is different.
Type 0 is more like a rle or something easier than zlib (the first bytes are in clear text like PNG and ggS)


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Mon Aug 11, 2014 10:39 am 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1197
Ok Luigi. Type 0 it's mean not compressed but encrypted. Algoritm the same :)

Example:

Archive: snd0-0001.kxr
FileName: /2
Type: 0
FileData Offset: 0001a5cb

Here first DWORD already decrypted because passed cycle 1 times
Image

After full cycle
Image


Last edited by Ekey on Mon Aug 11, 2014 10:59 am, edited 1 time in total.

Top
   
 Post subject: Re: Onigiri Online
PostPosted: Mon Aug 11, 2014 10:58 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
How it's possible that I didn't notice it yesterday?! Too much stress :)
I have updated the script.

I don't know for what reason but the feature of quickbms that autoguesses the extensions doesn't work, I will check the cause later.

*edit*
The cause is a bug in quickbms, the new feature doesn't work if there are paths in the name (the name must end with a dot or '*' to enable the auto-extension feature with filenames).


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Mon Aug 11, 2014 11:01 am 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1197
Just need rest! :)


Last edited by Ekey on Mon Aug 11, 2014 7:20 pm, edited 1 time in total.

Top
   
 Post subject: Re: Onigiri Online
PostPosted: Mon Aug 11, 2014 4:15 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
I have replaced the decryption function written in bms language, with a dumped one.
Now there are no problems with the slowness.

Unfortunately this is the only method to bypass the speed limitations of quickbms


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Tue Aug 26, 2014 7:39 am 

Joined: Tue Aug 26, 2014 7:33 am
Posts: 33
is it possible to encrypt it again?


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Tue Aug 26, 2014 8:34 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
type 0 files cannot be reimported because they use that custom encryption, you can reimport files only if they use a native compression/encryption supported by quickbms.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Feb 15, 2015 8:12 am 

Joined: Sun Feb 15, 2015 8:05 am
Posts: 2
Heyllow everyone, Just released my new unpacker who support Onigiri kxr, pnut files.
http://hsreina.shadosoft-tm.com/
I you check well game files, you should be able to repack the game without the future updatae of my tool.


Last edited by HSReina on Sun Feb 15, 2015 4:19 pm, edited 1 time in total.

Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Feb 15, 2015 8:52 am 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
It asks username and password.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Feb 15, 2015 4:05 pm 

Joined: Sat Aug 09, 2014 2:34 pm
Posts: 1197
aluigi wrote:
It asks username and password.

Same


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Feb 15, 2015 4:21 pm 

Joined: Sun Feb 15, 2015 8:05 am
Posts: 2
Sorry, I've edited the link, it was a preview of the web site.
To Unpack Onigiri files, you must use KGL Unpacker. You'll can use it on some other Cyberstep games.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Jun 28, 2015 9:35 pm 

Joined: Sun Jun 21, 2015 6:30 pm
Posts: 1
Is there a way to encrypt it again besides re importing?


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Mon Jun 29, 2015 3:44 am 

Joined: Wed Jun 24, 2015 12:23 pm
Posts: 14
HSReina wrote:
Sorry, I've edited the link, it was a preview of the web site.
To Unpack Onigiri files, you must use KGL Unpacker. You'll can use it on some other Cyberstep games.


Where can I find KGL Unpacker? And do you think it will work on GetAmped2's .kxr files?

EDIT: I found it on your site. And it does not work on those files.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Mon Jun 29, 2015 1:34 pm 
Site Admin
User avatar

Joined: Wed Jul 30, 2014 9:32 pm
Posts: 12296
I thought that the getamped2.bms script worked, right?
It's valid also for reimporting.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Tue Jun 30, 2015 4:20 am 

Joined: Wed Jun 24, 2015 12:23 pm
Posts: 14
aluigi wrote:
I thought that the getamped2.bms script worked, right?
It's valid also for reimporting.


Yes, yes, the getamped2.bms script works perfectly. I just thought somebody had an unpacker that could properly view the files within for a second. My bad.


Top
   
 Post subject: Re: Onigiri Online
PostPosted: Sun Aug 02, 2015 1:30 am 

Joined: Tue Aug 26, 2014 7:33 am
Posts: 33
is it possible while extracting , it use the name inside the cobralaunch.kxr>pkg.json?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 26 posts ]  Go to page 1 2 Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited