GitHunt
AM

AmitDas4321/SafeCode

SafeCode is a Python-based encryption tool that protects your scripts by converting them into an unreadable format. It compiles, serializes, compresses, and encodes your code, securing it from unauthorized access and reverse-engineering with an easy-to-use command-line interface.

SafeCode Encryption Script ๐Ÿ”

Hero_image

Overview

SafeCode is a Python-based encryption tool designed to securely encrypt your Python scripts. It ensures that your code remains safe from unauthorized access and protects intellectual property by converting scripts into an unreadable format. The encryption process involves compiling the script to bytecode, serializing it, and then compressing and encoding the bytecode, making it challenging for anyone to reverse-engineer your code.

Why Use SafeCode ๐Ÿš€

SafeCode is essential for developers who want to protect their Python code, especially when sharing or distributing it. Here are some reasons why you should use SafeCode:

  • Protect Intellectual Property ๐Ÿ’ผ: Safeguard your Python code from being copied or tampered with.
  • Prevent Unauthorized Access ๐Ÿšซ: Encrypt your script to ensure only authorized users can access and run it.
  • Easy to Use ๐Ÿ‘: The encryption process is simple, and it integrates seamlessly with your workflow, offering a command-line interface for easy interaction.

Follow these steps to clone the repository and set up the environment:

1. Clone the repository ๐Ÿ–ฅ๏ธ

Clone the SafeCode repository to your local machine using:

git clone https://github.com/AmitDas4321/SafeCode.git

2. Install dependencies ๐Ÿ“ฆ

Navigate into the cloned repository and install the required dependencies:

cd SafeCode && python3 setup.py install

This will install all the necessary dependencies.

๐Ÿ“ท Screenshots

Here are some screenshots of the script in action:

1๏ธโƒฃ Running the script and Encrypt code

Running the script

2๏ธโƒฃ Encrypted script is saved

Encrypyed Script

Usage ๐Ÿ”ง

Once the installation is complete, you can use the safeCode.py script to encrypt your Python files.

1. Running the Script โ–ถ๏ธ

To start the script, simply run:

python3 setup.py

2. How to Use the Script ๐Ÿ“

  • The script will guide you with commands in a restricted shell.
    • Type ls to list the files in the current directory.
    • Type cd <directory> to change directories.
    • Type the name of the Python script you want to encrypt (e.g., script.py).
    • The script will be encrypted and saved as encrypted_<script_name>.py in the default directory (usually your Desktop).

3. Encryption Process ๐Ÿ”

The encryption works by:

  • Reading the Python script file you specify.
  • Compiling the script to bytecode.
  • Serializing the bytecode using marshal.
  • Compressing the serialized bytecode with zlib.
  • Encoding the compressed bytecode with base64.

The encrypted script is saved in the format encrypted_<script_name>.py.

4. Example ๐Ÿ’ก

For example, if you want to encrypt a Python script called example.py, you will:

  • Run the script with python3 setup.py
  • Select example.py when prompted.
  • The encrypted script will be saved as encrypted_example.py on your Desktop.

Features โœจ

  • Secure Encryption: ๐Ÿ”’ Ensures that only valid requests will trigger encryption.
  • Interactive Shell: ๐Ÿ’ป Provides an interactive shell where users can manage directories and files.
  • Base64, zlib, and marshal: ๐Ÿ” Uses these techniques for encryption, ensuring a secure and compact output.

Contributing ๐Ÿค

Contributions are welcome! If you'd like to contribute to the project, please fork the repository, make changes, and submit a pull request. โœจ