Skip to main content

纯 Python 零依赖 Electron ASAR 归档解包工具 | Pure-Python CLI tool for Electron ASAR archives

Project description

ASAR Tool · Electron 归档文件解包工具

纯 Python、零依赖的命令行工具。无需安装 Node.js,即可查看、列出、搜索和提取 Electron ASAR 归档文件。支持 Linux、macOS、Windows。

A pure-Python, zero-dependency CLI tool to inspect, list, search, and extract Electron ASAR archives. Works on Linux, macOS, and Windows — no Node.js required.

Features

  • Cross-platform — parses the binary format directly, no Electron or Node.js needed
  • Zero dependencies — only the Python standard library
  • Supports both formats — standard ASAR and integrity-protected archives
  • Command-line interface with subcommands for common tasks
  • Python API for programmatic use
  • Handles large archives (tested with 98MB+ files)

Installation

pip install git+https://github.com/songshiyu777/asar-tool.git

Or clone and install locally:

git clone https://github.com/songshiyu777/asar-tool.git
cd asar-tool
pip install -e .

Quick Start

# Overview of an ASAR archive
asar-tool info app.asar

# List all files
asar-tool list app.asar

# List with file sizes
asar-tool list --long app.asar

# Search for files by name
asar-tool search main app.asar

# Filter file listing by pattern
asar-tool list --pattern "*.js" app.asar

# Extract everything
asar-tool extract app.asar -o output/

# Extract a single file
asar-tool extract app.asar dist-electron/main/index.js -o output/

# Print a file to stdout
asar-tool cat app.asar package.json

Example output

$ asar-tool info app.asar

File         : app.asar
Archive size : 93.7 MB
Files        : 8,720
Unpacked size: 198.5 MB
Integrity    : yes
  Algorithm  : SHA256
  Hash       : a1b2c3d4e5f6...
  Block size : 4.0 MB
  Blocks     : 48
$ asar-tool list --long app.asar | head -10

     Size  Path
--------------------------------------------------------------------------------
 166.6 KB  dist-electron/main/index.js
    414 B  dist-electron/preload/couponPreload.js
    2.3 KB  dist-electron/preload/index.js
   2.2 MB  node_modules/electron-log/...
    ...
$ asar-tool search keygen app.asar | head -5

3 matches:
    3.2 KB  EXTRA/node_modules/asarmor/scripts/keygen.js
    8.1 KB  EXTRA/node_modules/electron-updater/out/providers/KeygenProvider.js
      ...

Python API

from asar_tool import AsarParser

with AsarParser("app.asar") as asar:
    # Archive info
    info = asar.get_info()
    print(f"Files: {info.file_count}, Integrity: {info.has_integrity}")

    # List all files
    for entry in asar.list_files():
        print(f"{entry.size:>10,d}  {entry.path}")

    # Read a single file
    package_json = asar.read_file("package.json")

    # Search for files
    for f in asar.search("main"):
        print(f"Found: {f.path}")

    # Extract everything
    asar.extract_all("output/")

    # Extract a specific file
    asar.extract("dist-electron/main/index.js", "output/")

License

MIT — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asar_tool-0.1.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asar_tool-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file asar_tool-0.1.0.tar.gz.

File metadata

  • Download URL: asar_tool-0.1.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for asar_tool-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a53dbf2b279293d729cc574f1946fc4c271e94eba62ac2765c89297619db1c05
MD5 7b36fc9dd20cfa6f8f769de25c443690
BLAKE2b-256 3e67ba804812b4ab5ea735cedf7008368ed5a387061c10e2b9704f1c9f0c6fdf

See more details on using hashes here.

File details

Details for the file asar_tool-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: asar_tool-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for asar_tool-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7b07d1158436023a118840b432af9ffffc1b78380b224da930d755b74662d99a
MD5 8d374f61407bfaa3c34b4dd7717dced6
BLAKE2b-256 00b107237abc072ad4a2818e2cf6836d9760c59f7ec6613d7aff59bfbd347f25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page