像chrome那样解压.crx文件
crx-unpack的Python项目详细描述
此模块包含几个用于处理google chrome扩展文件(crxs)的实用程序,这些文件具有*.crx 文件扩展名。这个项目的目标是尽可能地模仿google chrome的功能 这些扩展已解包并安装。
文档
请在Read the Docs上查看此项目的完整文档。
CRX包格式的结构
本节介绍了crx文件的结构和内容。
见https://developer.chrome.com/extensions/crx
包头
头包含作者的公钥和扩展的签名。签名是从zip文件生成的 使用sha-1和作者的私钥。报头需要一个4字节对齐的小尾数字节顺序。这个 下表按顺序描述.crx头的字段:
Field | Type | Length | Value | Description |
---|---|---|---|---|
magic number | char[] | 32 bits | Cr24 | Chrome requires this constant at the beginning of every ^{tt3}$ package. |
version | unsigned int | 32 bits | 2 | The version of the ^{tt1}$ file format used (currently 2). |
public key length | unsigned int | 32 bits | pubkey.length | The length of the RSA public key in bytes. |
signature length | unsigned int | 32 bits | sig.length | The length of the signature in bytes. |
public key | byte[] | pubkey.length | pubkey.contents | The contents of the author’s RSA public key formatted as an X509 SubjectPublicKeyInfo block. |
signature | byte[] | sig.length | sig.contents | The signature of the ZIP content using the author’s private key. The signature is created using the RSA algorithm with the SHA-1 hash function. |
扩展内容
扩展名的zip文件追加到头后的*.crx包中。这个zip文件应该和 头中的签名是从中生成的。