Decryptin' the VBScriptin'22 Jul 2008
A couple of days ago I posted about using NoteTab to ease the encryption of VBS files to VBE files using Microsoft’s Script Encyption utility. I mentioned at the time that this encyption was in fact reversible. So today I’m going to show you how this is achieved.
First of all I’ll show you the little NoteTab clipbook clipping that I have to run this decryption.
H="Decode" ^!Dos "^$GetScriptPath$^$GetValue("X-VBS:Decoder")$" "^$GetDocName$"
The INI file entry to go with this is…
A quick look through this will reveal a very simple NoteTab command and a rather interesting looking VBScript - decoder.vbs. I never said that NoteTab was going to do all the work, and in this particular instance because I do all my VBS work in NoteTab it simply made sense for me to have this in the same clipbook.
So this mysterious decoder script. Well I’m afraid I can’t take credit for it, but what I can do is point you in the right direction to find it.
Just copy the script from the page above and pop it into a VBS file called decoder.vbs in a Decoder directory in your NoteTab installation’s Scripts directory.
Load the VBE file into NoteTab (it doesn’t matter if you get a message saying it won’t load it all) and then run the Decode clip. This will then deposit the decypted file in the same directory as your original VBE file.
There are lots of additional things you may wish to consider doing with the clip and script. Perhaps immediately opening the VBS script in NoteTab for example.
At the end of the day this just helps you decrypt someone else’s encrypted VBScript or perhaps retrieve your own source code. It certainly isn’t secure enough to hard code passwords and the like into (not that you ever would of course!). So as far as securing your VBScript encryption seems to be a no go and so at this point you might think we’re out of luck.
Ah but you can already tell I’m going somewhere with this can’t you.? I always do end up leading people to something a little better and hopefully this is no exception.
The problem with the encryption is that Windows needs to decrypt it to run the instructions and so it is always going to be decryptable. So what happens with software? Is that encrypted? Software is usually compiled and whilst it can often be decompiled and reassembled into some sort of code base it is less trivial and a reasonable option most of the time. So is it possible to compile a VBScript into an exceutable?
The answer is yes and I’ll be covering that in another post so keep checking back!