AutoIt Obfuscator API Documentation

Automate AutoIt script source code obfuscation with a flexible Web API for software developers and programmers.

Description

You can use all of the features of AutoIt Obfuscator via our Web API interface. The Web API is based on POST requests and emits JSON encoded responses.

Installation

For faster deployment, the PHP installation package for the AutoIt Obfuscator Web API has been uploaded to the popular Packagist repository. The source code has also been published on Github:

Repository Language Installation Package Sources
Packagist Repository for Composer PHP

Run:

php composer.phar require --prefer-dist pelock/autoit-obfuscator "*"

or add the following to require section of your composer.json file

"pelock/autoit-obfuscator": "*"
Packagist GitHub
PyPI Repository for Python Python
pip install autoitobfuscator
PyPI GitHub

Usage examples

Obfuscate with default options

//
// include AutoIt Obfuscator class
//
use PELock\AutoItObfuscator;

//
// if you don't want to use Composer use include_once
//
//include_once "AutoItObfuscator.php";

//
// create AutoIt Obfuscator class instance (we are using our activation key)
//
$myAutoItObfuscator = new PELock\AutoItObfuscator("ABCD-ABCD-ABCD-ABCD");

//
// source code in AutoIt v3 format
//
$scriptSourceCode = 'ConsoleWrite("Hello World")';

//
// by default all options are enabled, both helper random numbers
// generation & obfuscation strategies, so we can just simply call:
//
$result = $myAutoItObfuscator->ObfuscateScriptSource($scriptSourceCode);

//
// it's also possible to pass script path instead of a string with the source e.g.
//
// $result = $myAutoItObfuscator->ObfuscateScriptFile("/path/to/script/source.au3");

//
// $result[] array holds the obfuscation results as well as other information
//
// $result["error"]         - error code
// $result["output"]        - obfuscated code
// $result["demo"]          - was it used in demo mode (invalid or empty activation key was used)
// $result["credits_left"]  - usage credits left after this operation
// $result["credits_total"] - total number of credits for this activation code
// $result["expired"]       - if this was the last usage credit for the activation key it will be set to true
//
if ($result !== false)
{
	// display obfuscated code
	if ($result["error"] === \PELock\AutoItObfuscator::ERROR_SUCCESS)
	{
		// format output code for HTML display
		echo "<pre>" . htmlentities($result["output"]) . "</pre>";
	}
	else
	{
		die("An error occurred, error code: " . $result["error"]);
	}
}
else
{
	die("Something unexpected happened while trying to obfuscate the code.");
}
#!/usr/bin/env python

###############################################################################
#
# AutoIt Obfuscator WebApi interface usage example.
#
# In this example we will obfuscate sample source with default options.
#
# Version        : v1.04
# Language       : Python
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

#
# include AutoIt Obfuscator module
#
from autoitobfuscator import AutoItObfuscator

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.autoitobfuscator import AutoItObfuscator

#
# create AutoIt Obfuscator class instance (we are using our activation key)
#
myAutoItObfuscator = AutoItObfuscator("ABCD-ABCD-ABCD-ABCD")

#
# source code in AutoIt v3 format
#
scriptSourceCode = 'ConsoleWrite("Hello World")'

#
# by default all options are enabled, both helper random numbers
# generation & obfuscation strategies, so we can just simply call:
#
result = myAutoItObfuscator.obfuscate_script_source(scriptSourceCode)

#
# it's also possible to pass script path instead of a string with the source e.g.
#
# result = myAutoItObfuscator.obfuscate_script_file("/path/to/script/source.au3")

#
# result[] array holds the obfuscation results as well as other information
#
# result["error"]         - error code
# result["output"]        - obfuscated code
# result["demo"]          - was it used in demo mode (invalid or empty activation key was used)
# result["credits_left"]  - usage credits left after this operation
# result["credits_total"] - total number of credits for this activation code
# result["expired"]       - if this was the last usage credit for the activation key it will be set to True
#
if result and "error" in result:

    # display obfuscated code
    if result["error"] == AutoItObfuscator.ERROR_SUCCESS:

        # format output code for HTML display
        print(result["output"])

    else:
        print(f'An error occurred, error code: {result["error"]}')

else:
    print("Something unexpected happen while trying to obfuscate the code.")

Customize obfuscation options

//
// include AutoIt Obfuscator class
//
use PELock\AutoItObfuscator;

//
// if you don't want to use Composer use include_once
//
//include_once "AutoItObfuscator.php";

//
// create AutoIt Obfuscator class instance (we are using our activation key)
//
$myAutoItObfuscator = new PELock\AutoItObfuscator("ABCD-ABCD-ABCD-ABCD");

// 
// should the source code be compressed while sending it and receiving from the server
// 
$myAutoItObfuscator->enableCompression = true;

//
// detect debuggers attached to the application process
//
$myAutoItObfuscator->antiDebug = true;

//
// detect popular virtual machines
//
$myAutoItObfuscator->antiVM = true;

//
// detect sandboxes
//
$myAutoItObfuscator->antiSandbox = true;

//
// detect CPU emulators
//
$myAutoItObfuscator->antiEmulator = true;

// 
// generate random integer values
// 
$myAutoItObfuscator->randomIntegers = true;

// 
// generate random value characters
// 
$myAutoItObfuscator->randomCharacters = true;

//
// generate random anti regular expression values
//
$myAutoItObfuscator->randomAntiRegex = true;

// 
// generate arrays with random values
// 
$myAutoItObfuscator->randomArrays = true;

// 
// generate multidimensional arrays with random values
// 
$myAutoItObfuscator->randomArraysMultidimensional = true;

// 
//  generate functions that return random values
// 
$myAutoItObfuscator->randomFunctions = true;

// 
// generate autostarted random values
// 
$myAutoItObfuscator->randomAutostarted = true;

//
// change linear code execution flow to nonlinear version
//
$myAutoItObfuscator->mixCodeFlow = true;

// 
// rename variable names to random string values
// 
$myAutoItObfuscator->renameVariables = true;

// 
// rename function names to random string values
// 
$myAutoItObfuscator->renameFunctions = true;

// 
// rename function names in function calls
// 
$myAutoItObfuscator->renameFunctionCalls = true;

//
//  shuffle order of functions in the output source
//
$myAutoItObfuscator->shuffleFunctions = true;

// 
// resolve WinApi constants to numerical values
// 
$myAutoItObfuscator->resolveConstants = true;

// 
// encrypt numbers into arithmetic and boolean expressions
// 
$myAutoItObfuscator->cryptNumbers = true;

// 
// split strings into series of random sized substrings
// 
$myAutoItObfuscator->splitStrings = true;

// 
// modify strings using built-it AutoIt string functions
// 
$myAutoItObfuscator->modifyStrings = true;

// 
// encrypt strings using polymorphic encryption algorithms
// 
$myAutoItObfuscator->cryptStrings = true;

// 
// insert ternary operators for numerical values
// 
$myAutoItObfuscator->insertTernaryOperators = true;

//
// source code in AutoIt v3 format
//
$scriptSourceCode = 'ConsoleWrite("Hello World")';

//
// by default all options are enabled, both helper random numbers
// generation & obfuscation strategies, so we can just simply call:
//
$result = $myAutoItObfuscator->ObfuscateScriptSource($scriptSourceCode);

//
// $result[] array holds the obfuscation results as well as other information
//
// $result["error"]         - error code
// $result["output"]        - obfuscated code
// $result["demo"]          - was it used in demo mode (invalid or empty activation key was used)
// $result["credits_left"]  - usage credits left after this operation
// $result["credits_total"] - total number of credits for this activation code
// $result["expired"]       - if this was the last usage credit for the activation key it will be set to true
//
if ($result !== false)
{
	// display obfuscated code
	if ($result["error"] === \PELock\AutoItObfuscator::ERROR_SUCCESS)
	{
		// format output code for HTML display
		echo "<pre>" . htmlentities($result["output"]) . "</pre>";
	}
	else
	{
		die("An error occurred, error code: " . $result["error"]);
	}
}
else
{
	die("Something unexpected happened while trying to obfuscate the code.");
}
#!/usr/bin/env python

###############################################################################
#
# AutoIt Obfuscator WebApi interface usage example.
#
# In this example we will obfuscate sample source with default options.
#
# Version        : v1.04
# Language       : Python
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

#
# include AutoIt Obfuscator module
#
from autoitobfuscator import AutoItObfuscator

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.autoitobfuscator import AutoItObfuscator

#
# create AutoIt Obfuscator class instance (we are using our activation key)
#
myAutoItObfuscator = AutoItObfuscator("ABCD-ABCD-ABCD-ABCD")

#
# should the source code be compressed (both input & compressed)
#
myAutoItObfuscator.enableCompression = True

#
# detect debuggers attached to the application process
#
myAutoItObfuscator.antiDebug = True

#
# detect popular virtual machines
#
myAutoItObfuscator.antiVM = True

#
# detect sandboxes
#
myAutoItObfuscator.antiSandbox = True

#
# detect CPU emulators
#
myAutoItObfuscator.antiEmulator = True

#
# generate random integer values
#
myAutoItObfuscator.randomIntegers = True

#
# generate random value characters
#
myAutoItObfuscator.randomCharacters = True

#
# generate random anti regular expression values
#
myAutoItObfuscator.randomAntiRegex = True

#
# generate arrays with random values
#
myAutoItObfuscator.randomArrays = True

#
# generate multidimensional arrays with random values
#
myAutoItObfuscator.randomArraysMultidimensional = True

#
# generate functions that returns random values
#
myAutoItObfuscator.randomFunctions = True

#
# generate autostarted random values
#
myAutoItObfuscator.randomAutostarted = True

#
# change linear code execution flow to nonlinear version
#
myAutoItObfuscator.mixCodeFlow = True

#
# rename variable names to random string values
#
myAutoItObfuscator.renameVariables = True

#
# rename function names to random string values
#
myAutoItObfuscator.renameFunctions = True

#
# rename function names in function calls
#
myAutoItObfuscator.renameFunctionCalls = True


#
# resolve WinApi constants to numerical values
#
myAutoItObfuscator.resolveConstants = True

#
# encrypt numbers into arithmetic and boolean expressions
#
myAutoItObfuscator.cryptNumbers = True

#
# split strings into series of random sized substrings
#
myAutoItObfuscator.splitStrings = True

#
# modify strings using built-it AutoIt string functions
#
myAutoItObfuscator.modifyStrings = True

#
# encrypt strings using polymorphic encryption algorithms
#
myAutoItObfuscator.cryptStrings = True

#
# insert ternary operators for numerical values
#
myAutoItObfuscator.insertTernaryOperators = True

#
# source code in AutoIt v3 format
#
scriptSourceCode = 'ConsoleWrite("Hello World")'

#
# by default all options are enabled, both helper random numbers
# generation & obfuscation strategies, so we can just simply call:
#
result = myAutoItObfuscator.obfuscate_script_source(scriptSourceCode)

#
# result[] array holds the obfuscation results as well as other information
#
# result["error"]         - error code
# result["output"]        - obfuscated code
# result["demo"]          - was it used in demo mode (invalid or empty activation key was used)
# result["credits_left"]  - usage credits left after this operation
# result["credits_total"] - total number of credits for this activation code
# result["expired"]       - if this was the last usage credit for the activation key it will be set to True
#
if result and "error" in result:

	# display obfuscated code
	if result["error"] == AutoItObfuscator.ERROR_SUCCESS:

		# format output code for HTML display
		print(result["output"])
	else:
		print(f'An error occurred, error code: {result["error"]}')

else:
	print("Something unexpected happen while trying to obfuscate the code.")

Validate activation key

//
// include AutoIt Obfuscator class
//
use PELock\AutoItObfuscator;

//
// if you don't want to use Composer use include_once
//
//include_once "AutoItObfuscator.php";

//
// create AutoIt Obfuscator class instance (we are using our activation key)
//
$myAutoItObfuscator = new PELock\AutoItObfuscator("ABCD-ABCD-ABCD-ABCD");

//
// login to the service
//
$result = $myAutoItObfuscator->Login();

//
// $result[] array holds the information about the license
//
// $result["demo"]          - is it a demo mode (invalid or empty activation key was used)
// $result["credits_left"]  - usage credits left after this operation
// $result["credits_total"] - total number of credits for this activation code
// $result["string_limit"]  - max. script size allowed (it's 1000 bytes for demo mode)
//
if ($result !== false)
{
	echo "Demo version status - " . ($result["demo"] ? "true" : "false") . "<br>";
	echo "Usage credits left - " . $result["credits_left"] . "<br>";
	echo "Total usage credits - " . $result["credits_total"] . "<br>";
	echo "Max. script size - " . $result["string_limit"] . "<br>";

}
else
{
	die("Something unexpected happened while trying to login to the service.");
}
#!/usr/bin/env python

###############################################################################
#
# AutoIt Obfuscator WebApi interface usage example.
#
# In this example we will verify our activation key status.
#
# Version        : v1.0
# Language       : Python
# Author         : Bartosz Wójcik
# Web page       : https://www.pelock.com
#
###############################################################################

#
# include AutoIt Obfuscator module
#
from autoitobfuscator import AutoItObfuscator

#
# if you don't want to use Python module, you can import directly from the file
#
#from pelock.autoitobfuscator import AutoItObfuscator

#
# create AutoIt Obfuscator class instance (we are using our activation key)
#
myAutoItObfuscator = AutoItObfuscator("ABCD-ABCD-ABCD-ABCD")

#
# login to the service
#
result = myAutoItObfuscator.login()

#
# result[] array holds the information about the license
#
# result["demo"]          - is it a demo mode (invalid or empty activation key was used)
# result["credits_left"]  - usage credits left after this operation
# result["credits_total"] - total number of credits for this activation code
# result["string_limit"]  - max. script size allowed (it's 1000 bytes for demo mode)
#
if result:

	print(f'Demo version status - {"True" if result["demo"] else "False"}')
	print(f'Usage credits left - {result["credits_left"]}')
	print(f'Total usage credits - {result["credits_total"]}')
	print(f'Max. script size - {result["string_limit"]}')

else:
	print("Something unexpected happen while trying to login to the service.")

Return values

$result["error"] [out]
Error code. One of the following:
Name Value Description
ERROR_SUCCESS 0 Everything went fine.
ERROR_INPUT_SIZE 1 Source code size is too big. Most probably you hit the demo mode limitation (1000 characters max.).
ERROR_INPUT 2 Malformed source code, check the syntax.
ERROR_PARSING 3 AutoIt source code parsing error.
ERROR_OBFUSCATION 4 AutoIt parsed code obfuscation error.
ERROR_OUTPUT 5 AutoIt error while generating output code.
$result["output"] [out, optional]
Obfuscated source code.
$result["demo"] [out]
Are we running in full or demo mode.
$result["credits_left"] [out]
Usage credits left for the provided activation code.
$result["credits_total"] [out]
Usage credits left for the provided activation code.
$result["expired"] [out, optional]
If set to true it means our activation code has expired (it was the last run).
$result["string_limit"] [out, optional]
Source code size limit for full & demo version.

Requirements

PHP Library AutoItObfuscator
Python 3 Module AutoItObfuscator

Questions?

If you would like to ask me about AutoIt Obfuscator, or something's not clear, mail me. I'll be happy to answer all of your questions.