Skip to main content

Obfuscate a python code 2.x and 3.x

Project description

Intensio-Obfuscator

PyPI Version

What is this ?

  • Intensio-Obfsucator tool takes a python source code and transform it into an obfuscated python code
    • Replace all names of variables/classes/functions/files-name to random strings with length defined then all chars to their hexadecimal value
    • Delete all comments, all spaces lines
    • Padding random snippets code/functions/classes with an always differents values

What purpose ?

  • Provides a high level obfuscation layer to prevent or delay the reading and understanding of your python program

Level of obfuscation

  • Weak obfuscation if used alone, can be used with other types of obfuscation

Requirements

  • Python >= 3.5
  • requirements.txt

Files supported

  • Files written in python 2.x and 3.x

Installation

  • From source
$ git clone https://github.com/Hnfull/Intensio-Obfuscator.git
$ python3 -m pip install -r Intensio-Obfuscator/requirements.txt
$ cd Intensio-Obfuscator/src/intensio_obfuscator
$ python3 intensio_obfuscator.py --help
  • From python package
$ pip install intensio-obfuscator
$ ./intensio_obfuscator --help

Features

Features Descriptions Purpose of obfuscation Compatibility with all types of python codes/syntaxes
Delete comments Delete all comments (this feature is executed by default) Delete potential behavioral informations high python files 2 & 3
Delete line spaces Delete all spaces line (this feature is executed by default) Reduce the code visibility in clear high python files 2 & 3
Correction padding empty classes/functions Add padding to empty classes and functions, if the class or function contains comments only, the default feature Delete comments can potentially let a class or function empty, this will avoid to generate an error (this feature is executed by default) None, only to avoid to generate errors high python files 2 & 3
Replace string to string mixed Replace all names of variables/classes/functions to random strings with length defined Reduce the code visibility in clear - Delay the deduction of the behavior of variables/classes/functions low - high (depends of number of names that must exclude or not) python files 2 & 3
Exclude words file to exclude word (check documentation for the format) only for 'replace file name' obfuscation feature Information not required Information not required
Padding script Add padding of random scripts after each line Reduce the code visibility in clear - add dead snippets code/classes/functions to blur and delay behavior analysis of program high python file 2 & 3
Replace files name Replace all files name to random strings with length defined Reduce the code visibility in clear - Reduce the deduction of functionnalities of files low python files 2 & 3
Exclude file names file to exclude file names (check documentation for the format) only for 'replace file name' obfuscation feature Information not required Information not required
Replace string to hex Replace all chars to their hexadecimal value Reduce the code visibility in clear / avoid to be detected by the 'grep' commands per example medium python files 2 only
Correction delete pyc file Delete all pyc file in output directory (this feature is executed by default) Delete files already compiled without having been obfuscated before high python files 2 & 3
Mixer length lower Define random strings length of 32 chars when -rts, --replacetostr or -ps, --paddingscripts or -rfn, --replacefilesname or -rth, --replacetohex parameters are specified The longer the length is used, the more difficult the visibility of the code Information not required
Mixer length medium Define random strings length of 64 chars when -rts, --replacetostr or -ps, --paddingscripts or -rfn, --replacefilesname or -rth, --replacetohex parameters are specified The longer the length is used, the more difficult the visibility of the code Information not required
Mixer length high Define random strings length of 128 chars when -rts, --replacetostr or -ps, --paddingscripts or -rfn, --replacefilesname or -rth, --replacetohex parameters are specified The longer the length is used, the more difficult the visibility of the code Information not required
  • Features can be executed separatly:
    • replace string to string mixed -> -rts, --replacetostr
    • padding script -> -ps, --paddingscript
    • replace file name -> -rfn, --replacefilename
    • replace string to hex -> -rth, --replacetohex

Usages

Parameters Descriptions
-h, --help show this help message and exit
-i, --input source directory - indicate a directory that contain your file
-o, --output output directory that will be obfuscated - indicate a empty directory that will contain your file
-mlen, --mixerlength define length of random strings generated [lower:32|medium:64|high:128] chars when --replacetostr or --paddingscripts or -rfn, --replacefilesname or --replacetohex features are specified, possible values: [lower|medium|high]
-ind, --indent indicate the indentation of your python source code, possible values: [2|4|8]
-rts, --replacetostr enable replace string to string mixed obfuscation feature
--excludewords file to exclude specific words (check documentation for the format) only for -rts, --replacetostr obfuscation feature
-ps, --paddingscript enable padding script obfuscation feature
-rfn, --replacefilename enable replace file name obfuscation feature
--excludefiles file to exclude file name (check documentation for the format) only for -rfn, --replacefilename obfuscation feature
-rth, --replacetohex enable replace string to hex obfuscation (python files 2 only)
-v, --verbose improve verbosity

Obfuscation examples

Todo

  • Version 1.x.x-x:
    • Code optimization
    • Fix issues
    • Improved features already present
    • Add other functionalities

License

  • MIT

Contact

Disclamer

  • Intensio-Obfuscator is for education/research purposes only. The author takes NO responsibility ay for how you choose to use any of the tools provided

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

intensio_obfuscator-1.0.10.1.tar.gz (404.8 kB view details)

Uploaded Source

Built Distribution

intensio_obfuscator-1.0.10.1-py3-none-any.whl (448.9 kB view details)

Uploaded Python 3

File details

Details for the file intensio_obfuscator-1.0.10.1.tar.gz.

File metadata

  • Download URL: intensio_obfuscator-1.0.10.1.tar.gz
  • Upload date:
  • Size: 404.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for intensio_obfuscator-1.0.10.1.tar.gz
Algorithm Hash digest
SHA256 bdf252ac22411ed1f302e054b53e1202e2c46cf9f4206744b695200ce8b50b97
MD5 c26b61d845fd4f703ec4cbd6c67809ff
BLAKE2b-256 d7f08fa7ecc563dbfe31ac2f0509080fd0b83b7438ae0de9a10eaf1b7b5e323c

See more details on using hashes here.

File details

Details for the file intensio_obfuscator-1.0.10.1-py3-none-any.whl.

File metadata

  • Download URL: intensio_obfuscator-1.0.10.1-py3-none-any.whl
  • Upload date:
  • Size: 448.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9

File hashes

Hashes for intensio_obfuscator-1.0.10.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5192eabdfe016b3355e47b0e9489ba68661e0bcc274aae07dc7217ab7bea60f5
MD5 c643e4f66f4c91cabc9646c9cd763161
BLAKE2b-256 964eb65c86a49ba8bbc8c2ac6a43f4f5bec0678126bb914e2ed3041a38337ebf

See more details on using hashes here.

Supported by

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