Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 12:59

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Test Drive Unlimited 2 - *.bnk files
PostPosted: 10 Apr 2011 13:21 

Joined: 10 Jul 2010 09:45
Posts: 33
hi. Luigi, i wanna extract files from *.bnk, i don't know why, but i can't.

bms script:
Code:
Set FULLNAME string ""
Set NAME string ""
Log MEMORY_FILE 0 0
PutVarChr MEMORY_FILE 0 4 long
GetDString DUMMY 8
GetDString ID 4
If ID != "KNAB"
  CleanExit
EndIf
GoTo 0x28
Get NUMFILES long
Get DUMMY long
Get FATOFFSET long
Math FATOFFSET += 8
Get DUMMY long
Get NAMESOFFSET long
Math NAMESOFFSET += 8
Get FILESORDER long
Math FILESORDER += 8
PutVarChr MEMORY_FILE 0 FILESORDER long
GoTo NAMESOFFSET
If NUMFILES != 0
  CallFunction Parser
EndIf

StartFunction Parser
  Get NAMESZ byte
  If NAMESZ > 0x7F
    String FULLNAME += NAME
    String FULLNAME += \
    Get FOLDERS byte
   If FOLDERS > 0x7F
     Get TMP byte
     Math TMP < 7
     Math FOLDERS & 0x0000007F
     Math FOLDERS | TMP
#     Print %FOLDERS%
   EndIf
    Math NAMESZ ^= 0xFF
    Math NAMESZ += 1
    GetDString NAME NAMESZ
    For I = 0 < FOLDERS
      CallFunction Parser
    Next I
  Else
    GetDString BASENAME NAMESZ
    String FULLNAME += BASENAME
    String FULLNAME += NAME
#   Print %FULLNAME%
   SavePos NAMESOFFSET
   GetVarChr FILESORDER MEMORY_FILE 0 long
   GoTo FILESORDER
   If NUMFILES > 0x100
     Get FILENUMBER word
   Else
     Get FILENUMBER byte
   EndIf
   SavePos FILESORDER
   PutVarChr MEMORY_FILE 0 FILESORDER long
   Math FILENUMBER *= 0x14
   Math FATOFFSET += FILENUMBER
   GoTo FATOFFSET
   Get OFFSET long
   Get SIZE long
   GetDString DUMMY 12
    Log FULLNAME OFFSET SIZE
   GoTo NAMESOFFSET
  EndIf
EndFunction Parser


and sample


Top
 Profile  
 
 
 Post subject: Re: Test Drive Unlimited 2 - *.bnk files
PostPosted: 10 Apr 2011 16:00 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
*edit* script updated
Code:
filexor "0xd7 0xa8 0xe2 0xd4"
get SIZE asize
get NAME basename
string NAME += ".decrypted"
log NAME 0 SIZE


Top
 Profile  
 
 Post subject: Re: Test Drive Unlimited 2 - *.bnk files
PostPosted: 10 Apr 2011 16:13 

Joined: 10 Jul 2010 09:45
Posts: 33
aluigi wrote:
if you xor the file with the bytes "28 57 1d 2b d7 a8 e2 d4" the result seems a headerless DDS image, can you confirm it?
you can use my xor.exe tool: xor.exe file.bnk output.dat 0x28571d2bd7a8e2d4
or the following script:
Code:
filexor "0x28 0x57 0x1d 0x2b 0xd7 0xa8 0xe2 0xd4"
get SIZE asize
get NAME basename
string NAME += ".decrypted"
log NAME 0 SIZE

i get file with same size, but with strange stuff inside (hex), actually it's a container with a several types of files, but i can unpack it, on xentax guys successfully unpacking such files, but i can't, don't know why, same script maybe not the same files


Top
 Profile  
 
 Post subject: Re: Test Drive Unlimited 2 - *.bnk files
PostPosted: 10 Apr 2011 18:02 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
seems that I was partially correct, the xor key is "0xd7 0xa8 0xe2 0xd4" and the result looks like a model or a similar thing.

you can find more info and where I found the confirmation of the key here:
http://sethioz.co.uk/mediawiki/index.ph ... .map_files


Top
 Profile  
 
 Post subject: Re: Test Drive Unlimited 2 - *.bnk files
PostPosted: 11 Apr 2011 11:40 

Joined: 10 Jul 2010 09:45
Posts: 33
aluigi wrote:
seems that I was partially correct, the xor key is "0xd7 0xa8 0xe2 0xd4" and the result looks like a model or a similar thing.

you can find more info and where I found the confirmation of the key here:
http://sethioz.co.uk/mediawiki/index.ph ... .map_files

thanks for providing me, Luigi, but it seems that is my mistake: i used old version for extracting big/map files, and get wrong files, now everything is ok

here is same file, but with right hex-structure

once again thank you ;)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC [ DST ]


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:
cron