Skip to main content

A module for encoding and encrypting data.

Project description

Encodify - Python Code Encoding Module

encodify is a powerful Python module designed to provide a suite of advanced encoding techniques for Python scripts. These encoding methods encompass compression, base64 encoding, and XOR encryption, allowing users to obfuscate code for enhanced security or distribution.

Table of Contents

Installation

To integrate encodify into your project, you can use pip:

pip install encodify

Usage

Importing the Module

To employ the functionalities of encodify, import the Encodify class from the module:

from encodify import Encodify

Creating an Encoder Instance

Instantiate the Encodify class to access a wide array of encoding techniques:

encoder = Encodify()

Encoding Specific Code

encodify excels at encoding specific Python code snippets. For instance, utilizing the m1 encoding method:

code_to_encode = "print('Hello, World!')"
encoded_code = encoder.m1(code_to_encode)

Generating Random Payload

For a dynamically selected encoding method, use the random_payload method. It produces a randomized payload, increasing the level of code obfuscation:

random_payload = encoder.random_payload("print('Hello, World!')", 2)

Generating Payload with a Specific Encoding Method

Tailor the encoding method to your requirements with the gen_payload method. Specify the method number to achieve the desired encoding:

# Choose the encoding method (e.g., m2)
chosen_encoding_method = 2
payload = encoder.gen_payload(chosen_encoding_method, "print('Hello, World!')")

Additional Customization

encodify offers extensive customization options. These include string replacements and appending/prepending custom code to the encoded output, allowing for fine-tuned control over the obfuscation process.

Args for gen_payload Function

The gen_payload function accepts the following arguments:

  • choice (int): The chosen encoding technique, determining the applied encoding method. Refer to the module documentation for a complete list of available choices.

  • data (str): The Python code to be encoded.

  • line (int, optional): The number of lines for line-based encoding (default is 2). This argument is applicable for specific encoding methods.

  • options (dict, optional): Further customization options (default is None). This may encompass string replacements or the addition of custom code.

Available Encoding Methods

+------+---------------------------------------------------+
|  No  |           Encoding Method Description            |
+------+---------------------------------------------------+
|  1   |              m1: Gzip + Marshal + Base64          |
|  2   |          m2: LZMA + Base64 + Marshal              |
|  3   |         m3: LZMA + Base85 + Marshal               |
|  4   |              m4: LZMA + Marshal                   |
|  5   |          m5: Base64 + LZMA + Marshal              |
|  6   |       m6: LZMA + Zlib + Marshal + Base64         |
|  7   |     m7: LZMA + Gzip + Marshal + Base64           |
|  8   |              m8: LZMA + Marshal                   |
|  9   |       m9: Base64 + Gzip + Marshal + Base64        |
|  10  |      m10: Base64 + Gzip + Marshal + LZMA          |
|  11  |     m11: Base64 + Gzip + Marshal + Base64         |
|  20  |     m20: Minify + Base64 + Gzip + Marshal         |
|  23  |      l1: Line-based Encoding with Base85          |
|  24  |  l2: Line-based Encoding with Base85 + LZMA       |
|  25  |  l25: Line-based Encoding with Base64 + LZMA      |
|  26  | l26: Line-based Encoding with Base64 + Codecs     |
|  27  |  l27: Line-based Encoding with XOR Encryption     |
|  28  | l28: Line-based Encoding with Base64 + XOR        |
|  29  | l29: Line-based Encoding with Base64 + XOR        |
|  30  | l30: Line-based Encoding with XOR + Codecs        |
+------+---------------------------------------------------+

Advanced Techniques

encodify offers an array of advanced encoding techniques. These include line-based encoding, various combinations of compression, and XOR encryption. For in-depth guidance on these techniques, refer to the module's extensive documentation.

Examples

Explore some advanced examples showcasing the versatility of encodify:

from encodify import Encodify

# Create an instance of Encodify
encoder = Encodify()

# Encode specific code using the m1 method
code_to_encode = "print('Hello, World!')"
encoded_code = encoder.m1(code_to_encode)

# Generate a random payload with a random encoding method
random_payload = encoder.random_payload("print('Hello, World!')", 2)

# Generate a payload with a specific encoding method (e.g., m2)
chosen_encoding_method = 2
payload = encoder.gen_payload(chosen_encoding_method, "print('Hello, World!')")

# Additional customization can be done using options

Best Practices and Considerations

  1. Use Responsibly: This module is primarily intended for educational purposes. Use it responsibly and within the boundaries of applicable laws and ethical guidelines.

  2. Testing and Verification: Always test the encoded code to ensure it functions as expected.

  3. Documentation: Document the encoding method used and keep a record for future reference.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

encodify-1.0.2.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file encodify-1.0.2.tar.gz.

File metadata

  • Download URL: encodify-1.0.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.5

File hashes

Hashes for encodify-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9230c6df8da47e5aac731dee71792b5bd0b39b5cb296c86d6d11e547c710e4a5
MD5 948eed7e212057b359b98944039376f4
BLAKE2b-256 7312604dae0e88052af8e9dade8bbd0891367086ce8391ed98633a867d452a64

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page