ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
JoeWinograd
Posts: 2214
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by JoeWinograd » 09 Apr 2024, 21:25

jsong55 wrote:Maybe I'll try UPX then.
Doesn't hurt to try it, but as I mentioned earlier, I've had terrible results over the years with it. Every so often I'll try UPX again, especially when there's been a new release, but the anti-virus/anti-malware programs always kill it. Once I found the sizing work-around for MPRESS, I've been happy with the results, although it gets very frustrating at times. I'm curious to hear how your tests go with UPX...and MPRESS. Please post back here to let us know. Regards, Joe

jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by jsong55 » 09 Apr 2024, 22:25

UPX works! Guess I'll stick to it for now. About the AntiVirus, it's a false positive so just have to put on allow list. I sometimes encounter Windows Defender trying to remove it even without any compression

User avatar
JoeWinograd
Posts: 2214
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by JoeWinograd » 10 Apr 2024, 00:05

jsong55 wrote:it's a false positive so just have to put on allow list
Yes, of course it's a false positive, and it's easy for you to whitelist, but if you distribute your programs to other users, it's problematic to get them to whitelist...that's extremely undesirable, especially when the false positive results in deletion of the executable.

jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by jsong55 » 10 Apr 2024, 00:16

Good point but let's not discuss in this thread.. is there a thread to tackle that?

User avatar
JoeWinograd
Posts: 2214
Joined: 10 Feb 2014, 20:00
Location: U.S. Central Time Zone

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by JoeWinograd » 10 Apr 2024, 16:48

jsong55 wrote:is there a thread to tackle that?
I don't know, but I think this is a fine place to discuss it. In TAC109's first post in this thread, he mentions MPRESS and UPX (in the ScriptGuard2 Restrictions section). Also, there are many other posts about compression/MPRESS/UPX during the almost four years since the thread began. That said, I've already posted most, if not all, of my relevant experience on the topic, but would be happy to keep brainstorming it here. Of course, if the author, TAC109, prefers to move discussion of this issue elsewhere, I'll certainly comply. Let's see if he gives us some direction on this. Regards, Joe

TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by TAC109 » 10 Apr 2024, 23:52

All good information.

Cheers
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

guest3456
Posts: 3469
Joined: 09 Oct 2013, 10:31

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by guest3456 » 11 Apr 2024, 20:24

TAC109 wrote:
22 Aug 2020, 20:11
ScriptGuard2 is available with Ahk2Exe v1.1.34.04b or later and can be used with AutoHotkey v1.1 and v2. It is 32-bit and 64-bit compatible. It can also be used with AutoHotkey_H v2, provided that the 'Encrypt Source' parameter is set to '(none)' in the Ahk2Exe_H GUI.
which is the better method of protection? the builtin AHK_H encryption, or ScriptGuard2?


jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by jsong55 » 11 Apr 2024, 21:17

I go with ScriptGuard as there are some differences in _H vs _L and I don't have time to modify too much code to adjust

TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by TAC109 » 11 Apr 2024, 23:14

@guest3456
There is a disadvantage with AutoHotkey_H in that to change the password used, it is necessary to modify it in the AHK_H source and recompile to generate a new AutoHotkey_H executable.

With ScriptGuard a different random password key is automatically generated to encode the source, each time a script is compiled with Ahk2Exe. This makes ScriptGuard simple to use.

Cheers
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

jsong55
Posts: 263
Joined: 30 Mar 2021, 22:02

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by jsong55 » 12 Apr 2024, 02:09

@TAC109 can we request a feature to use our own password? Say from a disposable ini file.

TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by TAC109 » 12 Apr 2024, 20:44

@jsong55 Could you explain the reason for your request, please.

Cheers
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

helloicanseeu
Posts: 7
Joined: 30 Nov 2023, 01:32

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by helloicanseeu » 13 Apr 2024, 20:23

i using scriptguard for a while, everything was fine, until today
i keep getting
image.png
image.png (16.9 KiB) Viewed 1560 times
can only compile when i disable scriptguard, any idea?

TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by TAC109 » 14 Apr 2024, 03:21

@helloicanseeu
It looks like you usually compile with a *.bin base file. Have you inadvertently tried to compile using a *.exe base file?

If you wish to continue to compile against an *.exe base file in future you will need to change the relevant ;@Ahk2Exe- lines in your script. (See the summary in the main ScriptGuard post for generalised code that covers both these base file situations.)

Cheers
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

helloicanseeu
Posts: 7
Joined: 30 Nov 2023, 01:32

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by helloicanseeu » 14 Apr 2024, 07:05

TAC109 wrote:
14 Apr 2024, 03:21
@helloicanseeu
It looks like you usually compile with a *.bin base file. Have you inadvertently tried to compile using a *.exe base file?

If you wish to continue to compile against an *.exe base file in future you will need to change the relevant ;@Ahk2Exe- lines in your script. (See the summary in the main ScriptGuard post for generalised code that covers both these base file situations.)

Cheers
i looked at earlier posts and stumbled into version issues, the autohotkey updated itself somehow and that's why it didnt work.
i reinstalled an earlier ahk v1 version and could compile again, tyty for your tremendous effort.
these version issues break a lot of stuff, i remember in linux lol.

TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by TAC109 » 14 Apr 2024, 17:04

@helloicanseeu
ScriptGuard should work with all recent versions of AutoHotkey v1.1 and v2, so I suspect that something else is going on here.

Could you please supply more details about the problem you experienced, including a screenshot of Ahk2Exe with parameters supplied, and the ;@Ahk2Exe- lines in the source that you tried to compile? This will enable me to troubleshoot this problem more fully.

Thanks for your help with this.
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

william_ahk
Posts: 512
Joined: 03 Dec 2018, 20:02

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by william_ahk » 19 May 2024, 09:41

I'm curious about how ScriptGuard2 works. Where is the random password stored? How safe is it?

TAC109
Posts: 1129
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by TAC109 » 19 May 2024, 17:34

ScriptGuard is about as safe as any other method of encrypting the source. The random password is stored as a binary blob embedded in the generated machine code. Additionally there is a string of random data that is used to prime the algorithm prior to source encryption.

Cheers
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

User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: ScriptGuard: Helps Protect Compiled Scripts from Decompilation

Post by thqby » 20 May 2024, 00:09

I don't think any externally implemented encryption method prevents reading the AHK source code from resources after decryption and before the program entry function runs.

Post Reply

Return to “Scripts and Functions (v1)”