cpktools icon indicating copy to clipboard operation
cpktools copied to clipboard

"Unable to recognize frame" when trying to unpack

Open Luc45 opened this issue 6 years ago • 3 comments

Hi,

I'm trying to unpack this file: http://www.lucasbustamante.com.br/uploads/ftp/Loca_en_Main_0.cpk

However it's throwing the following error:

vagrant@homestead:~/dev/tmp/cpktools$ python cpkunpack.py ../Loca_en_Main_0.cpk
Read ../Loca_en_Main_0.cpk...
Traceback (most recent call last):
  File "cpkunpack.py", line 640, in <module>
    for frame in readframe(infile):
  File "cpkunpack.py", line 169, in readframe
    typename = identify(header)
  File "cpkunpack.py", line 54, in identify
    raise Exception('Unable to recognize frame for "%s"' % repr(header));
Exception: Unable to recognize frame for "'U\x98C\x01\x1a\x00\x00\x00./\x00\x00\x00\x00\x00\x00'"

I tried with --extract-unknown too:

vagrant@homestead:~/dev/tmp/cpktools$ python cpkunpack.py ../Loca_en_Main_0.cpk --extract-unknown
Read ../Loca_en_Main_0.cpk...
Traceback (most recent call last):
  File "cpkunpack.py", line 640, in <module>
    for frame in readframe(infile):
  File "cpkunpack.py", line 170, in readframe
    data = extract(typename, header, f)
  File "cpkunpack.py", line 149, in extract
    return func(header, f)
  File "cpkunpack.py", line 121, in extract_generic_from_tablelibrary
    row = lib.fromoffset(f.tell()) # lib is a global TableLibrary object, possibly incomplete
  File "cpkunpack.py", line 419, in fromoffset
    return Row(s[FRAME_TOC].utf, s.__OFFSET_ROW_MAP[offset])
KeyError: 'TOC'

And also setting the output dir with -o, but couldn't anyway.

Can you please let me know if this specific file is supported?

Thanks!

Luc45 avatar Dec 06 '18 00:12 Luc45

Similar error. File: partition_data_win_demo.cpk game: Danganronpa V3 Killing Harmony Demo (from Steam)

/h/d/v/S/s/c/D/d/win_demo ❯❯❯ python2 /tmp/cpktools/cpkunpack.py partition_data_win_demo.cpk                                                                                                                  ✘ 1 
Read partition_data_win_demo.cpk...
========================================================================================
Schema CpkHeader (CPK)
----------------------------------------------------------------------------------------
	56                 UpdateDateTime(0x00000011)
	16                       FileSize(0x00000020)
	56                  ContentOffset(0x00000029)
	56                    ContentSize(0x00000037)
	56                      TocOffset(0x00000043)
	56                        TocSize(0x0000004d)
	14                         TocCrc(0x00000055)
	16                     HtocOffset(0x0000005c)
	16                       HtocSize(0x00000067)
	56                     EtocOffset(0x00000070)
	56                       EtocSize(0x0000007b)
	16                     ItocOffset(0x00000084)
	16                       ItocSize(0x0000008f)
	14                        ItocCrc(0x00000098)
	16                     GtocOffset(0x000000a0)
	16                       GtocSize(0x000000ab)
	14                        GtocCrc(0x000000b4)
	16                    HgtocOffset(0x000000bc)
	16                      HgtocSize(0x000000c8)
	56              EnabledPackedSize(0x000000d2)
	56                EnabledDataSize(0x000000e4)
	16                  TotalDataSize(0x000000f4)
	14                           Tocs(0x00000102)
	54                          Files(0x00000107)
	54                         Groups(0x0000010d)
	54                          Attrs(0x00000114)
	14                     TotalFiles(0x0000011a)
	14                    Directories(0x00000125)
	14                        Updates(0x00000131)
	52                        Version(0x00000139)
	52                       Revision(0x00000141)
	52                          Align(0x0000014a)
	52                         Sorted(0x00000150)
	52                 EnableFileName(0x00000157)
	12                            EID(0x00000166)
	54                        CpkMode(0x0000016a)
	5a                          Tvers(0x00000172)
	1a                        Comment(0x00000178)
	54                          Codec(0x00000180)
	54                        DpkItoc(0x00000186)
	52                   EnableTocCrc(0x0000018e)
	52                  EnableFileCrc(0x0000019b)
	54                        CrcMode(0x000001a9)
	5b                       CrcTable(0x000001b1)
----------------------------------------------------------------------------------------
                UpdateDateTime 0x0000000000000001
                 ContentOffset 0x000000000000c000
                   ContentSize 0x000000006c304800
                     TocOffset 0x0000000000000800
                       TocSize 0x000000000000b4b8
                    EtocOffset 0x000000006c310800
                      EtocSize 0x0000000000003080
             EnabledPackedSize 0x00000000d8426c80
               EnabledDataSize 0x00000000d8426c80
                         Files 0x000003dd
                        Groups 0x00000000
                         Attrs 0x00000000
                       Version 0x0007
                      Revision 0x000e
                         Align 0x0800
                        Sorted 0x0001
                EnableFileName 0x0001
                       CpkMode 0x00000001
                         Tvers CPKMC2.49.32, DLL3.24.00(0x000001ba)
                         Codec 0x00000000
                       DpkItoc 0x00000000
                  EnableTocCrc 0x0000
                 EnableFileCrc 0x0000
                       CrcMode 0x00000000
                      CrcTable 0x00000000(0x00000000)
========================================================================================
Traceback (most recent call last):
  File "/tmp/cpktools/cpkunpack.py", line 640, in <module>
    for frame in readframe(infile):
  File "/tmp/cpktools/cpkunpack.py", line 169, in readframe
    typename = identify(header)
  File "/tmp/cpktools/cpkunpack.py", line 54, in identify
    raise Exception('Unable to recognize frame for "%s"' % repr(header));
Exception: Unable to recognize frame for "'\\\x01e\xc8\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'"

tuxayo avatar Mar 30 '20 14:03 tuxayo

Note that for the last example, the file is free and legal to obtain. So anyone can reproduce:

https://store.steampowered.com/app/589120/Danganronpa_V3_Killing_Harmony_Demo_Ver/

tuxayo avatar Mar 30 '20 14:03 tuxayo

workaround: I used CriPakTools with Wine. prebuilt version: https://github.com/esperknight/CriPakTools/tree/master/Build

So yes, this is bad in terms of security to blindly trust and binary from the internet.

My commands where

wine /tmp/CriPakTools/Build/CriPakTools.exe partition_data_win_demo.cpk ALL                                                                                                                               
wine /tmp/CriPakTools/Build/CriPakTools.exe partition_data_win_demo_us.cpk ALL                                                                                                                            
wine /tmp/CriPakTools/Build/CriPakTools.exe partition_resident_win_demo.cpk ALL                                                                                                                           

note: I had to accept installing Mono.

tuxayo avatar Mar 30 '20 15:03 tuxayo