EXE to AHK Decompiler Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
labrint
Posts: 379
Joined: 14 Jun 2017, 05:06
Location: Malta

EXE to AHK Decompiler

12 Nov 2018, 03:02

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
User avatar
labrint
Posts: 379
Joined: 14 Jun 2017, 05:06
Location: Malta

Re: EXE to AHK Decompiler  Topic is solved

12 Nov 2018, 04:06

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
garry
Posts: 3760
Joined: 22 Dec 2013, 12:50

Re: EXE to AHK Decompiler

12 Nov 2018, 15:32

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
burque505
Posts: 1732
Joined: 22 Jan 2017, 19:37

Re: EXE to AHK Decompiler

12 Nov 2018, 19:03

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
garry
Posts: 3760
Joined: 22 Dec 2013, 12:50

Re: EXE to AHK Decompiler

13 Nov 2018, 03:24

@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 
TAC109
Posts: 1111
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: EXE to AHK Decompiler

13 Nov 2018, 04:19

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.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
garry
Posts: 3760
Joined: 22 Dec 2013, 12:50

Re: EXE to AHK Decompiler

13 Nov 2018, 05:03

@TAC109, thank you
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: EXE to AHK Decompiler

13 Nov 2018, 14:19

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.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], scriptor2016, ShatterCoder and 105 guests