Skip to main content

Compiler for binary code to be compiled into 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

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.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:

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.py help

✅ Run compiled code but do not save:

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.py True False my_binary.txt

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

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.py False True my_binary.txt output.py

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

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.py True True my_binary.txt output.py

❌ Missing arguments (will cause an error):

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.py True True

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


📂 Project Structure

📦 PyBinCompiler
 ┣ 📂 toolchain
 ┃ ┣ 📂 PyBinCompiler_v0.1
 ┃ ┃ ┣ 📜 PyBinCompiler_v0.1.py # Main compiler script
 ┃ ┃ ┣ 📜 PyBinCompiler Version 0.1 Standard # Binary Code Information
 ┣ 📂 build # Compiled Python files
 ┣ 📜 README.MD # Documentation

⚠️ 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, clone the repository:

git clone https://github.com/JohnYuPromptwSpace/PyBinCompiler

Run the compiler with:

python toolchain/PyBinCompiler_v0.1/PyBinCompiler_v0.1.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.3.tar.gz (4.9 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.3-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybincompiler-0.0.3.tar.gz
  • Upload date:
  • Size: 4.9 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.3.tar.gz
Algorithm Hash digest
SHA256 8b597a72736bd974897e283b73da1efaa42cfe922b47a7b072d3f0afbb9d697c
MD5 33b2a946d31c3904b3336e61aaa9f9f2
BLAKE2b-256 0a5e26dfc168ceace2655f783a965729ad5095f019d1b1d751fe24067b2112bf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybincompiler-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cc624791ad7865b3af402160e7ed7ccbe891fe4afa89a55d285a0611ca005a09
MD5 82b559a9e05e790ed0299c9c5c186502
BLAKE2b-256 17bf1f5f54b769b4237791833dede65fe6e545712b02486f9586d5dc6dff0f5e

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