v2 encryptor Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

v2 encryptor

30 Apr 2024, 22:18

hello.
i have two things i want to achieve.
1. first i want to understand how feiyue's encryptor works ( viewtopic.php?t=42494 ) does it first take the script and run it and directly delete it from memory using TAC's scriptguard function? then it "salts" it with the algorithm we predefined (or actually still using the default for now until i can wrap my head around it) in the decode() and encode() functions? also how do we decode it to run it on a target computer?
2. is there a v2 version? can we use joe glines / mmikey's v2 converter and it would work??

thanks in advance
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: v2 encryptor

01 May 2024, 02:01

marypoppins_1 wrote: can we use joe glines / mmikey's v2 converter and it would work??
The v2 converter scripts provide a first pass at converting a script, but they typically require a lot of manual follow-up to fix what they weren’t able to translate correctly for all but the simplest of scripts.
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

01 May 2024, 08:21

so we would have to wait for feiyue to update his encoding script to v2?
also how can we use it in v1 to decode / encode i don't quite get it
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: v2 encryptor

01 May 2024, 09:16

marypoppins_1 wrote: so we would have to wait for feiyue to update his encoding script to v2?
Not sure how you got that from what I said. I said there would be some manual follow-up required. If you're not able to translate it yourself, then I suppose the answer is yes, you need to wait for feiyue or someone else to translate it.

Having said that, part of his script contains machine code for which the source isn't provided, so only he could answer whether that code is specific to v1 code or it would work as long as the rest of the script is converted to v2.
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

01 May 2024, 09:40

okay thank you.
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

01 May 2024, 11:15

if i want to get back to my subject: (in AHK V2)
1. i want to hide the fact that the executable is written in ahk, is it possible ??(by default even with upx or mpress it would still show "autohotkey" when dropped into notepad)
2. i want to at least encode / obfuscate the code so that even if the person knows its written in ahk, it would be really hard to get the source code, is it possible?
3. as an extension to question 2, is it reasonable / possible to convert the code into machine code or something to make it harder to find the source code??
User avatar
boiler
Posts: 17706
Joined: 21 Dec 2014, 02:44

Re: v2 encryptor

01 May 2024, 12:58

marypoppins_1 wrote: 1. i want to hide the fact that the executable is written in ahk, is it possible ??(by default even with upx or mpress it would still show "autohotkey" when dropped into notepad)
People who know what they're doing will be able to extract it with just compression approaches. Your best bets are probably true encryption approaches such as feiyue's tool or password protect using AHK_H (which requires re-compiling AHK_H with your password so that it's unique). I don't have experience with either. There are many threads on source protection on the forum, so search for them.

marypoppins_1 wrote: 2. i want to at least encode / obfuscate the code so that even if the person knows its written in ahk, it would be really hard to get the source code, is it possible?
If it's simply obfuscated, it's still easy to get to the source code, it's just harder to follow what it's doing. If it's truly encrypted, then I would think it would be very difficult.

marypoppins_1 wrote: 3. as an extension to question 2, is it reasonable / possible to convert the code into machine code or something to make it harder to find the source code??
No, it's not possible to compile AHK scripts to machine code. It must be a script in some form wrapped with the AHK interpreter.
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

01 May 2024, 13:49

very informative. thank you boiler
TAC109
Posts: 1155
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: v2 encryptor

01 May 2024, 20:32

I don’t know if you have looked at ScriptGuard (link in my sig), but it is a straightforward way of encrypting a script during the Ahk2Exe compilation process.

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
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

01 May 2024, 23:11

hello, i actually have but i thought feiyue's way was the most rock-solid for anti-decompilation. anyway, i gave it a read but didn't understand much the scripguard 2() function, i'll recheck it later today and get back to you. thank you tac

edit 1: it worked and meets my expectations, thank you.
1. what is the ;@[something here] for??
2. is the scripguard1.ahk code v1 code or can i run it with v2 executable?
3. when compiling my v1 or v2 code (i have added the snippet in the "summary" in tac's post viewtopic.php?f=6&t=80229), do i use mpress / upx or do i only use "none" in the compiler for this to work??
TAC109
Posts: 1155
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: v2 encryptor

02 May 2024, 17:37

marypoppins_1 wrote:
01 May 2024, 23:11
1. what is the ;@[something here] for??
This is the format for Compiler Directives, which have meaning to the Ahk2Exe compiler but are ignored when the script is run directly. See this link for more information.
2. is the scripguard1.ahk code v1 code or can i run it with v2 executable?
The ScriptGuard1.ahk code is written to be compatible with both v1.1 and v2 without alteration.
3. when compiling my v1 or v2 code (i have added the snippet in the "summary" in tac's post viewtopic.php?f=6&t=80229), do i use mpress / upx or do i only use "none" in the compiler for this to work??
It is your choice as to whether to use compression or not. If you use UPX, there is code in the 'Summary snippet' to prevent the use of 'UPX -d' to uncompress the compiled script - this can be removed if necessary (it is the second-to-last line in the summary snippet). Alternatively you can compress with Mpress if desired. The advantage of compressing the encrypted compiled script is to further disguise that the .exe is a compiled AutoHotkey script.

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
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

02 May 2024, 23:06

so if i didn't misunderstand.
1. when i copy the snippet in summary, by default it does not allow uncompile script if its compressed with upx.??
2. if its done with mpress same thing??
3. the third line from the end, how can we change the parameter passed and i didn't really understand the difference if you can provide a simpler explanation?

Code: Select all

;@Ahk2Exe-Cont  /ScriptGuard2  ; or /ScriptGuard2pss if required
thank you
TAC109
Posts: 1155
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: v2 encryptor  Topic is solved

03 May 2024, 05:21

marypoppins_1 wrote:
02 May 2024, 23:06
so if i didn't misunderstand.
1. when i copy the snippet in summary, by default it does not allow uncompile script if its compressed with upx.??
2. if its done with mpress same thing??
ScriptGuard encrypts the script so that the script cannot be viewed in the compiled .exe. Additionally, if you then compress the compiled .exe by selecting this in Ahk2Exe, this will hide ‘AutoHotkey' strings from casual inspection in the .exe, which you were requesting in one of your previous posts in this thread.
3. the third line from the end, how can we change the parameter passed and i didn't really understand the difference if you can provide a simpler explanation?

Code: Select all

;@Ahk2Exe-Cont  /ScriptGuard2  ; or /ScriptGuard2pss if required
This line should be either:

Code: Select all

;@Ahk2Exe-Cont  /ScriptGuard2    ; The usual option
or

Code: Select all

;@Ahk2Exe-Cont  /ScriptGuard2pss ; 'Permit /Script Switch'
The second case allows the compiled .exe to be used as an AutoHotkey interpreter using the /script parameter, whereas the first case doesn’t allow this. I would expect that you will want to use the first one.

Cheers
Last edited by TAC109 on 03 May 2024, 05:51, edited 1 time in total.
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
marypoppins_1
Posts: 142
Joined: 28 Oct 2020, 02:58

Re: v2 encryptor

03 May 2024, 05:47

okay this clears it all thank you. have a great day!

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Descolada, Sacho and 39 guests