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.py <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.py help

✅ Run compiled code but do not save:

pybincompiler.py True False my_binary.txt

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

pybincompiler.py False True my_binary.txt output.py

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

pybincompiler.py True True my_binary.txt output.py

❌ Missing arguments (will cause an error):

pybincompiler.py 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.py 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-0.0.5.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-0.0.5-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybincompiler-0.0.5.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-0.0.5.tar.gz
Algorithm Hash digest
SHA256 b846b64d99e85eb5184a09933f32720ef7ffda2449ad7f3f0fa41c1c87bb8d6e
MD5 eebf0d1b83fd4dff5d7cbb9943b7867e
BLAKE2b-256 6f95c99813c0c056f47fdbae0f7a14df73365c8596dacd728c77febe0795ab00

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybincompiler-0.0.5-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-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 101c0cbed4f0934228676f4bfecd77a2df9d1b25f2fe5dca076e445b3c643568
MD5 1ec2fa118a4f66c8738fc27260307ce6
BLAKE2b-256 1903ecf8f8a7dd4d5ab1b137853ae5df0066e05703773d2ce2aead32dbc14abd

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