diff --git a/BinMod.ahk b/BinMod.ahk index fca147e..b1ead55 100644 --- a/BinMod.ahk +++ b/BinMod.ahk @@ -1,5 +1,5 @@  -;@Ahk2Exe-SetVersion 2023.04.02 ; Edition: (y.m.d) +;@Ahk2Exe-SetVersion 2023.05.31 ; Edition: (y.m.d) ;@Ahk2Exe-SetCopyright TAC109 ;@Ahk2Exe-SetProductName BinMod ;@Ahk2Exe-SetDescription Binary file editor - see Ahk2Exe's PostExec directive @@ -63,9 +63,10 @@ ;@Ahk2Exe-Cont /SetUTC ; Set current UTC date and time 4. To encrypt the embedded script in the .exe with a random key and also provide - enhanced ScriptGuard security, add the next line: + enhanced ScriptGuard security, add one of the the following lines: ;@Ahk2Exe-Cont /ScriptGuard2 ; See bit.ly/ScriptGuard for more details + ;@Ahk2Exe-Cont /ScriptGuard2pss ; ('Permit /script switch') 5. To prevent the use of "UPX -d" to de-compress a UPX-compressed .exe add the following line to your script: (The 'example 0' lines are not needed here.) @@ -101,14 +102,13 @@ 3. /SetDateTime or /SetUTC - This parameter sets the compile time to the current date and time (local or UTC) in the generated .exe. - 4. /ScriptGuard2 - This parameter causes the embedded script to be encrypted - with a random key, and also adds extra security to the generated .exe. See - bit.ly/ScriptGuard for more details. + 4. /ScriptGuard2 or /ScriptGuard2pss - This parameter causes the embedded + script to be encrypted with a random key, and also adds extra security to + the generated .exe. The /ScriptGuard2pss version also permits the /script + switch to be used when running the compiled program, but prevents the + embedded script from being accessed when this switch is used. + See 'https://bit.ly/ScriptGuard' for more details. - --------------------------------------------------------------------------------- - The searching technique used was inspired by this post: - https://www.autohotkey.com/boards/viewtopic.php?f=76&t=13155 by gwarble. */ ; ================================ Program =================================== #NoEnv ; For performance & future compatibility @@ -133,8 +133,8 @@ Loop % %false% ; Number of parameters Date -= 1970, s ; Works until 19 Jan 2038! MS to fix NumPut(Date,Bin,A1+8,B.4), io("Alter",[4,A1+8]) } - else if (Par = "/ScriptGuard2") ; Remember ScriptGuard2 for later - SG2 := 1 + else if Par in /ScriptGuard2,/ScriptGuard2pss ; Remember ScriptGuard2 + SG2 := [Par, Par = "/ScriptGuard2" ? 1 : 2] else ; Process text replacements { while [1,1][Sep:=SubStr(Par,A_Index,1)] ; Get separator after '1's and '2's continue @@ -180,8 +180,8 @@ if (SG2) ; Process /ScriptGuard2 } DllCall("FreeLibrary", "Ptr",hMod) (Sa) ? 0 : ErrMes(SM "B4-" A_LastError ")`n`nScript not found.") - io("Open", FileName), par:="/ScriptGuard2", GetA1(), VarSetCapacity(L,0x50,0) - if NumPut(Bit,L,B.4) && NumPut(A1+0x28,L,0x4,B.4) && (k1=2) + io("Open", FileName), par:=SG2.1, GetA1(), VarSetCapacity(L,0x50,0) + if NumPut(Bit,L,B.1) && NumPut(A1+0x28,L,0x4,B.4) && (k1=2) Wk1:=GetA2(Mes,19,2), Wk:=GetA2(Mes,19,2,0), (!Wk)?Wk:=GetA2(Mes,19):0 ,(!Wk) ? ErrMes(SM "B5)") : (NumPut(Wk1.2,L,0x8,B.4),NumPut(Wk.2,L,0xc,B.4)) Wk:=np(SubStr(BinM,1,30),30,0x14,,,1), Rnd(2048,65535,,Bin,Wk,2) @@ -196,7 +196,7 @@ if (SG2) ; Process /ScriptGuard2 Wk:=np(";