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

Usage examples

//
// 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.");
}
//
// 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;

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

// 
// generate random value characters
// 
$myAutoItObfuscator->randomCharacters = 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.");
}
//
// 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.");
}

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

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.