Sunday, 2024-04-28, 7:24 PM
Welcome Guest

Blog

Main » 2011 » March » 25 » Script Decompiler
12:43 PM
Script Decompiler
Compiled AutoHokey scripts are possible to decompiler using a decompiler program designed for AutoHotkey itselft. You can read more about the decompiler scripts on this post.

There are lot of decompiler scripts available. I chose one of the bests decompiler I found. This is the modified script of sleepyy335.

Code
menu,utility, Add,Download the Exe2Ahk Decompile cmd utility,MenuHandler1  
menu, myMenuBar, Add,utility,:utility  
menu,help, Add,Help,MenuHandler2  
menu,help, Add,About,MenuHandler3  
menu, myMenuBar, Add,Help,:Help  
gui, menu,MyMenuBar  
Gui, Add, Edit, x156 y63 w250 h20,
Gui, Add, Button, x416 y63 w30 h20 gBrowse1, ...  
Gui, Add, Edit, x156 y93 w250 h20,  
Gui, Add, Edit, x156 y123 w250 h20,  
Gui, Add, Button, x416 y93 w30 h20 gBrowse2, ...  
Gui, Add, Button, x76 y163 w390 h20, Decompile  
Gui, Add, Text, x76 y53 w80 h30,AHK exe file to Decompile  
Gui, Add, Text, x86 y93 w70 h20,Exe2Ahk  
Gui, Add, Text, x86 y123 w70 h20,Password  
Gui, Show, x170 y110 h246 w557, AHK Decompile script 1.0
Spath = %A_ScriptDir%\Exe2Ahk.exe
Gosub, GetSpath
IfExist, %Spath%
  GuiControl,,Edit2, %Spath%  
Return  
;-----------------------------------------------------------------------------------------------  
MenuHandler3:  
msgbox, AHK Decompile script 1.0 a script to Decompile Ahk compile scripts script by (^sleepy^) 1-22-05 `r`n`r`nModified...
return
;-----------------------------------------------------------------------------------------------  
MenuHandler2:  
run,http://www.autohotkey.com/docs/  
return
;-----------------------------------------------------------------------------------------------  
MenuHandler1:
URLDownloadToFile,http://www.autohotkey.com/download/Exe2Ahk.exe ,%A_ScriptDir%\Exe2Ahk.exe
IfExist, %A_ScriptDir%\Exe2Ahk.exe
{
  Spath = %A_ScriptDir%\Exe2Ahk.exe
  Gosub, GetSpath
  foundit = %Spath%
  GuiControl,,Edit2, %Spath%
}  
return
;-----------------------------------------------------------------------------------------------  
Browse1:
FileSelectFile, SelectedFile, 3, , Open a, ahk compiled script (*.exe)  
if SelectedFile =  
{
  MsgBox, You didn't select anything.
  Return
}  
else
{
  Spath = %SelectedFile%
  Gosub, GetSpath
  GuiControl,,Edit1,%Spath%  
}
return  
;-----------------------------------------------------------------------------------------------  
Browse2:
msgbox,1,,Decompiler will now search for the Exe2Ahk Decompile cmd utility!  
IfMsgBox, Cancel  
return
SplashTextOn,,,Searching...,
Loop,C:\Exe2Ahk.exe, , 1 ; Recurse into subfolders.  
{  
  foundit = %A_LoopFileShortPath%
}  
IfExist, foundit
{
  FileCopy, %foundit%, %A_ScriptDir%\Exe2Ahk.exe
  Spath = %A_ScriptDir%\Exe2Ahk.exe
  Gosub, GetSpath
  foundit = %Spath%
  GuiControl,,Edit2, %Spath%
}
else
{
  Gosub, MenuHandler1
}
SplashTextOff
return  
;-----------------------------------------------------------------------------------------------  
GetSpath:
Loop, %Spath%
{
Spath = %A_LoopFileShortPath%
}
Return
;-----------------------------------------------------------------------------------------------  
buttondecompile:
ControlGetText, AHKfile, Edit1  
ControlGetText, E2AHK, Edit2  
ControlGetText, EXEpass, Edit3
IfNotExist, %E2AHK%
{
  MsgBox, Error. EXE2AHK not specified. File not Decompiled.
  Return
}
else
{
  RunWait, %E2AHK%%A_Space%%AHKfile%%A_Space%%EXEpass%,, Hide
  StringTrimRight, dcomp, AHKfile, 3
  dcomp2 = %dcomp%new
  dcomp = %dcomp%ahk

  IfExist, %dcomp2%
  {
  msgbox,4,,Decompiled file already exists. Overwrite?  
  IfMsgBox, No
  {
  FileDelete, %dcomp2%
  MsgBox, File was not decompiled  
  return
  }
  else
  {
  FileMove, %dcomp2%, %dcomp%, 1
  }
  }
   
  IfExist, %dcomp%
  {
  MsgBox, Decompiled Ok. `r`n`r`n%AHKfile%
  msgbox,4,,Open file for editing with Notepad?  
  IfMsgBox, Yes
  {  
  Run, Notepad%A_Space%%dcomp%
  }
  }
  else
  {
  MsgBox, File was not decompiled
  }
}
dcomp=
dcompnew=
return
;-----------------------------------------------------------------------------------------------  
GuiClose:  
ExitApp

You can download here the Exe2Ahk.exe or download it using the script above. Remember that you can only decompile scripts that have no passwords. If you can decompiler scripts with passwords if you know the password basically. Happy decompiling.

Views: 7461 | Added by: GarenaZero | Tags: decompiler, autohotkey | Rating: 5.0/1
Total comments: 2
2 bilal shah  
0
asdasd

1 Bilal shah  
0
Nice

Name *:
Email *:
Code *: