Skip to content
Pavel Izosimov edited this page Nov 21, 2024 · 2 revisions

Multi-Version PYZ Builder

Welcome to the Multi-Version PYZ Builder wiki! This page provides comprehensive documentation and guidance on how to use the Multi-Version PYZ Builder Script to create a Universal Python Module optimized for cross-platform and multi-version compatibility.


Version: 1.3
© 2024 αβ.net (alphabetanet.com) - Alpha Beta Network. All Rights Reserved.


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 .pyz files 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 .pyc files 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 .pyc files, 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.


Key Features

  • Secure Code Sharing: Utilize advanced encryption and obfuscation methods to protect your Python code during transfer, ensuring secure code sharing.

  • Source Code Protection: Prevent unauthorized access to your code with multi-level protection mechanisms, enhancing source code protection.

  • Cross-Platform Compatibility: Maintain cross-platform functionality; the protected Python scripts can be executed on any operating system (Windows, macOS, Linux/Unix, and others) where Python 3.6+ is installed.

  • Multi-Version Support: Support multiple Python versions by bundling protected .pyc files for each targeted version, ensuring users can run your module regardless of their Python installation.

  • Integration with Code Protection Tools: Designed to work seamlessly with the Local Python Code Protector Script or similar tools, enhancing code security through code obfuscation in Python and encryption.


How It Works

  1. Prepare Protected .pyc Files: Use the Local Python Code Protector Script or any other code protection tool to generate protected .pyc files for each Python version you wish to support.

  2. Place Files Together: Place the multi_version_pyz_builder.py script and all the protected .pyc files in the same directory.

  3. Run the Script: Execute the multi_version_pyz_builder.py script, which will automatically generate a multi-version .pyz archive.

  4. Distribute the Universal Module: Share the single .pyz file with users, ensuring cross-platform and multi-version compatibility.

  5. Execution of the Module: The generated .pyz file automatically detects the Python version at runtime and executes the appropriate protected .pyc file.


Getting Started

Prerequisites

  • Python 3.6+ installed on your system.

  • Protected .pyc Files for each Python version you wish to support.

Installation

Clone the repository and navigate to the project directory:

git clone https://github.com/alphabetanetcom/multi-version-pyz-builder.git

cd multi-version-pyz-builder

Alternatively, download the multi_version_pyz_builder.py script directly to your local machine.

Installing Required Packages

The script requires the following Python packages:

  • requests

  • psutil

  • cryptography

  • astor

Install them using pip:

pip install requests psutil cryptography 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.


Usage

The Multi-Version PYZ Builder Script provides the following main functionalities:

  • Bundling Multiple Protected .pyc Files: Combines multiple .pyc files, each corresponding to a different Python version, into a single .pyz archive.

  • Automatic Python Version Detection: The generated .pyz file automatically detects the Python version at runtime and executes the appropriate protected .pyc file.

  • Integration with Code Protection Tools: Designed to work seamlessly with protected .pyc files generated by the Local Python Code Protector Script or similar tools, enhancing code security.

Command Syntax

python multi_version_pyz_builder.py

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.py

Repeat 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.py

Step 4: Output

  • The script will generate a .pyz file for each module found. For example, if your module is named my_module, the output will be my_module.pyz.

  • The script will display messages indicating the progress and successful creation of the .pyz file.

Step 5: 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 6: Running the Universal Module

Users can execute the module using:

python my_module.pyz

Additional Features

Integration with Code Protection Tools

The Multi-Version PYZ Builder Script is designed to work seamlessly with the Local Python Code Protector Script. By integrating protected .pyc files generated from code obfuscation and encryption tools, you enhance the security of your distributed modules.

Secure Code Sharing

Facilitates secure code distribution without exposing the original source code. This aligns with Python code security best practices, ensuring your intellectual property remains protected.


Usage Examples

Basic Usage

Assuming you have prepared the protected .pyc files for different Python versions:

  1. Place the Script and .pyc Files Together: Ensure that the multi_version_pyz_builder.py script and your protected .pyc files are in the same directory.

  2. Run the Script:

    python multi_version_pyz_builder.py
  3. Output:

    • The script will generate a .pyz file for each module found.

Example with All Features

Enhance the security of your code by adding multiple layers of protection:

  1. Protect Your Scripts Multiple Times: Use the Local Python Code Protector Script to protect your code multiple times.

    python local_python_code_protector.py -f my_module.py
    python local_python_code_protector.py -f Local_Protected/my_module.pyc
  2. Generate Protected .pyc Files for Each Python Version.

  3. Use Multi-Version PYZ Builder: Integrate the protected .pyc files into a single .pyz archive.


Application Areas

The Multi-Version PYZ Builder can be effectively applied in the following areas:

  • Secure Code Sharing: Safely distribute Python modules without exposing the source code, implementing advanced Python code protection tools.

  • Cross-Platform Distribution: Provide users with a universal module that works across various operating systems and Python versions, ensuring cross-platform compatibility.

  • Collaborative Development: Share protected code with colleagues or team members while ensuring code security.

  • Python Code Encryption: Enhance code security through multiple layers of code obfuscation in Python and encryption.


Security and Best Practices

By implementing Python secure code transfer protocols and combining it with the Local Python Code Protector Script, the Multi-Version PYZ Builder helps to keep code better protected during distribution. This approach aligns with Python code security best practices.

End-to-End Encryption

Utilize end-to-end encryption to ensure that code remains encrypted from the moment it leaves your system until it is executed by the end-user.

Code Obfuscation

Incorporate code obfuscation techniques to make the code difficult to understand and reverse-engineer, adding an extra layer of security.


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 .pyc file before using them with the Multi-Version PYZ Builder. This adds additional layers of protection through obfuscation and encryption.

  • Ensure Version Compatibility: Generate protected .pyc files for all Python versions you intend to support. This guarantees that your module will run seamlessly across different environments.

  • Test Thoroughly: Before distributing the universal .pyz file, test it on different operating systems and Python versions to confirm functionality and compatibility.

  • Follow Naming Conventions: Adhere strictly to the naming conventions for .pyc files 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.


Licensing

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.md file.


Contact Information

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.


Note: This wiki page is intended to provide comprehensive documentation for the Multi-Version PYZ Builder Script. For more detailed explanations, examples, and additional resources, please refer to the README.md file.


Keywords: secure code sharing, source code protection, python code, code obfuscation in python, python code encryption, share python code securely, python code protection tools, python secure code transfer, code security best practices, cross-platform compatibility, multi-version support, code protection.


Appendix A: Installation of Required Packages

The multi_version_pyz_builder.py script requires the following Python packages:

  • requests

  • psutil

  • cryptography

  • astor

Installing Packages with pip

You can install these packages using the following command:

pip install requests psutil cryptography 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, activate it before installing the packages.


Appendix B: Real-World Example - Universal Python Module with Multi-Version Compatibility

In this appendix, we present a real-world example of using the Multi-Version PYZ Builder Script to create a secure, cross-platform, and multi-version compatible Python module.

B.1 Overview

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.

B.2 Construction of the Universal Module

B.2.1 Protected .pyc Files

Eight 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)

B.2.2 Using Multi-Version PYZ Builder

The integration of these files into a single .pyz archive was achieved using the Multi-Version PYZ Builder.

Steps:

  1. Place Files in the Same Directory:

    • Ensure that all the system_hardware_id_generator_python*.pyc files and multi_version_pyz_builder.py are in the same directory.
  2. Run the Multi-Version PYZ Builder Script:

    python multi_version_pyz_builder.py
  3. Output:

    • The script generates system_hardware_id_generator.pyz.

B.3 Using the Universal Module

To generate the Hardware ID (HWID) on any supported platform:

  1. Execute the .pyz file:

    python system_hardware_id_generator.pyz
  2. The module will display the HWID:

    Your Hardware ID (HWID) is: 123456789012345678
    

Notes:

  • Ensures secure code execution without exposing the original source code.

  • Compatible with multiple Python versions, making it an ideal solution for environments with varied Python installations.

B.4 Advantages of Using a Universal .pyz File

  • Secure Code Sharing: The source code is deeply protected from analysis and recovery, ensuring high levels of Python code security and code obfuscation.

  • Simplified Distribution: Only one .pyz file needs to be distributed, regardless of the Python version or operating system of the end-user.

  • Enhanced Protection: By using pre-compiled and protected versions of the code, it adds an extra layer of security against decompilation and unauthorized access.


Appendix C: 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 .pyc file before using them with the Multi-Version PYZ Builder.

  • Ensure Version Compatibility: Generate protected .pyc files for all Python versions you intend to support.

  • Test Thoroughly: Before distributing the universal .pyz file, test it on different operating systems and Python versions.

  • Maintain Secure Code Practices: Combine this approach with other Python code security best practices.


For more information about our Alpha Beta Network project, please visit αβ.net.


© 2024 αβ.net (alphabetanet.com) - Alpha Beta Network. All Rights Reserved.