Skip to main content

PySquashfsImage is a lightweight library for reading squashfs image files in Python. It provides a way to read squashfs images header and to retrieve encapsulated binaries. It is compatible with Python 2.6, 2.7 and Python 3.1+.

Installation

pip install PySquashfsImage

If you are using Python <= 3.2 and need LZMA decompression, install backports.lzma.

For LZ4 decompression, install lz4 (Python 3.7+).

For Zstandard decompression install zstandard (Python 3.7+).

Use as a library

List all elements in the image:

from PySquashfsImage import SquashFsImage

image = SquashFsImage('/path/to/my/image.img')
for item in image.root.find_all():
    print(item.name)
image.close()

Print all files and folder with human readable path:

from PySquashfsImage import SquashFsImage

image = SquashFsImage('/path/to/my/image.img')
for path in image.root.find_all_paths():
    print(path)
image.close()

Print only files:

from PySquashfsImage import SquashFsImage

image = SquashFsImage('/path/to/my/image.img')
for item in image.root.find_all():
    if not item.is_dir:
        print(item.path)
image.close()

Save the content of a file:

from PySquashfsImage import SquashFsImage

image = SquashFsImage('/path/to/my/image.img')
for item in image.root.find_all():
    if item.name == 'myfilename':
        with open('/tmp/' + item.name, 'wb') as f:
            print('Saving original ' + item.path + ' in /tmp/' + item.name)
            f.write(item.read_bytes())
image.close()

Use as a command

$ pysquashfsimage -h
usage: pysquashfsimage [-h] [-V] file paths [paths ...]

positional arguments:
  file           squashfs filesystem
  paths          directories or files to print information about

options:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit

For each path, if it is a directory it will print the mode and name of each contained file, with sizes and symlinks.

If a path is a file, print its content.

Example command:

$ pysquashfsimage myimage.img /bin /etc/passwd

Metadata

Release files for PySquashfsImage 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PySquashfsImage 0.8.0
File Size Uploaded Provenance Actions
PySquashfsImage-0.8.0.linux-x86_64.tar.gz 24.9 kB Without provenance Details for PySquashfsImage-0.8.0.linux-x86_64.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for PySquashfsImage 0.8.0
File Interpreter ABI Platform Actions
PySquashfsImage-0.8.0-py3.10.egg Legacy Egg format - - Details for PySquashfsImage-0.8.0-py3.10.egg
PySquashfsImage-0.8.0-py3-none-any.whl Python 3 none any Details for PySquashfsImage-0.8.0-py3-none-any.whl
PySquashfsImage-0.8.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for PySquashfsImage-0.8.0-py2.py3-none-any.whl

Total release size: 116.0 kB

Release files / PySquashfsImage-0.8.0.linux-x86_64.tar.gz

Download URL PySquashfsImage-0.8.0.linux-x86_64.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11ea98f54383905a31d3561b43843a5e6dd4a6e0fdf45cda668e8d20cbd27e90
BLAKE2b-256 checksum
How to use checksums
7f0d5f1a6b44c13029d7e6d7fc4f76709f69476e91c194e76c4ae1de34656558
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

Release files / PySquashfsImage-0.8.0-py3.10.egg

Download URL PySquashfsImage-0.8.0-py3.10.egg
Size 25.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
38eb86e3be72e02fdbbafdd3400af0f4f5ce3950bb79bd41b499e4d5ab341ba1
BLAKE2b-256 checksum
How to use checksums
6a1379efa2e75c275cebc9b9d715551db8dfcd988336d3e5ee285fc001fa708f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

Release files / PySquashfsImage-0.8.0-py3-none-any.whl

Download URL PySquashfsImage-0.8.0-py3-none-any.whl
Size 32.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
499c75ab18a398f160e624bef80040f3b4accdafd896ad3b77fc04eac202a2f0
BLAKE2b-256 checksum
How to use checksums
e01a3a41172a536b2de9adf4193a083e929e2d75df9c9a5a35254e7ed8807611
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

Release files / PySquashfsImage-0.8.0-py2.py3-none-any.whl

Download URL PySquashfsImage-0.8.0-py2.py3-none-any.whl
Size 33.2 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
49720c79bbc25e57ef79961963babf138feca1510fd89b708557358930b9d7e4
BLAKE2b-256 checksum
How to use checksums
1759bff4f87be6e32c2070f1d6ec9075b41c93cc6c5b664c0c9f9d3a9a66a9da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for PySquashfsImage 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page