Skip to main content

libphpphar

A port of PHP's Phar class, in pure python

Installation

pip install libphpphar (not available yet)

Features

  • Phar generation with python, no more annoying phar.readonly = Off
  • uses libphpserialize for metadata serialization

Example

from datetime import datetime
from io import BytesIO
from phpphar import Phar, PharIOPhar
from phpserialize import PHP_Class

# for (un)serializing the metadatas
class VulnerableObject(PHP_Class):
    pass

with open("app.phar", "rb") as f:
    original = f.read()

archive: Phar = Phar.from_bytes(original)
# simply `archive = Phar()` if you want to start from scratch
print(archive.metadata)
for entry in archive.entries:
    print(f'{entry.permissions}\t{entry.size}\t{datetime.fromtimestamp(entry.timestamp)}\t{entry.name}')
output = bytes(archive)
assert original == output

Important

  • the code is written and tested under python 3.9+

Metadata

Release files for libphpphar 0.0.2

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

Source distribution (sdist)

Source distribution for libphpphar 0.0.2
File Size Uploaded Provenance Actions
libphpphar-0.0.2.tar.gz 5.5 kB Without provenance Details for libphpphar-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libphpphar 0.0.2
File Interpreter ABI Platform Actions
libphpphar-0.0.2-py3-none-any.whl Python 3 none any Details for libphpphar-0.0.2-py3-none-any.whl

Total release size: 12.2 kB

Release files / libphpphar-0.0.2.tar.gz

Download URL libphpphar-0.0.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d56a3dfbe76ef1174fe7020603e17d90ab3fcd2b525e42b628828273ea4004a0
BLAKE2b-256 checksum
How to use checksums
b81cfd49a9a8f66bb4928289d6e06b29d8a66fddb09a0e218a2efa515c114728
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / libphpphar-0.0.2-py3-none-any.whl

Download URL libphpphar-0.0.2-py3-none-any.whl
Size 6.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1075c179231d2ad1dd28ff72b27a8056f4eb9483a5ac79538336fad9044e23b3
BLAKE2b-256 checksum
How to use checksums
a222b8199a4ebea6143c56779b646c5506c076c491bdbd0129c2c2286c582617
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Security for libphpphar 0.0.2

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