
Editted: Solved, creditted to Ekey again for his effort.
Code: Select all
# Demonbane (機神咆吼デモンベイン) NPK (NPK2) format
# script for QuickBMS http://quickbms.aluigi.org
comtype deflate_noerror
set KEY binary "\xBE\x28\x02\xAD\x5E\x91\xDD\x8E\x26\xEA\xD6\xB1\x61\xFE\xDB\x8A\x17\xE2\x36\x2F\x53\x33\x6D\x1B\x17\xD8\x0A\xE9\x55\xC0\x5A\xED"
idstring "NPK2"
get VERSION long #2
getdstring IV 16
get FILES long
get TABLE_SIZE long
savepos TABLE_OFFSET
encryption aes_256_cbc KEY IV
log MEMORY_FILE TABLE_OFFSET TABLE_SIZE
encryption "" ""
for i = 0 < FILES
get ZERO byte MEMORY_FILE
get NSIZE short MEMORY_FILE
getdstring NAME NSIZE MEMORY_FILE
get SIZE long MEMORY_FILE
getdstring SHA2 32 MEMORY_FILE
get CHUNKS long MEMORY_FILE
log NAME 0 0
append
for j = 0 < CHUNKS
get CHUNK_OFFSET longlong MEMORY_FILE
get CHUNK_ESIZE long MEMORY_FILE
get CHUNK_ZSIZE long MEMORY_FILE
get CHUNK_SIZE long MEMORY_FILE
encryption "cipherfinal aes_256_cbc" KEY IV
clog NAME CHUNK_OFFSET CHUNK_ESIZE CHUNK_SIZE 0 CHUNK_ESIZE
encryption "" ""
next j
append
next i
aluigi wrote:@Ekey
Does it solve the problem I noticed with the first 16bytes?
aluigi wrote:You used comtype deflate_noerror so I guess you just ignored the invalid bytes, correct?
Lucas Hood wrote:Currently me and my friend are also having trouble with the movie files though - except for the CGs and Scripts, Sounds since all are fine, most of the movie files are either distorted or unreadable, like it played for a bit then it froze. Let's wait for Ekey to help then.
https://imgur.com/a/g1nFWWm
Ekey wrote:aluigi wrote:@Ekey
Does it solve the problem I noticed with the first 16bytes?
I have not found any files with the invalid first 16 bytes.aluigi wrote:You used comtype deflate_noerror so I guess you just ignored the invalid bytes, correct?
No, some chunks are simply not compressed in the case of small files, since there are no flags, to check this I set "noerror".Anyway it works correctly.Lucas Hood wrote:Currently me and my friend are also having trouble with the movie files though - except for the CGs and Scripts, Sounds since all are fine, most of the movie files are either distorted or unreadable, like it played for a bit then it froze. Let's wait for Ekey to help then.
https://imgur.com/a/g1nFWWm
There is such a problem, but I don't know what caused it.
Edited*: I modified a arc_unpacker by replacing the key from Sonicomi and it extracts exactly the same videos, some play and some break off. I don't know what could be the matter, sorry.
Edited2*: So I found the reason why they break off. Extra 16 bytes are appended to the beginning of some decompressed chunks -> 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Ekey wrote:Edited2*: So I found the reason why they break off. Extra 16 bytes are appended to the beginning of some decompressed chunks -> 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
Code: Select all
encryption "cipherfinal aes_256_cbc" KEY IV
aluigi wrote:I know how to fix it.
It's the calling of DecryptFinal done by OpenSSL and it can be done in quickbms by simply using the DecryptFinal prefix (or cipherfinal) in front of the algorithm, for example:Code: Select all
encryption "cipherfinal aes_256_cbc" KEY IV
aluigi wrote:This is the edited script with automatic scanning of the keys:
http://aluigi.org/bms/sonicomi.bms
I didn't test it but I hope it works