How can I encrypt/decrypt an Autohotkey ( .ahk ) file on the fly?

1

I use autohotkey to put different password combinations into different apps or devices I access. I also have an RSA token for additional authentication. Using an .ahk file is not very safe security wise, if anyone ever got access into my desktop that would have my password. So, I have found away around this. First I execute the .ahk file which allows it to run in the taskbar. After it is running then I use 7zip to compress it with encryption and a password and DELETE the original text readable file. So, now the file can not be accessed unless it is unzipped, and if you try to edit the file in the taskbar it can't be read since the original is gone, but the hotkeys still work. The issue is that every time I reboot the machine I have to do this. I am not being lazy, I want to know what a true solution is.
Is it possible to encypt/decrypt the .ahk file on the fly so that it is only able to be read by the hotkey and not by a human?

This is the closest I could find to a solution, but I don't understand the steps to actually implement it.

https://autohotkey.com/board/topic/4147-small-and-fast-text-file-encryptor/

DjIns1ght

Posted 2016-07-22T22:28:51.970

Reputation: 65

Not familiar with AHK, but it sounds like you want an on-the-fly encryption tool like LUKS, eCryptfs, EncFS, etc. Wouldn't leave any un-encrypted files on the HD, etc – Xen2050 – 2016-07-23T09:10:42.713

What's the difference between what you're doing and just compiling it with the source code permanently zipped/locked up somewhere else? Not that you can't decompile an exe but it sounds about the same as what you're doing now without the hassle. After the script is compiled to exe it just goes in your startup folder and runs on boot. – JJohnston2 – 2016-07-24T04:24:38.183

I clarified a part above. "After it is running then I use 7zip to compress it with encryption and a password and DELETE the original text readable file. So, now the file can not be accessed unless it is unzipped, and if you try to edit the file in the taskbar it can't be read since the original is gone, but the hotkeys still work. " – DjIns1ght – 2016-07-24T16:42:34.873

So the issue here is that everytime I reboot the computer the file is zipped in the 7zip. I will have to unzip it and run the file to get it running in the taskbar again and then delete the file and 7zip it all over again. I want the autohotkey to decrypt and encrypt the .ahk file on the fly. It's not an .exe. It's an ahk file that contains text. It can be easily read by notepad. – DjIns1ght – 2016-07-24T16:50:20.457

Why would anyone vote this down? I don't understand how this site works. I am asking a legitimate question looking for a serious answer. – DjIns1ght – 2016-07-25T13:59:40.413

Answers

1

Try converting it into an .exe with the compiler. It makes it unreadable but there are also ways to 'decrypt' machine code. I know this is late but I just needed to look this up and came up with this solution.

Anonynoose

Posted 2016-07-22T22:28:51.970

Reputation: 11

Decrypting machine code is hard.   Finding text strings in executable files is easy. – Scott – 2019-02-05T07:32:12.740

Hmm. I guess you could try looping through a word with if statements? If a written, write b, if b written - write c, if c written - write d. This also could be recognized with pattern searches or something similar I guess – Anonynoose – 2019-02-11T09:36:14.860

0

zipping and unzipping is complete overkill.

The easiest thing to do is just use Windows Encrypted File System to encrypt the AHK files. To use this feature, right-click a file or folder, select Properties, and click the Advanced button on the General tab. Enable the Encrypt contents to secure data option. Files are essentially encrypted with your Windows user account password, so you’ll lose them if you forget your Windows password.

Keltari

Posted 2016-07-22T22:28:51.970

Reputation: 57 019

But...I can still read it. I want the file to be unreadable in plain text. – DjIns1ght – 2016-07-25T13:58:52.913