Encryption of VBS file

Share and Enjoy !

Today i got a question on VBS file encoding from Srinivas…
Srini i really never encoded a vbs file but yes i know that can be done..
there are popular solution given in hereIt looks like you have already encoded your script, but as a reference for those who would like more information about encoding their SecureCRT scripts, here is how it is done.

There are two other ActiveX script engines besides “VBScript” and “JScript” that are known as “VBscript.Encode” and “JScript.Encode”. These script engines appear to be identical except for the fact that they decode input that has been encoded before executing it.

In order to encode scripts, you’ll need to download the “Windows Script Encoder” from Microsoft. Here’s a link to an overview of the script encoder technology:
The way the script encoder works with (Windows Script Host) WSH scripts is you simply take your *.vbs or *.js scripts and run them through the encoder and create new output files named *.vbe or *.jse, respectively.

SecureCRT requires that its own headers being present as the first lines of the script file. As with all SecureCRT scripts, you need to include these headers in plain text.

With an encoded script, these headers must still be in plain text so that SecureCRT can read them. There is a special comment which tells the script encoder where to begin encoding:
‘**Start Encode**
Including this comment after the required SecureCRT script headers will ensure that SecureCRT will be able to load the correct script engine.

See also  Frequently Asked Coding Questions During Interview on UFT

With respect to the “correct” script engine to use, this is where the SecureCRT script headers come in to play again. Normally, the script header for a SecureCRT script that uses the VBScript engine would look like:
# $language = “VBScript”
# $interface = “1.0”
An encoded script is actually interpreted by a different script engine, so the SecureCRT script headers must reflect this as well:
# $language = “VBScript.Encode”
# $interface = “1.0”
If you are using JScript as your language, the header would follow the same pattern:
# $language = “JScript.Encode”
# $interface = “1.0”

The following steps provide an example of using the
Microsoft script encoder with a SecureCRT script:
Take the following example VBScript for (called “plain.vbs”). Note that the “$language” header tag is now specified as “VBScript.Encode”. Also, note the existence of the ‘**Start Encode** comment:

# $language = “VBScript.Encode”
# $interface = “1.0”
‘**Start Encode**

Sub Main()
MsgBox “This is an encoded script!”
End SubAt a shell prompt, run the Microsoft script encoder to encode “plain.vbs” to the output file named “encoded.vbe”:
screnc plain.vbs encoded.vbe

If you open “encoded.vbe” in Notepad (or your favorite text/code editor) it should look now look something like this:

# $language = “VBScript.Encode”
# $interface = “1.0”
‘**Start Encode**#@~^WgAAAA=as;dlka;23=-sdfl93jfje8*()#*%^sl,>/w.3dke…….Now you should be able to run “encoded.vbe” from within SecureCRT.


Share and Enjoy !

4 thoughts on “Encryption of VBS file

  1. Animesh i go to through you blog , i think that it will be very helpful for us who work in the software testing field.

    In the recent opening section please listed the openings for the manual tester jobs also and i have one request if possible can u add any model test strategy or test cases for testing Ecommerce site and community based websites.

    during browsing your blog i found a verical line in the right panel in both Firefox and I.E browser and the due to font color some content of the top right panel is very difficult to read.

    On the whole i will acknowledge that it is a nice effort from your site hope it will help us in the coming days.

  2. Hie Guys,

    I am trying to encode my vb script, and I have
    tried downloading Microsoft Script Encoder and encoding, but I am not able to run neither in windows run nor from command prompt.

    Could you be more clear, like how to download the microsoft encoder and then encoding a file?


  3. It is in reality a great and useful piece of information. I am happy that you simply shared this useful info with us.
    Please keep us informed like this. Thanks for sharing.

Leave a Reply

Your email address will not be published. Required fields are marked *