Releases: alphabetanetcom/multi-version-pyz-builder
Multi-Version PYZ Builder v1.3.1-beta.1
feat: add Python App Bundle Shield integration
- Add support for standalone application creation
- Implement cross-platform executable packaging
- Enable secure distribution features
- Integrate with Python App Bundle Shield protection mechanisms
Multi-Version PYZ Builder Script v1.3-beta.1
Multi-Version PYZ Builder Script v1.3-beta.1
Multi-Version PYZ Builder Script Documentation
Version: 1.3
© 2024 αβ.net (alphabetanet.com) - Alpha Beta Network. All Rights Reserved.
Note: This project is currently in Beta Testing and available for free.
Table of Contents
- 1. Introduction
- 2. Installation
- 3. Main Functions of the Script
- 4. Detailed Description of Operation
- 5. Usage Examples
- 6. Recommendations and Best Practices
- Appendix A: Installation of Required Packages
- Appendix B: Real-World Example - Universal Python Module with Multi-Version Compatibility
- Appendix C: Contact Information
1. Introduction
The Multi-Version PYZ Builder Script is a command-line tool designed to create a Universal Python Module optimized for cross-platform and multi-version compatibility. It allows developers to bundle multiple protected .pyc files—each corresponding to a different Python version—into a single .pyz archive. This approach significantly enhances Python code security by using previously compiled and protected versions of code, making it more difficult for others to reverse-engineer or analyze the source code.
Key features of the script include:
-
Cross-Platform Compatibility: The generated
.pyzfiles can be executed on any operating system where Python 3.6+ is installed, including Windows, macOS, and Linux/Unix systems. -
Multi-Version Support: Supports multiple Python versions by including protected
.pycfiles for each targeted Python version. Automatically detects the current Python interpreter version at runtime and executes the corresponding code. -
Enhanced Code Protection: Integrates with the Local Python Code Protector Script or any other protection tool to use previously compiled and protected
.pycfiles, adding layers of code obfuscation and encryption. -
Secure Code Sharing: Facilitates secure code distribution without exposing the original source code, aligning with Python code security best practices.
This tool is ideal for developers who need to distribute their Python modules securely across different platforms and Python versions while maintaining a high level of code protection.
2. Installation
Before using the Multi-Version PYZ Builder Script, ensure that you have Python 3.6+ installed on your system.
2.1 Installing Required Packages
The script requires the following Python packages:
-
requests
-
psutil
-
cryptography
-
astor
You can install them using pip:
pip install requests psutil cryptography astorEnsure 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.
Note: The script automatically checks for required packages and installs them if they are missing.
3. Main Functions of the Script
The Multi-Version PYZ Builder Script provides the following functionalities:
-
Bundling Multiple Protected
.pycFiles: Combines multiple.pycfiles, each corresponding to a different Python version, into a single.pyzarchive. -
Automatic Python Version Detection: The generated
.pyzfile automatically detects the Python version at runtime and executes the appropriate protected.pycfile. -
Integration with Code Protection Tools: Designed to work seamlessly with protected
.pycfiles generated by the Local Python Code Protector Script or similar tools, enhancing code security through obfuscation and encryption.
4. Detailed Description of Operation
4.1 Prerequisites
To use the Multi-Version PYZ Builder Script effectively, you need:
-
Protected
.pycFiles: Compiled and protected.pycfiles for each Python version you wish to support. These can be generated using the Local Python Code Protector Script. -
Naming Convention: The naming convention for the
.pycfiles should follow this pattern:module_name_python36.pyc (for Python 3.6) module_name_python37.pyc (for Python 3.7) module_name_python38.pyc (for Python 3.8) module_name_python39.pyc (for Python 3.9) module_name_python310.pyc (for Python 3.10) module_name_python311.pyc (for Python 3.11) module_name_python312.pyc (for Python 3.12) module_name_python313.pyc (for Python 3.13) -
Script Placement: Place the
multi_version_pyz_builder.pyscript in the same directory as the compiled.pycfiles.
4.2 How the Script Works
-
Scans for Protected
.pycFiles: The script searches the current directory for all.pycfiles that match the naming pattern. -
Groups Files by Module Name: Files are grouped based on their base module names.
-
Generates a Multi-Version
__main__.py: For each module, the script generates a__main__.pyfile that contains code to detect the Python version at runtime and execute the corresponding.pycfile. -
Creates the
.pyzArchive: Packages the__main__.pyand the protected.pycfiles into a single.pyzarchive using Python'szipappmodule. -
Outputs the Universal Module: The resulting
.pyzfile is a universal Python module that can be executed on different platforms and Python versions.
5. Usage Examples
5.1 Basic Usage
Assuming you have prepared the protected .pyc files for different Python versions, follow these steps:
-
Place the Script and
.pycFiles Together: Ensure that themulti_version_pyz_builder.pyscript and your protected.pycfiles are in the same directory. -
Run the Script:
python multi_version_pyz_builder.py
-
Output:
-
The script will generate a
.pyzfile for each module found. For example, if your module is namedmy_module, the output will bemy_module.pyz. -
The script will display messages indicating the progress and successful creation of the
.pyzfile.
-
5.2 Example with Detailed Steps
Step 1: Prepare Protected .pyc Files
Use the Local Python Code Protector Script to generate protected .pyc files for your module for each desired Python version.
# Example for Python 3.6
python local_python_code_protector.py -f my_module.pyRepeat the process for other Python versions, adjusting as necessary (e.g., using virtual environments with different Python versions).
Step 2: Place Files in the Same Directory
Ensure that all the my_module_python*.pyc files and multi_version_pyz_builder.py are in the same directory.
Step 3: Run the Multi-Version PYZ Builder Script
python multi_version_pyz_builder.pyStep 4: Distribute the my_module.pyz File
The generated my_module.pyz file can now be distributed and executed on any platform with Python 3.6+.
Step 5: Running the Universal Module
Users can execute the module using:
python my_module.pyz6. Recommendations and Best Practices
-
Enhance Protection with Multiple Layers: To strengthen the security of your code, consider applying the Local Python Code Protector Script multiple times to each
.pycfile before using them with the Multi-Version PYZ Builder. This adds additional layers of protection through obfuscation and encryption. -
Ensure Version Compatibility: Generate protected
.pycfiles for all Python versions you intend to support. This guarantees that your module will run seamlessly across different environments, adhering to cross-platform compatibility. -
Test Thoroughly: Before distributing the universal
.pyzfile, test it on different operating systems and Python versions to confirm functionality and compatibility. -
Follow Naming Conventions: Adhere strictly to the naming conventions for
.pycfiles to ensure that the script correctly identifies and packages them. -
Maintain Secure Code Practices: Combine this approach with other Python code security best practices to maximize protection and ensure the integrity of your code.
Appendix A: Installation of Required Packages
The multi_version_pyz_builder.py script requires the following Python packages:
- *...