AutoIt Obfuscator Dokumentacja API — Ochrona Skryptów AutoIt

Zautomatyzuj proces obfuskacji kodów źródłowych skryptów AutoIt wykorzystując dedykowany interfejs Web API AutoIt Obfuscatora.

Opis

Możesz skorzystać ze wszystkich opcji AutoIt Obfuscatora poprzez interfejs Web API. Web API bazuje na prostym zapytaniu POST i odpowiedzi zakodowanej w postaci JSON.

Instalacja

W celu szybszego wdrożenia, paczka instalacyjna interfejsu Web API AutoIt Obfuscatora dla PHP została wgrana na popularne repozytorium Packagist, a kody źródłowe zostały dodatkowo opublikowane na GitHubie:

Repozytorium Język Instalacja Paczka Źródła
Repozytorium Packagist dla PHP i Composera PHP

Uruchom komendę:

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

lub dodaj do sekcji require w pliku konfiguracyjnym composer.json wpis:

"pelock/autoit-obfuscator": "*"
Packagist GitHub
Repozytorium PyPI dla Pythona i pip Python
pip install autoitobfuscator
PyPI GitHub

Przykłady użycia

Obfuskacja z domyślnymi ustawieniami

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

#
# 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.")

Obfuskacja z własnymi ustawieniami

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

#
# should the source code be compressed (both input & compressed)
#
myAutoItObfuscator.enableCompression = 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.")

Sprawdzanie klucza aktywacyjnego

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

Zwracane wartości

$result["error"] [wyj]
Kod błędu. Jeden z poniższych:
Nazwa Wartość Opis
ERROR_SUCCESS 0 Wszystko się udało..
ERROR_INPUT_SIZE 1 Kod źródłowy jest zbyt duży. Najczęściej zwracana wartość w przypadku działania w trybie demo (limit 1000 znaków).
ERROR_INPUT 2 Uszkodzony wejściowy kod źródłowy, sprawdź składnię.
ERROR_PARSING 3 Błąd parsowania kodu źródłowego AutoIt.
ERROR_OBFUSCATION 4 Błąd obfuskacji sparsowanego już kodu źródłowego.
ERROR_OUTPUT 5 Błąd podczas generowania zobfuskowanego kodu wyjściowego.
$result["output"] [wyj, opcjonalnie]
Wyjściowy kod źródłowy poddany obfuskacji.
$result["demo"] [wyj]
Flaga oznaczająca czy to wersja pełna czy demo.
$result["credits_left"] [wyj]
Pozostała ilość kredytów użycia dla przypisanego kodu aktywacyjnego.
$result["credits_total"] [wyj]
Całkowita ilość kredytów dla przypisanego kodu aktywacyjnego.
$result["expired"] [wyj, opcjonalnie]
Jeśli ustawiona na true oznacza to, że kod aktywacyjny wygasł (było to jego ostatnie wykorzystanie).
$result["string_limit"] [wyj, opcjonalnie]
Maksymalny dozwolony rozmiar wejściowego kodu źródłowego dla wersji pełnej i demo.

Wymagania

Biblioteka PHP AutoItObfuscator
Moduł dla Pythona 3 AutoItObfuscator

Masz pytania?

Jeśli masz jakieś pytania dotyczące programu AutoIt Obfuscator, masz jakieś uwagi, coś jest niejasne, napisz do mnie, chętnie odpowiem na każde Twoje pytanie.