how to unpack resources.pak from google chrome?

前端 未结 3 1528
有刺的猬
有刺的猬 2020-12-07 19:22

There are bunch of interesting files accessible via chrome://resources/* using google chrome.

On linux That the content is in /opt/google/chrome/r

相关标签:
3条回答
  • 2020-12-07 19:51

    I found resource.pak V5 has a new format:

    struct header {
        // 5 is the latest version
        uint32_t version;
        // 0 = BINARY, 1 = UTF8, 2 = UTF16
        uint8_t encoding;
        // 3 bytes padding
        uint8_t padding[3];
        uint16_t resource_count;
        uint16_t alias_count;
    };
    

    Which is followed by resource_count resources, and alias_count aliases.

    struct resource {
        uint16_t resource_id;
        uint32_t file_offset;
    };
    
    struct alias {
        uint16_t resource_id;
        uint16_t entry_index;
    };
    

    Where uint32_t = 4 bytes, uint16_t = 2 bytes, uint8_t = 1, all little endian integers.

    The source is available at https://github.com/chromium/chromium/blob/master/ui/base/resource/data_pack.cc.

    0 讨论(0)
  • 2020-12-07 19:55

    taken from https://groups.google.com/a/chromium.org/forum/?fromgroups=#!topic/chromium-dev/agGjTt4Dmcw

    4 byte version number
    4 byte number of resources
    1 byte encoding

    For each resource:
    2 byte resource id
    4 byte resource offset in file

    There is an extra resource entry at the end with ID 0 giving the end of the last resource (which is essentially the length of the file)

    This python module can unpack and repack files:
    data_pack.py from grit-i18n

    0 讨论(0)
  • 2020-12-07 20:01

    The chrome-pak-customizer (pointed out by MrU in the comments above) seems to work well to unpack Chrome's .pak files. If you're on Windows, you can download and unzip chrome-pak.7z from the releases page. Then drop the .pak file on the unpack.bat script to unpack it.

    For other platforms, it looks like you'll need to build the tool from the source.

    0 讨论(0)
提交回复
热议问题