Skip to main content

Recover Amiga XPK files, including files written through XFH

Project description

🗜️ xfh

xfh is a pure-Python library and command-line tool for recovering files compressed with the Amiga XPK system, including files written transparently through DiskExpander.

It requires Python 3.10 or newer and has no runtime dependencies.

Install

python -m pip install xfh

Help

xfh --help
xfh info --help
xfh verify --help
xfh unpack --help

You can also run the command as python -m xfh.

Use

Inspect a packed file:

xfh info packed-file

Verify that a file decompresses successfully without writing its contents:

xfh verify packed-file

Recover a file:

xfh unpack packed-file recovered-file

For an encrypted stream, xfh prompts securely for its password. In scripts, set XFH_PASSWORD; passwords are deliberately not accepted as command-line arguments because process listings can expose them.

Existing output files are not overwritten unless --force is supplied. Output is limited to 256 MiB by default; use --max-output-size to choose a different byte limit.

For a damaged stream, salvage mode writes the prefix recovered before the first failing chunk. It exits with status 4 when recovery is incomplete:

xfh unpack damaged-file recovered-prefix --salvage --report recovery.json

Keep the original packed file unchanged and validate salvaged output with tools appropriate for its file type.

Python

from pathlib import Path

import xfh

packed = Path("packed-file").read_bytes()
info = xfh.inspect(packed)
plain = xfh.decompress(packed)  # Add password="..." for an encrypted stream.

print(info.codec, len(plain))
Path("recovered-file").write_bytes(plain)

xfh.decompress_file() provides atomic, non-overwriting file output. xfh.Limits controls maximum output size and chunk count.

Supported codecs

xfh supports these XPK codec identifiers:

ACCA, ARTM, BLFH, BLZW, BZP2, CBR0, CBR1, CRM2, CRMS, CYB2, DLTA, DUKE, ELZX, ENCO, FAST, FBR2, FEAL, FRHT, FRLE, GZIP, HFMN, HUFF, IDEA, ILZR, IMPL, LHLB, LZBS, LZCB, LZW2, LZW3, LZW4, LZW5, MASH, NONE, NUID, NUKE, PPMQ, PWPK, RAKE, RDCN, RLEN, SASC, SDHC, SHID, SHR3, SHRI, SHSC, SLZ3, SLZX, SMPL, SQSH, TDCS, and ZENO.

CBR1 is an alias for CBR0; FRHT is an alias for RAKE. BLFH's packed and unpacked ECB, OFB, CFB, and CBC modes are decoded. Obsolete ciphers are included solely for recovery and must not be used to protect new data.

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

xfh-0.3.0.tar.gz (85.2 kB view details)

Uploaded Source

Built Distribution

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

xfh-0.3.0-py3-none-any.whl (64.7 kB view details)

Uploaded Python 3

File details

Details for the file xfh-0.3.0.tar.gz.

File metadata

  • Download URL: xfh-0.3.0.tar.gz
  • Upload date:
  • Size: 85.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for xfh-0.3.0.tar.gz
Algorithm Hash digest
SHA256 448d05e7f0203fe6b9a879e1d1b76cd3bf0de77cf754baf1b0b4bfb26b087e17
MD5 e79ef3b90c0c04faf0a5944890d9f69a
BLAKE2b-256 33db8e2321a953e9d2cf3b96619c929259278439bd6b8ffeec9834de0ec60e51

See more details on using hashes here.

File details

Details for the file xfh-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: xfh-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 64.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.10.20

File hashes

Hashes for xfh-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07e853dc53c982ce83ee1132dfe408b8e6ef2bb4bba27dd46db9bdea818304fc
MD5 06b08c2fcf68e573dd499664e8bc4462
BLAKE2b-256 4ac4809bab78703c1c24e2c9548ffb05faa275ff738d0dfda205b253f7f7434f

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