sourceprotected
Encrypt Python source files and decrypt them on the fly during runtime.
Usage
Installation
Using pip:
pip install sourceprotected
Encrypting the source files
sourceprotected path/to/src(.py)
Using key: fHC79...
Using encryption time: 1694...
Decrypt during runtime
With sourceprotected installed in your current environment, you can run/import encrypted files/modules as long as the SOURCEPROTECTED_KEY environment variable is set:
encrypted.py:
# -*- coding: sourceprotected -*-
-----BEGIN SOURCEPROTECTED FILE-----
gAAAAABk-eJaJarzMWy70GTRkRi6kjaD-zJy
-fHX_0G5VHTZjEKxJUvFhVWfWpX_j3LydmJo
pn7YrAj5CSqqPWgxUY_dSk5ELA==
-----END SOURCEPROTECTED FILE-----
main.py:
import encrypted # Will decrypt encrypted.py on the fly.
Finally:
SOURCEPROTECTED_KEY=Bk92p... python -B main.py
How does it work?
sourceprotected uses a custom codec that will decrypt the file content using the SOURCEPROTECTED_KEY environment variable.
This codec is registered on startup by using a .pth file.
Credits goes to https://github.com/asottile-archive/future-fstrings for the implementation idea.
Metadata
Release files for sourceprotected 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sourceprotected-0.1.0.tar.gz | 6.0 kB | Without provenance | Details for sourceprotected-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sourceprotected-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sourceprotected-0.1.0-py3-none-any.whl |
Total release size: 12.1 kB
Release files / sourceprotected-0.1.0.tar.gz
| Download URL | sourceprotected-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4cf6e6277e06c9990abdf6cb0572757cbb3f8ac3b75f77b9d8d1fa99f1830bb
|
|
BLAKE2b-256 checksum How to use checksums |
ab5b5d8aa6559f085201141aa04ae59a4fbc045d500cea3a5d8aede508f26a79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / sourceprotected-0.1.0-py3-none-any.whl
| Download URL | sourceprotected-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
767867a731012903f18ac2fad3f5e2c64c90a4fe94a42b7bbb1cfe1f58968678
|
|
BLAKE2b-256 checksum How to use checksums |
1b6b707ee600a5d3fcaf5a2cbb3aac7ea035d76ccce52a35516eb307432e6ed5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for sourceprotected 0.1.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.