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
hrm ok, i will try that change. i think i have other list functions that are the same

Bugz000
  • Members
  • 155 posts
  • Last active: Oct 14 2015 01:03 PM
  • Joined: 24 Feb 2011

i'm having issues working out how the hell this program works - it seems completely bloated and over-complicated but that's what you have to do to make things foolproof for noobs D:

 

my end aim is going to be "ObfuscateCode(Code)" and it returns the same code obfuscated - simple to use and effective- now i'm looking at the "include map file that contains your list of source code files to process" ... .what is this?

 

is this the source code file?

or a txt file containing a list of file path/directories?


n39peTm.jpg
Hire me to write your code! (join IRC or PM me for details)


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

it is a text file containing source code file path/directories. your main autohotkey script and any include files. the file that contains your autoexecute section must be listed first. list each file on a separate line.



Bugz000
  • Members
  • 155 posts
  • Last active: Oct 14 2015 01:03 PM
  • Joined: 24 Feb 2011

thanks for the reply :)


n39peTm.jpg
Hire me to write your code! (join IRC or PM me for details)


guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
ok some other issues:

if you have function parameters named "gui" or "color" and then within that fucntion, you actually call Gui commands or Gui, Color commands, then those commands would get replaced as well. so you need to rename your func params.

Dave

i'm now running into another problem. i'm getting the message: "Error the target label doesn't exist" and it refers to the 2nd line below

code:
Gui, Add, Text, xs+190 ys, Actions:
Gui, Add, Checkbox, % "xp+10 yp+55 gf%fkkfk#[email protected]#[email protected]@k#kf%kk#kf%fkk#k#fffffkk#kf%k#ffk%fkkfk#[email protected]#[email protected]@k#kf%fk#f%[email protected]@[email protected]%fk#fkkffkkfk#kfff Disabled vCB1", % "Action1"
original:
Gui, Add, Text, xs+190 ys, Actions:
Gui, Add, Checkbox, % "xp+10 yp+55 gUpdateCB Disabled vCB1", % "Action1"
edit
solved by not forcing expression with % :
 
Gui, Add, Checkbox, xp+10 yp+55 gUpdateCB Disabled vCB1, % "Action1"


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

i never force that part of the gui statement because then you can dump variables like %standwidth% and %hicolor% in there.

Gui, Add, Checkbox, xp+10 yp+55 gUpdateCB Disabled vCB1 %hicolor% %standwidth%, % "Action1"

gosub labels or variables within that part of the gui statement can have problems obfuscating if you force the expression. my porgram can generally have trouble replacing program references within any literally quoted string. since it isn't done that much, i don't try to account for it in my obfuscator. rule is, if it doesn't require forcing, then dont do it:


;good
Menu, MyMenu, Add, Item1, doitem1
;bad
​Menu, MyMenu, Add, Item1, % "doitem1"

your example failed because my program put %'s in the obfuscated g label. otherwise it would still have worked even with you forcing the code.

 

are you using straight obfuscation? i'm not sure if i had the routines still put junk % variables in labels like that even with straight obfuscation. i bet all the % variables in your original example would have all resolved to equaling null but they were never evaluated because the expression was already forced.

Gui, Add, Text, xs+190 ys, Actions:Gui, Add, Checkbox, % "xp+10 yp+55 gf%fkkfk#[email protected]#[email protected]@k#kf%kk#kf%fkk#k#fffffkk#kf%k#ffk%fkkfk#[email protected]#[email protected]@k#kf%fk#f%[email protected]@[email protected]%fk#fkkffkkfk#kfff Disabled vCB1", % "Action1"

keep me posted guest3456

 

 

 

 



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
yeah straight obfuscation... ive decided to skip it all for the time being cause it is gonna require a big change in code.. but ill get to it eventually

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

it's dynamic obfuscation that would require you to change your code. straight obfuscation requires very little change.



Bugz000
  • Members
  • 155 posts
  • Last active: Oct 14 2015 01:03 PM
  • Joined: 24 Feb 2011

okay ive tried 4 times to get this into a single function

 

ObfuscateCode(Code)

or

ObfuscateCode(File)

 

and it's simply too bloated-  gui elements popping up throughout each function - just as i managed to strip one function down - a function within that function has dependencies on some more functions which relate to a gui which no longer exist etc etc

if the maker or someone else is willing to either work with me or do it themselves - it would be great but for now - i'm out.


n39peTm.jpg
Hire me to write your code! (join IRC or PM me for details)


guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
this thing is pretty powerful. why would you even want to condense it into one function? seems like a waste of time to me

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

i think it is best this program have some run time options and some guis. i see no purpose in making the program gui free.



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011
i have found two more problems, using basic straight obfuscation.

here is the code to produce them:

original
Spoiler

obfuscated:
Spoiler

here are the problems:

1. the program doesn't handle the default gui labels. as you can see, ButtonCancel is supposed to exit the script when the Cancel button is clicked. this is the default ahk naming system for button labels when you don't specify a g-label. the obfuscator changes the label. same with the GuiClose label. it doens't exit the script.

2. when the button's vVariable and gLabel are the same name, the obfuscator ends up messing up the GuiControl command, which is meant to disable the button using its variable. however, the obfuscator must be thinking that this is a call to the label and changes it. the MyButtonBack button is supposed to be disabled by the GuiControl command, but when using the obfuscated version, it is not disabled


another question:

on some of the obfuscator commands, it expects a list as a parameter. is this supposed to be a comma separated list? can you show an example of how to use these commands?

;$OBFUSCATOR: $DEFGUICLOSELAB: (list of close labels)
;$OBFUSCATOR: $DEFSYSFUNCS: (list of functions)
;$OBFUSCATOR: $DEFGLOBVARS: (list of global variable names) { / {minobfstr}, {maxobfstr}, {obfrows}, {fragsperrow}, {minfragstr}, {maxfragstr} }

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

oops, i didn't code for automatic button label assignments. it would have worked correctly if you had coded:

gui, add, button, w80 h30 x400 y427 GButtonCancel, Cancel

it would be difficult to code the obfuscator to handle this automatically. however, do keep telling me about authotkey special features i failed to code for.

 

it's not a good idea to name variables and labels by the same name. there will be other places where my program could not tell which object it was:

;my program would not be able to know whether to replace this with the obfuscated variable name or the obfuscated label name
;since the obfuscator replaces label calls before global vars, it would be replaced with the label!
MyButtonBack := true

the obfuscator does finds and replaces to replace objects names with obfuscated object names. it does not parse the whole program like a compiler does!

 

 

 use a comma separated list of as many items as you want. no quotes around items necessary. if you use the optional parameters, precede them with a '/'

;as many items as you like in the list, separated by commas
;$OBFUSCATOR: $DEFGUICLOSELAB: label1, label2, label3, label4, label5
;$OBFUSCATOR: $DEFGLOBVARS: globvar1, globvar2, globvar3

;3 of the optional parameters are used. when you use them, precede them with a '/'
;the slash indicates to the obfuscator that the optional parameters are being used
;$OBFUSCATOR: $DEFGLOBVARS: globvar4, globvar5, globvar6, globvar7  / 20, 24, -1


guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

it would be difficult to code the obfuscator to handle this automatically. however, do keep telling me about authotkey special features i failed to code for.


yeah no worries, i'm also posting these in case other people try to use it and run into similar issues.
 

 

use a comma separated list of as many items as you want. no quotes around items necessary. if you use the optional parameters, precede them with a '/'

;as many items as you like in the list, separated by commas
;$OBFUSCATOR: $DEFGUICLOSELAB: label1, label2, label3, label4, label5
;$OBFUSCATOR: $DEFGLOBVARS: globvar1, globvar2, globvar3

;3 of the optional parameters are used. when you use them, precede them with a '/'
;the slash indicates to the obfuscator that the optional parameters are being used
;$OBFUSCATOR: $DEFGLOBVARS: globvar4, globvar5, globvar6, globvar7  / 20, 24, -1


so the space after the comma is allowed.. is it required?

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

no, the space is not required. the format is real forgiving and will except almost anything.

 

use the optional parameters if you want to change the obfuscation encoding defaults for the current list only. if not used then the current encoding defaults for the object type will be used. use to set extra secure settings for the current list or to turn off encoding for some stuff if you are having a debugging problem. the optional parameters can contain empty place holder commas:

;sets these to straight obfuscation by using -1 as the 3rd optional parameter
;$OBFUSCATOR: $DEFGLOBVARS: globvar4, globvar5  /  ,, -1
;turns off obfuscation for the named objects by using -1 as the first optional parameter
;$OBFUSCATOR: $DEFGLOBVARS: globvar10, globvar11  / -1

 

 

the obfuscator command comments do have to start in column 1. the semicolon has to be in column 1 which means that if you want to turn a command off, you can just indent it.

;turned off    
    ;$OBFUSCATOR: $DEFGLOBVARS: globvar4, globvar5, globvar6, globvar7  / 20, 24, -1