CodeCrypter - Encrypt your Script
CodeCrypter enables you to encrypt scripts without placing the key inside the script.
This is because this key is extracted from the user environment at runtime by, for example:
password user query
any macro (e.g., @username)
any AutoIt function call
any UDF call
some permanent environment variable on a specific machine (and not created by your script)
a server response
a device response
anything else you can think of, as long as it's not stored in the script
any combination of the above
You need several scripts to get this to work, and they are scattered over several threads, so here's a single bundle that contains them all (including a patched version of Ward's AES.au3; with many thanks to Ward for allowing me to include this script here):
Note: if you experience issues under Win8/8.1 (as some users have reported), please upgrade to Win10 (or use WIn7) if you can; as far as I can tell, the scripts in the bundle all work under Win7 & Win10 (and XP). Moreover, I have no access to a Win8 box, so these issues will not be fixed, at least not by yours truly.
How the bits and pieces fit together:
CodeCrypter is a front-end for the MCF UDF library (you need version 1.3 or later). Its thread is here:
'?do=embed' frameborder='0' data-embedContent>>
The MCF package (also contained in the CodeScannerCrypter bundle) contains MCF.au3 (the library itself) plus a little include file called MCFinclude.au3. The latter you have to include in any script you wish to encrypt. Any code preceding it will not be encrypted, any code following it will be encrypted. You define the dynamic key inside MCFinclude.au3, in the UDF: _MCFCC_Init().
From the same post you can download an MCF Tutorial which I heartily recommend, because encrypting a script requires a number of steps in the right order, namely:
In MCFinclude.au3, define and/or choose your dynamic key(s) (skip this step = use default setting)
include MCFinclude.au3 in your target script
Run CodeScanner (version 2.3+) on your target script, with setting WriteMetaCode=True (see '?do=embed' frameborder='0' data-embedContent>>), then close CodeScanner.
press the Source button to load your target file
enable Write MCF0 (tick the first option in Main Settings)
Enable "Encrypt" (last option in the Main Settings)
Go to the Tab Encrypt and set up the encryption the way you want (skip this = use default settings)
Return to Main Tab and press "Run"
if all goes well, a new script called MCF0test.au3 is created in the same directory as your target. It has no includes and no redundant parts. Please check that it works as normal. (see Remarks if not)
It all sounds far more complicated than it is, really.
Not convinced? Check out this updated and extended Q & A pdf (FAQ, also included in the bundle) to help you get started:
BackTranslation is a test to check that the MetaCode translation worked. Skip it at your peril. It also turns your multi-include composite script into a single portable file without redundant parts (you can opt to leave the redundant parts in, if you want).
CodeCrypter can also obfuscate (vars and UDF names) and replace strings, variable names and UDF names with anything else you provide, for example, for language translation). After CodeScanner separates your target's structure from its contents, CodeCrypter (actually MCF, under the hood) can change any part, and then generate a new script from whichever pieces you define. See the MCF Tutorial for more explanation and examples.
You need the following additional scripts to get anything to work (now all included in the bundle):
CodeScanner.au3 version 2.9+ (in the CodeScanner zip in the CodeScanner thread, link above)
readCSdatadump.au3 (version 1.1+, in the CodeScanner zip)
MCF.au3 (version 1.3+, in the MCF zip in the MCF thread, link above)
MCFinclude.au3 (version 1.1+, in the MCF zip)
AES.au3, by Ward (now also included in bundle, thanks to Ward), see '?do=embed' frameborder='0' data-embedContent>>
As you can see, encryption currently relies on Ward excellent AES UDF, but you can replace this with any other algorithm you like; just edit MCFinclude.au3 UDF _MCFCC(), and MCF.au3 UDF _EncryptEntry().
Going to lie down now...