ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

How are these AutoHotkey script protected?

<< < (3/6) > >>

vbmark:
Compile_AHK II
http://www.autohotkey.com/board/topic/21189-compile-ahk-ii-for-those-who-compile/page-30
Latest version at the end of the thread, explanation at the start.-justice (December 03, 2013, 07:58 AM)
--- End quote ---

OK, this is really interesting.  I'm not sure what's going on but I cannot decompile a script compiled with this tool.

I have disabled all compressors, mpress and UPX, but I still cannot decompile.  However, the bad news is that VirusTotal is still showing one false virus.

But this is farther than I've gotten before.  I'm going to start studying the threads and see if I can get this last issue settled and this will be golden.

Thanks!!!

MilesAhead:
I saw some mention that AHK_L can be decompiled with this:
https://gist.github.com/Uberi/3334552

I haven't tried it yet though.

app103:
Copied from the Help file of the version of AHK that I have installed:

A script compiler (courtesy of Jonathan Bennett's AutoIt v3 source code) is included with the program. AutoIt v2 scripts are not supported, so if necessary, first auto-convert your .aut file to .ahk.

Once a script is compiled, it becomes a standalone executable; that is, it can be used even on machines where AutoHotkey is not installed (and such EXEs can be distributed or sold with no restrictions). The compilation process compresses and encrypts all of the following: the script, any files it includes, and any files it has incorporated via the FileInstall command.

Compiling does not improve the performance of a script. In fact, a compiled script is slightly slower to launch because it must first be decrypted and decompressed into memory, after which it is optimized just like a normal script.

Ahk2Exe can be used in the following ways:

1. GUI Interface: Run the "Convert .ahk to .exe" item in the Start Menu. In v1.0.46.10+, the password N/A may be specified within the GUI interface to prevent exe2ahk from being able to decompile the script. This works only in the GUI interface; for the command line, use the /NoDecompile switch instead.

2. Right-click: Within an open Explorer window, you can right-click any .ahk file and select "Compile Script" (only available if the script compiler option was chosen when AutoHotkey was installed). This creates an EXE file of the same base filename as the script, which appears after a short time in the same directory. Note: The EXE file is produced using the same custom icon and compression level that was last used by Method #1 above and it will not have a password.

3. Command Line: The compiler can be run from the command line with the following parameters:
Ahk2exe.exe /in MyScript.ahk [/out MyScript.exe][/icon MyIcon.ico][/pass password][/NoDecompile]

For example:
Ahk2exe.exe /in "MyScript.ahk" /icon "MyIcon.ico" /pass "CustomPassword" /NoDecompile

Usage:


* Parameters containing spaces should be enclosed in double quotes.
* If the "out" file is omitted, the EXE will have the same base filename as the script itself.
* In v1.0.46.10+, the /NoDecompile switch (if present) prevents exe2ahk from being able to decompile the script even when the correct password is given. This provides an additional layer of protection that goes beyond having a long, elaborate password.
Notes:


* If you plan to distribute your EXE and don't want anyone to be able to view the source code of your script, you get the maximum protection by compiling at the command line with the /NoDecompile switch, and also specifying a long, elaborate password. A password's maximum length is 64 characters.
* The commands #NoTrayIcon and "Menu, Tray, ShowMainWindow" affect the behavior of compiled scripts.
* An EXE can be decompiled to retrieve the original script by downloading Exe2Ahk (this utility should be run from the command prompt). However, any comments originally present (semicolon or /**/) will be lost.
* Compiled scripts can be reduced in size by about 20 KB by placing this smaller version of the AutoHotkeySC.bin file in your AutoHotkey\Compiler folder (overwriting the existing file of the same name). Any compiled script produced in this fashion will be dependent on MSVCRT.dll. Although this DLL is always present on Windows 2000/XP or later, older operating systems do not necessarily have it.
* Custom version info (as seen in Explorer's file-properties dialog) can be added to your compiled scripts by using a utility such as Resource Hacker (freeware) to edit the file "AutoHotkeySC.bin". This file is contained in the "compiler" subfolder where AutoHotkey was installed. Note: Resource Hacker will corrupt compiled scripts, which is why only the AutoHotkeySC.bin file should be edited.
* The method above can also be used to change existing icons or add new ones to all compiled scripts.
* The built-in variable A_IsCompiled contains 1 if the script is running in compiled form. Otherwise, it is blank.
* If you do not wish your compiled scripts to be compressed, delete or rename the file "upx.exe" in AutoHotkey's "Compiler" folder.
* When parameters are passed to Ahk2Exe, a message indicating the success or failure of the compiling process is written to stdout. Although the message will not appear at the command prompt, it can be "caught" by means such as redirecting output to a file. [v1.0.43+]
--- End quote ---

vbmark:
I saw some mention that AHK_L can be decompiled with this:
https://gist.github.com/Uberi/3334552

I haven't tried it yet though.
-MilesAhead (December 03, 2013, 08:46 PM)
--- End quote ---
That is what I use to decompile everything.  But it does not work on anything I compile with this:

http://www.donationcoder.com/Software/Skrommel/index.html

You can read the details about my trying is here: http://www.donationcoder.com/forum/index.php?topic=36672.msg343309#msg343309

vbmark:
Copied from the Help file of the version of AHK that I have installed:-app103 (December 04, 2013, 04:59 AM)
--- End quote ---
The Password and NoDecompile options do nothing to prevent decompilation.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version