Welcome to the Local Python Code Protector! This powerful command-line tool enables developers to protect and secure their Python code through advanced encryption and obfuscation techniques. It supports both Python source files (.py
) and compiled Python files (.pyc
), offering flexible options for source code protection.
Whether you're sharing code with clients, collaborating with colleagues, or deploying applications on servers, the Local Python Code Protector ensures your intellectual property remains secure, aligning with Python code security best practices.
Version: 1.2 © 2024 αβ.net (alphabetanet.com) - Alpha Beta Network. All Rights Reserved.
The Local Python Code Protector provides the following main functionalities:
.py
) by applying multi-level encryption and obfuscation techniques..pyc
) using unique recompilation technology.Clone the repository and navigate to the project directory:
git clone https://github.com/alphabetanetcom/local-python-code-protector.git
cd local-python-code-protector
Alternatively, download the local_python_code_protector.py
script directly to your local machine.
The script requires the following Python packages:
Install them using pip
:
pip install requests psutil cryptography decompyle3 xdis astor
Ensure that you are using the correct version of pip
associated with your Python 3 installation. If you are using a virtual environment, activate it before installing the packages.
The Local Python Code Protector provides the following main functionalities:
Protect and obfuscate Python source files (.py
) by applying multi-level encryption and obfuscation techniques.
Command Syntax:
python local_python_code_protector.py -f FILE_PATH [OPTIONS]
Parameters:
-f FILE_PATH
or --file FILE_PATH
: (Required) Specifies the path to the Python source file to protect.-d DEVICES
or --device DEVICES
: (Optional) A comma-separated list of hardware IDs (HWIDs) to restrict code execution to specific devices.-e DATE
or --expiration DATE
: (Optional) Sets an expiration date in YYYY-MM-DD
format.-m MESSAGE
or --message MESSAGE
: (Optional) A custom message to display when the protected code is executed.Example:
python local_python_code_protector.py -f my_script.py
Protect compiled Python files (.pyc
) using unique recompilation technology to enhance security.
Command Syntax:
python local_python_code_protector.py -f FILE_PATH [OPTIONS]
The parameters are the same as for source files.
Example:
python local_python_code_protector.py -f my_script.pyc
Restrict code execution to specific devices by specifying their hardware IDs (HWIDs).
Parameter:
-d DEVICES
or --device DEVICES
: A comma-separated list of HWIDs.Example:
python local_python_code_protector.py -f my_script.py -d 123456789012345678,987654321098765432
Set an expiration date for the protected code. After this date, the code will not run.
Parameter:
-e DATE
or --expiration DATE
: The expiration date in YYYY-MM-DD
format.Example:
python local_python_code_protector.py -f my_script.py -e 2024-01-01
Add a custom message that will be displayed when the protected code is executed.
Parameter:
-m MESSAGE
or --message MESSAGE
: The custom message text.Example:
python local_python_code_protector.py -f my_script.py -m "This is a licensed instance. Unauthorized use is prohibited."
Obfuscate a Python source file without any additional restrictions.
python local_python_code_protector.py -f my_script.py
The protected file will be saved in the Local_Protected
directory as a compiled .pyc
file.
Restrict the execution of the protected code to specific devices.
python local_python_code_protector.py -f my_script.py -d 123456789012345678,987654321098765432
Only devices with the specified HWIDs can execute the protected code.
Set an expiration date for the protected code.
python local_python_code_protector.py -f my_script.py -e 2024-01-01
After January 1, 2024, the code will not run.
Combine device restrictions, expiration date, and a custom message.
python local_python_code_protector.py -f my_script.py -d 123456789012345678 -e 2024-01-01 -m "License valid until 2024-01-01."
The code will only run on the device with HWID 123456789012345678
and before January 1, 2024.
To restrict code execution to specific devices, you need to obtain the hardware IDs (HWIDs) of those devices. Use the system_hardware_id_generator.py
script to generate the HWID.
python system_hardware_id_generator.py
Your Hardware ID (HWID) is: 123456789012345678
Use this HWID with the -d
or --device
parameter when obfuscating your code.
The Local Python Code Protector can be effectively applied in the following areas:
By implementing Python secure code transfer protocols, the Alpha Beta Network strives to keep code better protected during transmission. This commitment to security extends to various aspects of the platform, aiming to improve Python code security best practices.
While no system can guarantee absolute security, the Local Python Code Protector represents an effort to empower developers to share their code with increased confidence, significantly enhancing security with new solutions that we implement.
The Local Python Code Protector can also be effectively used to further protect licensed source code files created by the Alpha Beta Network cloud platform, such as Python Obfuscator Online and Secure Python Code Manager Script.
If you experience issues or have questions not covered in this documentation, please contact the Alpha Beta Network Research Team.
Stay connected to receive updates, provide feedback, and get early access to extended functionality.
This project is currently in Beta Testing and available for free.
License Agreement
© 2024 αβ.net (alphabetanet.com) - Alpha Beta Network. All Rights Reserved.
For detailed license information, please refer to the License Agreement file.
The local_python_code_protector.py
script requires the following Python packages:
You can install these packages using the following command:
pip install requests psutil cryptography decompyle3 xdis astor
Ensure that you are using the correct version of pip
associated with your Python 3 installation. If you are working within a virtual environment, make sure it is activated before installing the packages.
To restrict code execution to specific devices, you need to obtain the Hardware ID (HWID) of those devices. Use the system_hardware_id_generator.py
script to generate the HWID.
python system_hardware_id_generator.py
Your Hardware ID (HWID) is: 123456789012345678
-d
or --device
parameter when obfuscating your code.The HWID serves as a unique identifier for the device's hardware components, ensuring that the protected code can only be executed on authorized devices [[1]].
In this appendix, we present a real-world example of applying the Local Python Code Protector Script to create a secure, cross-platform, and multi-version compatible Python module.
The file system_hardware_id_generator.pyz
is a universal Python module that encapsulates multiple protected .pyc
files, each corresponding to a different Python version. It is optimized for cross-platform and multi-version compatibility, automatically detecting the current Python interpreter version and executing the appropriate protected module.
.pyc
FilesEight protected .pyc
files were generated for different Python versions using the Local Python Code Protector Script. The protection process was applied twice to each file to strengthen the security.
Protected files:
system_hardware_id_generator_python36.pyc
(Python 3.6)system_hardware_id_generator_python37.pyc
(Python 3.7)system_hardware_id_generator_python38.pyc
(Python 3.8)system_hardware_id_generator_python39.pyc
(Python 3.9)system_hardware_id_generator_python310.pyc
(Python 3.10)system_hardware_id_generator_python311.pyc
(Python 3.11)system_hardware_id_generator_python312.pyc
(Python 3.12)system_hardware_id_generator_python313.pyc
(Python 3.13)The integration of these files into a single .pyz
archive was achieved using the Multi-Version PYZ Builder, a software solution that leverages Alpha Beta Network technologies.
Key Features:
.pyc
file corresponding to the detected Python version.To generate the Hardware ID (HWID) on any supported platform:
.pyz
file:python system_hardware_id_generator.pyz
Your Hardware ID (HWID) is: 123456789012345678
Notes:
To create a similar universal Python module for your protected scripts:
.py
files for each Python version you wish to support..pyc
files into a single .pyz
archive using the Multi-Version PYZ Builder..pyz
File: Share the universal .pyz
file with your users, ensuring they can run it on their platform and Python version without additional configurations.Benefits:
The use of a universal .pyz
file exemplifies advanced techniques in source code protection and secure code sharing. By leveraging the Local Python Code Protector Script and the Multi-Version PYZ Builder, developers can create robust, secure, and versatile Python modules suitable for distribution across diverse environments.
You can find the official repositories for this tool at the following links: