Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Obfuscator for Autohotkey Scripts


  • Please log in to reply
53 replies to this topic
guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
ok i have found a solution for the built in gui labels, as suggested on the dynamic obfuscator website

the solution is to use these two commands around the sub labels that you dont want to obfuscate:
;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: -1

;$OBFUSCATOR: $LABELS_RESTORE_DEFAULTS:

code
original
Spoiler

obfuscated:
Spoiler



however, i have one question for Dave

as i understood it, you said that the defaults were to use Dynamic Obfuscation, not Straight. so originally, i thought that instead of 'RESTORE_DEFAULTS', i thought that the second command should be this:
 
...


;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: -1 
ButtonCancel:
   msgbox, button cancel
return 


GuiClose:
   msgbox, guiclose exiting
   ExitApp
return
;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: ,, -1 

;;;;;;;_not this_;;;;$OBFUSCATOR: $LABELS_RESTORE_DEFAULTS:

...
but that didn't work at all.

Dave-
  • Members
  • 46 posts
  • Last active: May 17 2013 04:57 PM
  • Joined: 30 Nov 2010

you can almost do that. problem is that -1 is now the default first parameter and you only changed the 3rd parameter to a new default, -1. so that means that -1 would still have been counted as the setting for the first parameter. so to do it that way you would have to do something like:

;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: 20, 24, -1

when you change a parameter on this statement it changes the state of that parameter. if you then leave out a parameter on a further statement, it will not supply a global default value like a functions parameter default, it will use the most previously set value.   each parameter maintains it's state. if some parameters are supplied and others left out, the most previously set values will be used for the ones left out. 



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
i saw on your site that

;$OBFUSCATOR: $LABELS_RESTORE_DEFAULTS:

will not actually restore to the default (Dynamic), but actually restore to the previous state, which i have defined as Straight obfuscation in the autoexec. so it should do what i want

Dave-
  • Members
  • 46 posts
  • Last active: May 17 2013 04:57 PM
  • Joined: 30 Nov 2010

that's why you use $LABELS_RESTORE_DEFAULTS. if you want to change the encoding defaults for a small section of code, use change defaults then restore defaults to pop the previous state of the defaults. 



SimplicityGS
  • Members
  • 11 posts
  • Last active: Mar 02 2014 06:31 AM
  • Joined: 13 Mar 2013

I'm sorta confused when using this can anyone help? Nice work btw :)



Dave-
  • Members
  • 46 posts
  • Last active: May 17 2013 04:57 PM
  • Joined: 30 Nov 2010

nice to hear, SimplicityGS!
 
you do need to do a few simple things to get the minimum obfuscation for your program going and working. these few steps will result in all references to your functions, labels, and parameters being obfuscated and the order of your function and label sections scrambled. 

Prepare Your Autohotkey Source Code For Minimum Single Obfuscation
You must format your function sections and format your label sections according to some simple rules.
 
Put these obfuscator command comments at the beginning of your source code to signal to the obfuscator that you want straight obfuscation. they must start in column 1:
 
;$OBFUSCATOR: $FUNCS_CHANGE_DEFAULTS: ,, -1 
;$OBFUSCATOR: $PARAMS_CHANGE_DEFAULTS: ,, -1 
;$OBFUSCATOR: $LABELS_CHANGE_DEFAULTS: ,, -1 
;$OBFUSCATOR: $GLOBVARS_CHANGE_DEFAULTS: ,, -1 
;$OBFUSCATOR: $LOSVARS_CHANGE_DEFAULTS: ,, -1
 
Put this obfuscator command comment in your source code right after the end of your autoexecute section. put it right after the return. it also must start in column 1:
RETURN
;$OBFUSCATOR: $END_AUTOEXECUTE: 
 
If you are using '#include file' statements in your program, you must do a couple of special steps. 
 
If you use the autohotkey 'gui, label?????' tag, some special steps are necessary. 
 
You must prepare a text file that lists the full file path for each of your include source code files that are part of your project. this is going to be an input file that you will select when you run the obfuscator that will indicate what files to obfuscate.  the file should have 1 include file path per line and the file that contains your autoexecute section should be listed first.
 
now you can go ahead and run the obfuscator! 
the obfuscator has 2 functions.
 
the first will parse your code and create a translations map file which will have entries for every object in your program that is to be obfuscated. you specify the file talked about above that contains the list of your source code files and you specify the translations output file that will created by the obfuscator.
 
the second function will create the output obfuscated version of your program. respecify the same 2 files as in the create translations map function above and indicate what you want your output obfuscated program to be named. it should end in ahk. leave all the extra checkboxes on the obfuscate gui unchecked your first time running this. a statistics box will come up at the beginning of the obfuscation process listing some stats on the stuff that will be obfuscated. cancel it. a box will come up telling you the size of the obfuscated file that will be created. close that and the obfuscated file will be written.
 
you should now be able to double click on the obfuscated file and it will run under autohotkey.  
it should run exactly the same as before and at the same speed but the source code will look way different!
 
run the obfuscate function again but this time check the first 2 checkboxes on the obfuscate gui. this will eliminate whitespace and comments and randomize the order of your function and label sections.
 
the steps above will give you a working program with all references to functions, labels, and  parameters obfuscated. try getting that working SimplicityGS.



Diablos
  • Members
  • 3 posts
  • Last active: May 16 2013 08:06 AM
  • Joined: 14 May 2013

Hi Guys,

 

Ive recently made a HUGE game script, for farming in league of legends. Im not having any problems with the script perse, its attempting to at least hide some of the source thats got me.. Ive tried everything i can.

 

http://www.autohotke...-scripts/page-3

 

I would like very much if i could send someone my scripts for some type of compiling... Currently, i cant right click my exe and view the source, also i can resource hack view my password protected no compile script.

 

Please help me guys, i dont want to release this script too easily, otherwise people just report the co-ordinates being used and the game maker patches...

 

I know its not 100%, i know it can be decompiled, but at least it cant be right clicked.

 

At the moment the obfuscator creates a script with just the crappy header in it..

 

Ive followed the instructions, i think the problem lies with the fact i need to add extra code to me script, and i just cant get it in the right place, this will be a 5 second thing for the right person, id soo appreciate it.

 

Feeling kinda dissapointed, spent 4 days making it, and i cant compile it.... Please help.



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
why can't you compile it?

Diablos
  • Members
  • 3 posts
  • Last active: May 16 2013 08:06 AM
  • Joined: 14 May 2013

i can compile it.. sorry typo. i CAN compile it. i CAN read the comiled source in resource hacker. 

For some reason i cannot obfuscate my ahk files. it fills in the "this is a obfuscated script" header but doesnt create my script under this...

 

Please help. anyone familiar with this?



Dave-
  • Members
  • 46 posts
  • Last active: May 17 2013 04:57 PM
  • Joined: 30 Nov 2010

did you run the 'create translations map' function first?



ruespe
  • Members
  • 567 posts
  • Last active: Dec 01 2014 07:59 PM
  • Joined: 17 Jun 2008

Hi Dave,
 
I'm afraid, I found an error. Function within #If-statements are not been obfuscated. The last #If-Statement (last line) is eliminated.
 
Original

Spoiler

 

Obfuscated

Spoiler



alvitawa
  • Members
  • 98 posts
  • Last active: Oct 14 2017 02:16 PM
  • Joined: 07 Feb 2013

Site is down? where can I download it?



kaka
  • Members
  • 76 posts
  • Last active: Jul 02 2018 05:24 AM
  • Joined: 05 Jan 2007

For some reason i cannot obfuscate my ahk files. it fills in the "this is a obfuscated script" header but doesnt create my script under this...

 

Same problem with me. Guys please help us.


Posted Image

alvitawa
  • Members
  • 98 posts
  • Last active: Oct 14 2017 02:16 PM
  • Joined: 07 Feb 2013

Same problem with me. Guys please help us.

You have to add comment stuff and so on, but the tuts in the docs are realy unclear :(.



Bruttosozialprodukt
  • Members
  • 457 posts
  • Last active: Oct 18 2015 08:47 AM
  • Joined: 20 Oct 2012
Downlaod including the documentation can be found on github.
Just download the whole project:
https://github.com/d...hive/master.zip
And run \dynamicobfuscator-source-code\dynamicobfuscator.ahk


Though, it didn't work for my current project. :/

I'm wondering how well the parser knows the ahk language.
Would it be a problem if I'd set up a function call in multiple lines:
MyFunction(param1, param2, param3
         , param4, param5, param6)
Or what about the Regex functions with lots of quotes and commas in the string. Do I even need to escape commas in regex or is it optional?
RegexMatch(input, "test=""a`,b`,c""", match)
My project contains a lot of complicated regex and other stuff. But since it is 6000 lines long atm, I have absoluetely NO idea what code I'd have to change to make this obfuscator work. :/