发表回复 
AHK源代码加密器 v2.6
2017-12-09, 13 : 43 (这个帖子最后修改于: 2018-09-14 17 : 35 by feiyue.)
Rainbow AHK源代码加密器 v2.6
这是AHK源代码加密工具,作为第一层加密,之后可以用Ahk2Exe编译为程序。
由于AHK官方支持开源,结果Ahk2Exe编译的程序(不使用mpress压缩),
在程序末尾明文保存了源代码,不利于发布私有成果。即使压缩、加壳也很容易
转存出来。这个工具可以使Ahk2Exe生成的程序被破解的源代码已加密。Shy

本来界面和说明是用中文的,只是最新版本在官网发布成英文的了,懒得改了,反正使用很容易,拖动一下就生成加密脚本了。

代码: (全选)
/*
;-------------------------------
  AHK source code Encryptor v2.6  By FeiYue

  1. This tool can encrypt the AHK script into a self decode script.

  2. Then you can use ahk2exe to compile the script into a program,
     combined with mpress.exe or upx.exe packers.
     Note: To compile the script, you must have a AutoHotkey.exe
     in the script directory.

  3. When you want to use the directory relative to the script(eg 001.jpg),
     Don't use A_ScriptDir, but use A_WorkingDir. It is recommended to backup
     the working directory to a variable at the beginning of the script,
     Then change the path to absolute path based on the variable (eg %dir%\001.jpg).

  4. When you want to Reload your own script, the built-in Reload command will fail,
     You can use Reload() function instead (it's added when encrypted).

;-------------------------------
*/

#NoEnv
#SingleInstance force
ListLines, Off
SetBatchLines, -1
Version = 2.6

fs=
(` %

Exec(str, Ahk="", arg="") {
  static MyFunc, base, ScriptName:=%True%
  s:=RegExReplace(str,"\s"), StrReplace(s,"u","",size)
  VarSetCapacity(str,(size+1)*4,0), s:=SubStr(s,InStr(s,"u")+1)
  Loop, Parse, s, u
    if (A_Index<=size)
      NumPut(A_LoopField, str, (A_Index-1)*4, "uint")
  ;-----------------------------
  Ahk:=Ahk ? Ahk : A_IsCompiled
    ? A_ScriptDir "\AutoHotkey.exe" : A_AhkPath
  IfNotExist, %Ahk%
  {
    MsgBox, 4096, Error!, `n`nCan't Find: %Ahk% !`n`n
    return, 0
  }
  if !MyFunc
  {
    x32:="5557565381EC3C0100008B9C24580100008BBC245C01000"
    . "08B433C01D88038500F85EE040000807801450F85E40400008"
    . "B4864BA8800000085C90F85C30400008B2C1001DD8B4D188B5"
    . "52085C90F849E04000031C08D3413EB118DB60000000083C00"
    . "139C10F84860400008B1486813C134765745075E9817C13047"
    . "26F634175DF8D04430345240FB7008D048303451C8B3085F60"
    . "F8457040000BD6500000001DEC74424505772697466896C245"
    . "88D6C2450C74424546546696C891C24896C2404FFD683EC088"
    . "944243CC744241000000000896C240CC744240800000000897"
    . "C2404C7042400000000FFD083EC14807C2450000F855804000"
    . "08D44247DBA73410000891C246689942489000000C744247D4"
    . "3726561C784248100000074655072C78424850000006F63657"
    . "3C684248B0000000089442404FFD683EC08894424448D44246"
    . "5891C24C7442465476C6F62C7442469616C416CC744246D6C6"
    . "F630089442404FFD683EC0889C5B9656500008D44245A66894"
    . "C2462891C24C744245A476C6F62C744245E616C4672C644246"
    . "40089442404FFD683EC08894424488D8424AE000000891C24C"
    . "78424AE00000043726561C78424B200000074654E61C78424B"
    . "60000006D656450C78424BA00000069706541C68424BE00000"
    . "00089442404FFD683EC08894424408D8424BF000000891C24C"
    . "78424BF000000436F6E6EC78424C30000006563744EC78424C"
    . "7000000616D6564C78424CB00000050697065C68424CF00000"
    . "00089442404FFD683EC088944244C8D442471891C24C744247"
    . "1436C6F73C74424756548616EC7442479646C650089442404F"
    . "FD683EC08894424388B842460010000C70424000000008D048"
    . "5040000008944243489442404FFD583EC0885C089C30F84DB0"
    . "20000C784248C0000000B000000C78424900000000D000000B"
    . "A0B000000C784249400000011000000C784249800000013000"
    . "00031C0EB0C89C283E2038B94948C00000069D28300000089C"
    . "183E10301C283C00183F86489948C8C00000075D88B8424600"
    . "1000085C00F84610200008B8C246001000031D289D683E6036"
    . "984B48C0000008300000001D08984B48C000000330497C1C80"
    . "883C00189049383C20139D175D48B44243483E804C70403000"
    . "000008B842454010000C744241C00000000C74424180000000"
    . "0C744241400000000C744241000000000C744240CFF000000C"
    . "744240800000000C7442404020000008904248B7C2440FFD78"
    . "3EC2083F8FF89C50F84CF0100008B842454010000C744241C0"
    . "0000000C744241800000000C744241400000000C7442410000"
    . "00000C744240CFF000000C744240800000000C744240402000"
    . "000890424FFD783EC2083F8FF89C60F848B0100008DBC24D00"
    . "0000031C0B918000000F3AB8D84249C000000C78424D000000"
    . "044000000C78424D400000000000000C744241C00000000C74"
    . "4241800000000894424248D8424D0000000C74424140000000"
    . "0C744241000000000C744240C00000000894424208B8424500"
    . "10000C744240800000000C704240000000089442404FF54244"
    . "483EC2885C00F85B70000008B7C244C892C24C744240400000"
    . "00089F8FFD083EC08892C248B6C243889E8FFD083EC0489F88"
    . "93424C744240400000000FFD083EC088D84248C000000895C2"
    . "404893424C7442410000000008944240C8B44243489442408F"
    . "F54243C83EC1489E8893424FFD083EC04891C24FF54244883E"
    . "C0431C081C43C0100005B5E5F5DC21400B8FEFFFFFF81C43C0"
    . "100005B5E5F5DC214008378600119D283E21083C278E92CFBF"
    . "FFF81C43C010000B8FFFFFFFF5B5E5F5DC214008B84249C000"
    . "0008B7C243889042489F8FFD083EC048B8424A000000089042"
    . "489F8FFD083EC04E91EFFFFFFB8FDFFFFFFEB9E31C0E9D4FDF"
    . "FFFB8FBFFFFFFEB90B8FCFFFFFFEB89892C24FF542438B8FAF"
    . "FFFFF83EC04E975FFFFFF9090"
    x64:="4157415641554154555756534881EC98010000B8FFFFFFF"
    . "F8BAC24000200004889D6418B503C48898C24E00100004D89C"
    . "44D89CE4C01C2803A500F852A040000807A01450F852004000"
    . "0448B4264B8880000004585C00F8529040000448B0C02B8FEF"
    . "FFFFF4D01E1418B4918418B512085C90F84F203000031C04D8"
    . "D0414EB0C4883C00139C10F86F2030000418B148041813C144"
    . "765745075E641817C1404726F634175DB418B5124498D04440"
    . "FB71410418B411C498D14948B1C0285DB0F84BA030000488D7"
    . "C247048B8577269746546696CB9650000004C01E366894C247"
    . "848894424704889FA4C89E1FFD34531C031C94989C548C7442"
    . "420000000004989F94C89F241FFD5807C247000B8FDFFFFFF0"
    . "F855303000048B843726561746550724C89E1488D9424B0000"
    . "00048898424B0000000B873410000C78424B80000006F63657"
    . "366898424BC000000C68424BE00000000FFD3488944245848B"
    . "8476C6F62616C416C4C89E1488D94249000000048898424900"
    . "00000C78424980000006C6F6300FFD3BA65650000488944245"
    . "048B8476C6F62616C46724C89E166899424880000004889842"
    . "480000000488D942480000000C684248A00000000FFD348894"
    . "4246048B84372656174654E614C89E148898424D000000048B"
    . "86D65645069706541488D9424D000000048898424D8000000C"
    . "68424E000000000FFD34889C748B8436F6E6E6563744E4C89E"
    . "148898424F000000048B8616D656450697065488D9424F0000"
    . "00048898424F8000000C684240001000000FFD34989C748B84"
    . "36C6F736548616E4C89E1488D9424A000000048898424A0000"
    . "000C78424A8000000646C6500FFD34989C48D04AD040000003"
    . "1C94C8B4424508944246C89C241FFD04885C04889C30F84360"
    . "20000C78424C00000000B000000C78424C40000000D000000B"
    . "A0B000000C78424C800000011000000C78424CC00000013000"
    . "00031C0EB0C89C283E2038B9494C000000069D28300000089C"
    . "183E10301C283C00183F86489948CC000000075D885ED0F84C"
    . "301000031D24889D183E10369848CC00000008300000001D08"
    . "9848CC000000041330496C1C80883C0018904934883C20139D"
    . "577D189E848C1E002C70403000000004531C048C7442438000"
    . "00000C744243000000000C74424280000000041B9FF000000C"
    . "744242000000000BA020000004889F1FFD74883F8FF4889C50"
    . "F844B0100004531C04889F148C744243800000000C74424300"
    . "0000000C74424280000000041B9FF000000C74424200000000"
    . "0BA02000000FFD74883F8FF4889C60F8418010000488DBC243"
    . "001000031C0B90C0000004531C94531C0488B9424E0010000F"
    . "348AB488D84241001000048C78424300100004400000048C74"
    . "424380000000048C744243000000000C744242800000000488"
    . "9442448488D842430010000C74424200000000048894424404"
    . "88B442458FFD085C0757531D24889E941FFD74889E941FFD43"
    . "1D24889F141FFD74C8D8C24C0000000448B44246C4889DA488"
    . "9F148C74424200000000041FFD54889F141FFD44889D9488B4"
    . "42460FFD031C04881C4980100005B5E5F5D415C415D415E415"
    . "FC3B8FEFFFFFFEBE5837A60014819C083E0104883C078E9C4F"
    . "BFFFF488B8C241001000041FFD4488B8C241801000041FFD4E"
    . "970FFFFFF31C0E96DFEFFFFB8FBFFFFFFEBA9B8FCFFFFFFEBA"
    . "24889E941FFD4B8FAFFFFFFEB959090"
    hex:=A_PtrSize=8 ? x64:x32
    VarSetCapacity(MyFunc, len:=StrLen(hex)//2)
    Loop, % len
      NumPut("0x" SubStr(hex,2*A_Index-1,2),MyFunc,A_Index-1,"uchar")
    DllCall("VirtualProtect","ptr",&MyFunc,"ptr",len,"uint",0x40,"ptr*",0)
    base:=DllCall("GetModuleHandle", "Str","Kernel32", "ptr")
    ScriptName:=ScriptName ? ScriptName : A_ScriptFullPath
  }
  Random, n, 1, 1000000
  name:="\\.\pipe\AHK" . A_TickCount . n
  cmd="%Ahk%" "%name%" "%ScriptName%" %arg%
  DllCall(&MyFunc, "AStr",cmd, "AStr",name
  , "ptr",base, "ptr",&str, "uint",size)
  return, 1
}

)

if 0>0
{
  file:=%True%
  IfExist, %file%
    Gosub, Encrypt
  ExitApp
}
Gui, +AlwaysOnTop +ToolWindow
Gui, Color, DDEEFF
Gui, Font, cRed s28
Gui, Add, Text,, Drag the AHK script here to Encrypt`n`n
Gui, Show,, AHK source code Encryptor v%Version%  -  By FeiYue
OnMessage(0x201, "LButton_Down")
LButton_Down() {
  SendMessage, 0xA1, 2
}
return

GuiClose:
ExitApp

GuiDropFiles:
Gui, +OwnDialogs
Loop, parse, A_GuiEvent, `n
{
  file:=A_LoopField
  MsgBox, 4100, Tip, Do you want to encrypt this file ?`n`n%file%
  IfMsgBox, Yes
    Gosub, Encrypt
  MsgBox, 4096, Tip, Encryption is completed !
}
return

Encrypt:
FileRead, s, %file%
s:= "`n;You can compile and set icons by using Ahk2Exe.exe`n"
  . "`n;If AutoHotkey.exe wants to change its name to abc.exe,"
  . " Please modify Ahk=%A_ScriptDir%\abc.exe`n"
  . "`n #NoEnv"
  . "`n #NoTrayIcon"
  . "`n #SingleInstance off"
  . "`n SetBatchLines, -1"
  . "`n if A_IsCompiled"
  . "`n {"
  . "`n   Ahk=%A_ScriptDir%\AutoHotkey.exe"
  . "`n   FileInstall, AutoHotkey.exe, %Ahk%"
  . "`n }"
  . "`n else Ahk="
  . "`n`ns=`n"
  . RegExReplace(Encode(s),".{1,60}","s.=""$0""`n")
  . "`n Exec(s, Ahk)"
  . "`n ExitApp`n"
  . fs
f:=RegExReplace(file,"\.[^.]+$") . "-encoded.ahk"
FileDelete, %f%
FileAppend, %s%, %f%
return

Encode(s) {
  static MyFunc
  if !MyFunc
  {
    x32:="5653BA0B00000031C083EC108B5C241C8B742420C704240"
    . "B000000C74424040D000000C744240811000000C744240C130"
    . "00000EB0889C283E2038B149469D28300000089C183E10301C"
    . "283C00183F86489148C75E031C085F6742B908D74260089C18"
    . "3E10369148C8300000001C289148C8B0C8383E901C1C10831C"
    . "A89148383C00139C675DA83C41031C05B5EC20800"
    x64:="4883EC1841B80B00000031C0C704240B000000C74424040"
    . "D000000C744240811000000C744240C13000000EB0E0F1F004"
    . "189C04183E003468B04844569C0830000004189C14183E1034"
    . "101C083C00183F8644689048C75D831C085D2743366904989C"
    . "1448B14814183E1034669048C830000004101C04689048C458"
    . "D4AFF41C1C1084531C8448904814883C00139C277CF31C0488"
    . "3C418C39090909090909090"
    hex:=A_PtrSize=8 ? x64:x32
    VarSetCapacity(MyFunc, len:=StrLen(hex)//2)
    Loop, % len
      NumPut("0x" SubStr(hex,2*A_Index-1,2),MyFunc,A_Index-1,"uchar")
    DllCall("VirtualProtect","ptr",&MyFunc,"ptr",len,"uint",0x40,"ptr*",0)
  }
  add=
  (%
;-----------------------
ListLines, Off
My_ScriptName:=%True%
Try Menu, Tray, Icon, %My_ScriptName%
Gui, SingleInstance_force:Show, Hide, [%My_ScriptName%]
Gui, SingleInstance_force:+HwndMy_guiid
DetectHiddenWindows, On
WinGet, My_list, List, [%My_ScriptName%] ahk_class AutoHotkeyGUI
Loop, % My_list {
  IfEqual, My_guiid, % My_id:=My_list%A_Index%, Continue
  WinGet, My_pid, PID, ahk_id %My_id%
  WinClose, ahk_class AutoHotkey ahk_pid %My_pid%
  WinWaitClose, ahk_id %My_id%
}
DetectHiddenWindows, Off
SetWorkingDir, % RegExReplace(My_ScriptName,"\\[^\\]*$")
;-----------------------
Reload() {
  static My_ScriptName:=%True%
  Try {
    if My_ScriptName=
      return
    else if InStr(My_ScriptName,".exe")
      Run, "%My_ScriptName%"
    else
      Run, "%A_AhkPath%" "%My_ScriptName%"
    ExitApp
  }
}
ListLines, On
;-----------------------
  )
  s:=add "`n" s "`nExitApp`n#SingleInstance off`n"
  s:=(A_IsUnicode ? chr(0xfeff) : chr(0xEF) chr(0xBB) chr(0xBF))
    . RegExReplace(s,"\R","`r`n") . "`t`t`t"
  size:=VarSetCapacity(s,-1)//4
  VarSetCapacity(str, size*11*(!!A_IsUnicode+1))
  DllCall(&MyFunc, "ptr",&s, "int",size)
  Loop, % size
    str.="u" . NumGet(s,(A_Index-1)*4,"uint")
  return, str
}

;======== The End ========

;
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-01-10, 20 : 50
RE: AHK源代码加密器 v1.0
你好。我试用了下。加密之后再用Ahk2Exe编译后,文件夹下必须有AutoHotkey.exe才能运行。
然后加密文件的注释里有一句:如果不想采用AutoHotkey.exe请修改Ahk=
可我不知道改哪里好。
能否有个怎么改AHK的说明?
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-01-11, 11 : 08 (这个帖子最后修改于: 2018-01-11 11 : 09 by feiyue.)
RE: AHK源代码加密器 v1.0
由于是调用AHK主程序(AutoHotkey.exe)动态运行,所以同目录下必须有AHK主程序。
如果将AutoHotkey.exe改名为abc.exe,请修改Ahk=%A_ScriptDir%\abc.exe
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-01-14, 14 : 54
RE: AHK源代码加密器 v1.5
就是想留个名,ahk8挂了之后也没有太在意,找的时候真的是转了一大圈才找到这里,还好好像所有数据都在
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-03-06, 17 : 32
RE: AHK源代码加密器 v1.5
不错!支持楼主!Ahk就是这点不好,有ahk2EXE,就有EXE2ahk。感觉没有可靠的方法加密。
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-05-14, 22 : 51
RE: AHK源代码加密器 v2.0
更新到v2.0版,大大增强了防破解能力。欢迎大家试用。

有人说通过任务管理器的创建转储文件,再解析转储文件中的字符串,可以得到内存中的源代码,
我实验了一下,确实可以解析出一些零碎的代码,但是非常缺漏和不连贯,难以得到完整的源代码。
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
2018-08-24, 15 : 45 (这个帖子最后修改于: 2018-08-28 16 : 14 by feiyue.)
RE: AHK源代码加密器 v2.5
更新到v2.5版,再次加强了防破解能力。但还是防菜鸟防不了大神。
查找这个用户的全部帖子
表示感谢 引用并回复 移动视图置页面顶端
发表回复 


论坛跳转:


联系我们 | Autohotkey 中文站 | 回到顶部 | 回到正文区 | 精简(归档)模式 | RSS 聚合