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 ๐
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.git2. Install dependencies ๐ฆ
Navigate into the cloned repository and install the required dependencies:
cd SafeCode && python3 setup.py installThis will install all the necessary dependencies.
๐ท Screenshots
Here are some screenshots of the script in action:
1๏ธโฃ Running the script and Encrypt code
2๏ธโฃ Encrypted script is saved
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.py2. How to Use the Script ๐
- The script will guide you with commands in a restricted shell.
- Type
lsto 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>.pyin the default directory (usually your Desktop).
- Type
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.pywhen prompted. - The encrypted script will be saved as
encrypted_example.pyon 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. โจ


