Skip to content

xwfe/crx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRX Tool

A command-line tool for working with Chrome extension files (.crx) built with Rust. This tool allows you to convert Chrome extensions between CRX and ZIP formats, download extensions directly from the Chrome Web Store, and more.

Version License Rust

Features

  • Convert Chrome extension files (.crx) to ZIP format
  • Generate download URLs for Chrome extensions by ID
  • Download Chrome extensions directly from the Chrome Web Store
  • Option to convert downloaded extensions to ZIP format automatically
  • Support for both CRX version 2 and 3 formats
  • Verbose logging options for debugging

Installation

From Source

  1. Ensure you have Rust and Cargo installed (rust-lang.org/tools/install)
  2. Clone this repository
  3. Build the project:
cd crx
cargo build --release
  1. The binary will be available at target/release/crx
  2. Optionally, move it to your PATH:
sudo cp target/release/crx /usr/local/bin/

Usage

Quick Start

# Convert a CRX file to ZIP
crx convert extension.crx

# Get download URL for an extension
crx fetch-url --id gighmmpiobklfepjocnamgkkbiglidom

# Download and convert an extension in one step
crx download --id gighmmpiobklfepjocnamgkkbiglidom --out-zip extension.zip

Converting a CRX File to ZIP Format

crx convert path/to/extension.crx

This will convert the CRX file to a ZIP file in the same directory, keeping the same base filename.

To specify a custom output path:

crx convert path/to/extension.crx --output custom/output/path.zip

Generating a Download URL for a Chrome Extension

crx fetch-url --id gighmmpiobklfepjocnamgkkbiglidom

Replace gighmmpiobklfepjocnamgkkbiglidom with the ID of the extension you want to download.

Downloading a Chrome Extension

crx download --id gighmmpiobklfepjocnamgkkbiglidom

To save the CRX file:

crx download --id gighmmpiobklfepjocnamgkkbiglidom --out-crx path/to/save.crx

To download and convert to ZIP in one step:

crx download --id gighmmpiobklfepjocnamgkkbiglidom --out-zip path/to/save.zip

Verbose Output

Add -v or -vv for more detailed logging:

crx convert path/to/extension.crx -v

Help

For detailed help on any command, use:

crx --help
crx convert --help
crx fetch-url --help
crx download --help

Use Cases

  • Development: Extract and modify Chrome extensions for development or learning purposes
  • Security Analysis: Extract extensions for security auditing and code inspection
  • Backup: Save extensions locally in case they are removed from the Chrome Web Store
  • Deployment: Convert between formats for testing and deployment workflows
  • Automation: Include in scripts for batch processing of extensions

Technical Details

The tool supports both CRX version 2 and 3 formats, extracting the ZIP data from the CRX container file. Chrome extensions are essentially ZIP archives with a special CRX header and signature, which this tool can process and strip away.

How It Works

  1. For CRX files, the tool:

    • Verifies the CRX magic number ("Cr24")
    • Determines the CRX format version
    • Extracts header data, public keys, and signatures
    • Extracts the raw ZIP data from the appropriate offset
    • Saves the ZIP data to a new file
  2. For downloading extensions, the tool:

    • Constructs the Chrome Web Store download URL using the extension ID
    • Downloads the CRX file
    • Optionally converts the downloaded CRX to ZIP format

Requirements

  • Rust 1.63 or newer

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Feel free to submit issues or pull requests.

Acknowledgements

  • The Rust community for providing excellent libraries and tools
  • Chrome Extension developers for inspiring this tool
  • All contributors and testers who helped improve this project

Frequently Asked Questions

What is a CRX file?

A CRX file is a Chrome extension package format. It's essentially a ZIP file with additional metadata and signatures that Chrome uses to verify the extension's authenticity.

Why convert CRX to ZIP?

Converting a CRX to ZIP allows you to inspect the extension's code, modify it for personal use, or learn from it. It's also useful for security researchers analyzing extensions.

Is this legal to use?

Yes, this tool is legal for personal use, development, and research purposes. However, redistributing modified extensions or bypassing security measures may violate Chrome Web Store terms or copyright laws.

Can I convert a ZIP back to CRX?

This version of the tool doesn't support converting ZIP back to a signed CRX, as this would require private keys used by the original developer.

Why does the download fail for some extensions?

Some extensions may be region-restricted, not publicly available, or have been removed from the Chrome Web Store.

About

A command-line tool for convert Chrome extension files (.crx) to zip

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages