AHK Encrypt/Obfuscate Script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Enclusion
Posts: 23
Joined: 15 Apr 2016, 14:11

AHK Encrypt/Obfuscate Script

15 Apr 2016, 14:15

I want to obfuscate a script I made so even if I give someone the source they can not steal it. Does anyone know how to do this? Some of the things I have found confused me. Thanks i need to obfuscate it.
SifJar
Posts: 398
Joined: 11 Jan 2016, 17:52

Re: AHK Encrypt/Obfuscate Script

15 Apr 2016, 18:11

Basically, there is no particularly good way to do this. You can use MPress to deter casual users, but it's easily broken if you know what you're doing.

I think AHK_H (a modified version of AHK) includes better protection, but in order to change the default encryption password ("autohotkey") you (for some reason) need to recompile AHK_H from source (not trivial if you've never used Visual Studio before). Without changing the password, there's likely no point as it could probably be easily decrypted.
Enclusion
Posts: 23
Joined: 15 Apr 2016, 14:11

Re: AHK Encrypt/Obfuscate Script

15 Apr 2016, 18:31

SifJar wrote:Basically, there is no particularly good way to do this. You can use MPress to deter casual users, but it's easily broken if you know what you're doing.

I think AHK_H (a modified version of AHK) includes better protection, but in order to change the default encryption password ("autohotkey") you (for some reason) need to recompile AHK_H from source (not trivial if you've never used Visual Studio before). Without changing the password, there's likely no point as it could probably be easily decrypted.
could u link mpress please? thanks this is just for casual
User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: AHK Encrypt/Obfuscate Script

15 Apr 2016, 19:23

even if I give someone the source they can not steal it
I'm confused. If you give someone the source, they don't have to steal it — you gave it to them!

Anyway, I presume that what you mean is to obfuscate the source code in such a way that even if someone has it, they can't really do much with it, such as use it as the basis for a new, "stolen" product, derived from your source.

Or do you not really mean source? Do you mean the EXE file created from the source? While I was writing this, I saw the last few posts. Keep in mind that MPRESS does not obfuscate your source code file. It operates on the EXE file that is created by the "compiler" (the script-to-EXE converter), which makes the source code not immediately viewable if you open the EXE in a text editor. But as SifJar correctly stated, this is easy to decrypt, with decrypters widely available on the web. That said, you may find MPRESS here:
https://autohotkey.com/mpress/mpress_web.htm

When you "compile" the script with Ahk2Exe, tick the box that says "Use MPRESS (if present) to compress resulting exe". But at the end of the day, the current AHK implementation is an interpretive language. The "compiler" is not really a compiler in the traditional sense of creating true object code that cannot be decompiled. Rather, it bundles the AHK executable with your source code.

If you do actually want a source code obfuscator, you can achieve that to a certain degree by following some coding conventions and writing your own obfuscator. It won't be perfect, but it will stop most folks from doing anything with your source. Here's an example of what your obfuscated source code could look like:

Code: Select all

Gosub,lOOOOOOOlOlll
Gosub,lOOOOOllllOOl
IfNotExist,%lOOOOOlOlOlOO%
{
  Gosub,lOOOOlOOOlOll
  Gosub,lOOOOOOllOOlO
}
lOOOOOlOOllll:=lOOOOOlOlOlOO . "*.*"
Loop,%lOOOOOlOOllll%
{
  lOOOOOOllllll:=A_LoopFileFullPath
  SplitPath,lOOOOOOllllll,lOOOOOOlOOOlO,lOOOOOlOOlOOl,lOOOOOlOOlOlO,lOOOOOOOlOOOl,lOOOOOOllOOll
  lOOOOOlOOlOlO:=A_LoopFileExt
  lOOOOOlOlOOll:=False
  If (lOOOOOlOOlOlO="tif" or lOOOOOlOOlOlO="tiff")
  {
    lOOOOOlOlOOll:=True
    lOOOOlOlllOlO:=lOOOOlOlllOlO+1
    Gosub,lOOOOOlOllOOl
  }
  If (lOOOOOlOOlOlO<>"pdf")
  {
    lOOOOlOOOOlll:=lOOOOlOOOOlll+1
    Continue
  }
  lOOOOOOlOlOlO:=lOOOOOOllllll
  lOOOOOOOllOll:=lOOOOOOOllOll+1
  lOOOOlOOlOllO:=lOOOOlOOlOllO+1
  Gosub,lOOOOlOlllOOl
}
A highly motivated person will be able to figure that out, but it won't be easy, especially without any comments, which the obfuscator removes. Regards, Joe
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: AHK Encrypt/Obfuscate Script

15 Apr 2016, 20:03

this is what you want, although it will require massive modifications:

https://autohotkey.com/board/topic/8935 ... y-scripts/

User avatar
JoeWinograd
Posts: 2200
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: AHK Encrypt/Obfuscate Script

15 Apr 2016, 20:26

guest3456,
Interesting link! One comment in there ("names could randomly start with either the letter l or the letter O and then all the rest of the obfuscated object name would be constructed of random ones and zeros") is something along the lines of mine, but I decided to go with all letters — lower case "L" and upper case "O" — no zeroes or ones, although they are derived from them using infogulch's excellent Bin(x) function. Regards, Joe
DigiDon
Posts: 178
Joined: 19 May 2014, 04:55
Contact:

Re: AHK Encrypt/Obfuscate Script

31 May 2018, 08:58

Hi, it is old but still bumps on Google for 'autohotkey obfuscator'

I've just released a major improved version of David Malia's Dynamic Obfuscator called 'AHK Dynamic Obfuscator L'.
[TOOL] AHK Dynamic Obfuscator L - Protect your code by Obfuscation
EverFastAccess : Take Notes on anything the Fast way: Attach notes, Set reminders & Speed up research in 1 gesture - AHK topic
AHK Dynamic Obfuscator L - Protect your AHK code by Obfuscation - AHK topic
QuickModules for Outlook : Sort Outlook emails very quickly to multiple folders - AHK topic
Coding takes lots of time and efforts. If I have helped you or if you enjoy one of my free projects, please consider a small donation :thumbup:
Sorry I am working hard at the moment at a new job and can't commit on delays of answers & updates
User avatar
Cuadrix
Posts: 236
Joined: 07 May 2017, 08:26

Re: AHK Encrypt/Obfuscate Script

31 May 2018, 13:22

To obfuscate your Autohotkey code, use AHK source code Encryptor v2.0 By FeiYue:
https://autohotkey.com/boards/viewtopic ... +Encryptor
It works very well.
freespacing
Posts: 150
Joined: 28 Sep 2016, 11:14
Contact:

Re: AHK Encrypt/Obfuscate Script

03 Apr 2019, 12:03

@Cuadrix Do you know if FeiYue's tool is still available?
When I click on the link you posted,the page that comes up says "You are not authorised to read this forum."
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: AHK Encrypt/Obfuscate Script

03 Apr 2019, 12:27

its there... technically. the chinese forums cant be viewed right now. try web.archive or something

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 368 guests