Page 1 of 1

EXE to AHK Decompiler

Posted: 12 Nov 2018, 03:02
by labrint
Hi can anyone help me find a working version of an EXE to AHK decompiler? Spent hours working on a project and by mistake deleted my ahk master file. :x

Re: EXE to AHK Decompiler  Topic is solved

Posted: 12 Nov 2018, 04:06
by labrint
Problem solved. Just view the .exe with Notepad++ and go to the bottom of the page. The code is all there unencrypted.

Thanks goes to the Joker for revealing this method.

https://www.youtube.com/watch?v=7hgt58aKz1U

Re: EXE to AHK Decompiler

Posted: 12 Nov 2018, 15:32
by garry
maybe can also try this , exe2ahk , drag&drop xy.exe ahk-file to convert > 'a_now_xy.ahk'
https://autohotkey.com/boards/viewtopic.php?f=6&t=59015

Re: EXE to AHK Decompiler

Posted: 12 Nov 2018, 19:03
by burque505
Hi garry, your script works great for me with just one change. Pretty nice, by the way. The reason I changed it was that it was cutting off the last 2 characters of the script, but that was easy to find :)

Code: Select all

p1:=(p1+1)
stringtrimleft,c2,aah,P1
;stringtrimright,c3,c2,2 ;- no succes
fileappend,%c2%,test58.txt
fileread,aaz,test58.txt
stringtrimright,c3,aaz,2
fileappend,%c3%,%newfile%
filedelete,test58.txt
run,%newfile%
aah=
aaz=
to

Code: Select all

p1:=(p1+1)
stringtrimleft,c2,aah,P1
;stringtrimright,c3,c2,2 ;- no succes
fileappend,%c2%,test58.txt
fileread,aaz,test58.txt
fileappend,%aaz%,%newfile%
filedelete,test58.txt
run,%newfile%
aah=
aaz=
Regards,
burque505

Re: EXE to AHK Decompiler

Posted: 13 Nov 2018, 03:24
by garry
@burque, thank you but I had no succes , I get the 2 last characters 'PA' at the end .
I needed to cut the last 2 characters > 'PA' which was possible to create first a file ( I don't now why I had no success to delete the to 2 last characters in variable 'C2' .)
this was OK :

Code: Select all

  ;stringtrimright,c3,c2,2   ;- no succes
  fileappend,%c2%,test58.txt
  fileread,aaz,test58.txt
  stringtrimright,c3,aaz,2  ;- cut the last 2 characters from readed file 

Re: EXE to AHK Decompiler

Posted: 13 Nov 2018, 04:19
by TAC109
garry wrote:
13 Nov 2018, 03:24
( I don't now why I had no success to delete the to 2 last characters in variable 'C2' .)
I believe string c2 contains the extracted source followed by binary data, which contains a binary zero early on. Writing c2 to a file will truncate at the binary zero so when read back, aaz contains only the source plus anything up to the binary zero, which you are then able to truncate.

Re: EXE to AHK Decompiler

Posted: 13 Nov 2018, 05:03
by garry
@TAC109, thank you

Re: EXE to AHK Decompiler

Posted: 13 Nov 2018, 14:19
by SOTE
This thread is a good example for people to understand that "compiling" in AutoHotkey_L offers nearly no protection of the script. That is, a "compiled" AutoHotkey_L script is vulnerable to being easily decompiled by an unknown 3rd party. In fact, the term "compile" is used loosely, and it arguably only has the purpose of convenience. Like if the other person doesn't have AutoHotkey or doesn't want to install it, but needs or wants to use your script.

For those that might need it (example- inside a business, school, IT department, etc...) to have better or a higher level of protection for a AHK script, you may want to use obfuscation (https://autohotkey.com/boards/viewtopic ... te#p222452), encryption (https://autohotkey.com/boards/viewtopic ... 28&t=42494), or AutoHotkey_H.