Skip to main content

Compiler for binary code to Python

Project description

🏗️ PyBinCompiler

PyBinCompiler is a binary-to-Python compiler that translates binary-encoded text into executable Python scripts. It allows users to run compiled code directly or save it as a Python file.

📌 Features

  • ✅ Convert binary-encoded text into Python source code.
  • Run compiled code instantly.
  • Save compiled Python code as a .py file.
  • Error handling for missing or invalid arguments.
  • ✅ Supports custom file naming for output.

🚀 Usage

Command Format

pybincompiler <run?> <make file?> <TargetFileName>.txt <FileName>.py

Arguments:

Argument Type Description
<run?> bool If True, executes the compiled code immediately. If False, the code is not executed.
<make file?> bool If True, saves the compiled code as a .py file. If False, no file is created.
<TargetFileName>.txt str The name of the text file containing binary code.
<FileName>.py str (optional) The name of the output Python file (if <make file?> is True). Defaults to "untitled.py" if not specified.

🔹 Example Usage

✅ Explanation:

pybincompiler help

✅ Run compiled code but do not save:

pybincompiler True False my_binary.txt

✅ Save compiled code as a .py file but do not run:

pybincompiler False True my_binary.txt output.py

✅ Run compiled code and save it as a .py file:

pybincompiler True True my_binary.txt output.py

❌ Missing arguments (will cause an error):

pybincompiler True True

Error: "Missing file argument. Please provide a valid .txt file."


⚠️ Exception Handling

PyBinCompiler includes built-in exception handling for various cases:

Exception Condition
InvalidRunOptionError <run?> must be True or False.
InvalidMakeFileOptionError <make file?> must be True or False.
MissingFileError No input .txt file provided.
PathNotFoundError The specified file path does not exist.
InvalidKeywordError The binary code contains an invalid sequence.
LengthValidationError Binary code length is not a multiple of 7.

🛠 Installation

To use PyBinCompiler, use pip to install:

pip install pybincompiler

Run the compiler with:

pybincompiler True True test.txt output.py

🤝 Contributing

We welcome contributions! To contribute:

  1. Fork the repository.
  2. Create a new branch (feature-branch).
  3. Commit your changes (git commit -m "Added new feature").
  4. Push to your fork (git push origin feature-branch).
  5. Open a Pull Request!0

📜 License

This project is licensed under the MIT License

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

pybincompiler-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

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

pybincompiler-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pybincompiler-1.0.0.tar.gz.

File metadata

  • Download URL: pybincompiler-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for pybincompiler-1.0.0.tar.gz
Algorithm Hash digest
SHA256 60e56f5ab65c7cda47ef058a57f54e637a31e87bc912bbd52e330d4f7fd84741
MD5 4ad3233ce7c33cccec2ffd4550eea40e
BLAKE2b-256 f3059fb4629d880746ff84b418f39892c147a254ce50b7658884980984e61f9c

See more details on using hashes here.

File details

Details for the file pybincompiler-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pybincompiler-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for pybincompiler-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c23049b87acbb5b4b1d94481d95665016fd9443bc0d685ddd3b239036994eb1
MD5 492733b37436ed87e632ec7d86b9d260
BLAKE2b-256 fce7c98b5c5718d3d1e6adfc77afb093190bc4abe3f74f15b4306525e85e5b93

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