Page 1 of 1

AHK Obfuscator Tool

Posted: 10 Nov 2019, 15:59
by Zoanthario
I was looking for a way to encrypt an AHK script and the only tool I found that can't be decrypted easily is this AHK Obfuscator Tool:
www.everfastaccess.com /AHK-Obfuscator/

But as a beginner, I didn't really understand how to use it properly, I understood that it works in these 3 steps altogether:
1.Prepare the written script for obfuscation which has two kinds (Straight Obfuscation or Dynamic Obfuscation)
2.Use the obfuscator tool to create a translation file
3.Use the obfuscator tool to encrypt the script

but I couldn't do them in detail because I don't know what should I add to the original script to be responded with in the tool, I understood a little through this example:
www.everfastaccess.com /AHK-Obfuscator/exemple.htm

but this is what I get after I Obfuscate the script:

Code: Select all

obf_copyright := " Date: 10:32 م 10 نوفمبر, 2019                  "
obf_copyright := "                                                "
obf_copyright := " THE FOLLOWING AUTOHOTKEY SCRIPT WAS OBFUSCATED "
obf_copyright := " BY DYNAMIC OBFUSCATER FOR AUTOHOTKEY           "
obf_copyright := "                                                "
obf_copyright := " Copyright (C) 2011-2013  David Malia           "
obf_copyright := " DYNAMIC OBFUSCATER is released under           "
obf_copyright := " the Open Source GPL License                    "
Here is the original script:

Code: Select all

#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority,, High 
SendMode Input
$*CAPSLOCK::
Loop
{
if not GetKeyState("CAPSLOCK","P")
break
Send, {1 Down}{1 Up}
Sleep, 0
Send, {s Down}
Sleep, 0
Send, {Space Down}{s Up}
Sleep, 0
Send, {Space Up}
Sleep, 0
Send, {d Down}{Space Down}{d up}
Sleep, 0
Send, {Space Up}
Sleep, 0
}
Return
^f::Suspend
Can someone show me how should the script be (What should be added to the script) to be ready for dynamic obfuscation?

Re: AHK Obfuscator Tool

Posted: 11 Nov 2019, 14:24
by guest3456
you might want to ask in this thread for that tool:

https://www.autohotkey.com/boards/viewtopic.php?t=49887

although as i remember when i tried, that script was very hard to use

Re: AHK Obfuscator Tool

Posted: 11 Nov 2019, 14:40
by gregster
If your script is only so short like your example script, obfuscating it manually is probably much easier... if you really think that you need obfuscation.

Re: AHK Obfuscator Tool

Posted: 11 Nov 2019, 16:45
by Zoanthario
gregster wrote:
11 Nov 2019, 14:40
If your script is only so short like your example script, obfuscating it manually is probably much easier... if you really think that you need obfuscation.
Well, I know the script is too simple to need obfuscation I was just interested in knowing about obfuscation, but I think I better start with the easy ways, can you provide me links of topics, posts or any guide that teaches how to obfuscate manually? I searched but all I found wasn't manual.

Re: AHK Obfuscator Tool

Posted: 11 Nov 2019, 17:07
by gregster
I would google for obfuscation in general and just do manually what obfuscators do automatically.

That obfuscator tool you linked to, could give you some AHK-specific ideas (not every technique is applicable in AHK). In general, you should know the AHK syntax and its quirks very well; so at least the 'Usage and Syntax' section of the AHK docs should be familiar to you. Programming a bit more in AHK should also help you understand how the syntax of AHK works and where you can replace something with something more cryptic. But discussing your obfuscation techniques will also help anyone who wants to de-obfuscate your code.

In general, I don't think that obfuscating is a very efficient protection in AHK (especially if you have a short script and someone is skilled and motivated; de-obfuscation can certainly be automated with AHK - or other languages).
It can be one part of a protection strategy, but you should ask yourself - if you don't have any ideas how to obfuscate your AHK code - if your code is really that elaborate that it is worth the effort (or if you know enough about obfuscation). It might be worth it, but I would still check ;)

For longer scripts, it makes certainly sense to automate the obfuscation (and perhaps to write your own custom obfuscator).

I would recommend to learn AHK thoroughly first and then to decide what and if to obfuscate. But that's my personal opinion.
(I personally would be more interested in de-obfusction, because I like riddles. :D )

Re: AHK Obfuscator Tool

Posted: 13 Nov 2019, 14:15
by Zoanthario
@gregster Actually I like riddles too and that's why I'm exploring obfuscation/encryption/decrpytion/decompilation...etc I didn't really start using AHK to get advanced I just wanted to make a simple HotKey but when I knew about these I was interested to know about more so, I don't really see it worth the effort to learn about AHK in general and obfusctation for the purpose of obfuscating,de-obfuscating, when I learn more about AHK that'd be for personal interest and I agree with you that de-obfuscation is more interesting than obfuscation but you can't de-obfuscate something that you don't know how it's obfuscated. :)

Re: AHK Obfuscator Tool

Posted: 13 Nov 2019, 14:32
by gregster
I would disagree with the last point. Pure obfuscation you can figure out, if you know pretty well how the syntax of the obfuscated language works - but you don't need to know the actually used techniques or the order they were used in (although it surely doesn't hurt to know commen concepts), when you start.

You will learn what was used as you go along. If the AHK interpreter can execute the script code, you can parse it yourself, too. It might take some time (or some more), but automation (parsing and replacing) is your friend, as soon as you have figured out the used techniques.

Of course, you usually won't get speaking variable or function names or nice code out of a de-obfuscated script. Even scripts in clear code are not necessarily easy to understand...

Re: AHK Obfuscator Tool

Posted: 16 Nov 2019, 11:41
by murataygun
Just use Autohotkey_H's compiler. It encrypts pretty well.