0% found this document useful (0 votes)
11 views

How To Code Crypt

This document discusses how to encrypt an AutoIt script using CodeCrypter. It involves several steps: 1. Define encryption keys in the MCFinclude.au3 file. 2. Include MCFinclude.au3 in the target script. 3. Run CodeScanner and CodeCrypter on the target script, specifying the encryption key ID. This will encrypt the script. 4. The encrypted script can then be decrypted at runtime by querying the environment for the expected key response.

Uploaded by

rangga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

How To Code Crypt

This document discusses how to encrypt an AutoIt script using CodeCrypter. It involves several steps: 1. Define encryption keys in the MCFinclude.au3 file. 2. Include MCFinclude.au3 in the target script. 3. Run CodeScanner and CodeCrypter on the target script, specifying the encryption key ID. This will encrypt the script. 4. The encrypted script can then be decrypted at runtime by querying the environment for the expected key response.

Uploaded by

rangga
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Encrypting an AutoIt #include: MCFinclude.

au3

script with CodeCrypter

• Open MCFinclude.au3 in Scite


and find Func MCFCC_Init().
• Select any existing @macro or
Function call that defines run-
time content of array $CCkey, or
add your own key definitions.
• $CCkey array index = key ID
• Write down which key ID(s) to
use for this encryption!
• Close MCFinclude.au3
Encrypting an AutoIt script
with CodeCrypter
Target script: HelloWorld.au3

In your target script, add the line:


#include “MCFinclude.au3”
(with path, if located elsewhere)
• Below all other #includes
• Above your own code

Save the script, open it in Scite,


check for errors, and ensure that
it works exactly as the original.

© 2020 by RTFC; all rights reserved.


Encrypting an AutoIt script with
CodeCrypter

• Run CodeScanner on your script


(this takes a long time).
• Check that no issues were detected Note: Tick this box
(or fix these and re-run). only if your code
• Subdirectory :<name>.au3.CS_DATA is created contains non-ASCII
special characters.
(if not, ensure that in CodeScanner’s Settings,
option [Write MetaCode] is enabled, and re-run.
• Close CodeScanner.

© 2020 by RTFC; all rights reserved.


Encrypting an AutoIt script with
CodeCrypter

3
• Start CodeCrypter.
• Press [Source] to load your script.
(the CS_DATA path is filled automatically).
• Tick Options Create MCF0 and BackTranslate
• Press [Run] (this will take a long time), then Exit.

• A new test file MCF0test.au3 has been created


in your target file’s home directory. Open it in

5
Scite, check for errors, and do test-runs.
Ensure that it works exactly as the original.
© 2020 by RTFC; all rights reserved.
Encrypting an AutoIt script with
CodeCrypter

• Restart CodeCrypter.
• Under Tab Encrypt, specify the Key ID; this is
Step 1’s index in array $CCkey in MCFinclude.au3
• Under Tab Main, disable option [Create MCF0]
and enable option Encrypt; then Press [Run].
• A new, encrypted file MCF0test.au3 is created
in your target’s home directory.
• Open it in Scite, check for errors, do test-runs.
Ensure that it works exactly as the original.

© 2020 by RTFC; all rights reserved.


Specify the expected return for
Two-pass encryption re-encrypts the any key ID in any environment.
encrypted code, to hide the key-ID
(this causes massive slowdown.)

Each user-function can be either


encrypted or left in plaintext.

Define a Subset of lines to encrypt:


• [ 0 < S < 1 ] = random proportion Randomly select from a range
• [ S > 1 ] = every Sth line of encryption key IDs per line.
© 2020 by RTFC; all rights reserved.
Encryption key definitions are
Script HelloWorld.au3, encrypted themselves fixed-key encrypted.
with user password: test.
Password query at start-up is here.
Features
• AES is practically unbreakable
• Each encryption pass is unique
• Fast decryption calls = Key generation is here.
minimal slow-down
• Optional targeted encryption Original script starts from here.
of sensitive parts only
• The decryption key is never
stored in the script, but
extracted from the run-time
environment
• The environment’s expected
response of key definitions can
also be user-defined. Functions and variable names can
additionally be obfuscated.
© 2020 by RTFC; all rights reserved.
Suggested User can be Trusted?

Key Types NO YES


Environment controlled

CodeCrypter does not meet


NO Key = Password query at start-up
your needs
by Encrypter?

1. #RequireAdmin @username &


2. Key = admin-restricted _WinAPI_UniqueHardwareID(),
YES
environment specs DriveGetSerial(),
returned at runtime …
Key Definition
Key Empty Defined
ENcryption key = return from key

(“Expected Return”)
query in current environment

Decryption Key
Empty Fails DEcryption key = return from key
query at target start-up
ENcryption key = typed ENcryption key = typed Expected
Expected Return Return
Defined
DEcryption key = 1st cmdline DEcryption key = return from key
parameter or user password query at target start-up

Key Definition
Target Empty Defined

Target will run only in an environment


(“Expected Return”)
Decryption Key

Empty Fails that matches the encryption


environment

Target will run for whomever Target will run only when runtime key
Defined types the decryption key at query response matches predefined
target start-up Expected Return

You might also like