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

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.4.tar.gz (4.8 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.4-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pybincompiler-0.0.4.tar.gz
  • Upload date:
  • Size: 4.8 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.4.tar.gz
Algorithm Hash digest
SHA256 a679af1fdb88d328733860b4d6f8e68d5ad0e3d8237b1e6776e2158e77f6eb42
MD5 543dace45171bd4e857874f3b92b99d8
BLAKE2b-256 93bbd3a3188e69d71cecde8f46b80c39d3b39f1a6184110b459207ce77b3b58b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pybincompiler-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 801a079eff0ba3c93871bf1f811d2a2aa028e9485259a47875a5af4e26dad62b
MD5 a8a42a461c8d09eb47cad214dd60d357
BLAKE2b-256 5a98790bf882a94ffa51d45518adb77c59d18f7b9c03a95c9df3318ec22ee34f

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