Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 09-09-2005, 04:18 AM
liufirst liufirst is offline
Registered User
 
Join Date: Aug 2005
Posts: 27
Is there any way to encode the script ?

When I finished the script, I am trying to encode it. But when I uses screnc.exe file from microsoft to encode the script, the script would not run. Is there any way to encode the script and protect it ?
Reply With Quote
  #2  
Old 09-09-2005, 10:12 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 919
It 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:
http://msdn2.microsoft.com/en-us/library/d14c8zsc.aspx
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.

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:
  1. 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:
    Code:
        # $language = "VBScript.Encode"
        # $interface = "1.0"
        '**Start Encode**
    
        Sub Main()
            MsgBox "This is an encoded script!"
        End Sub
  2. At a shell prompt, run the Microsoft script encoder to encode "plain.vbs" to the output file named "encoded.vbe":
    screnc plain.vbs encoded.vbe
  3. If you open "encoded.vbe" in Notepad (or your favorite text/code editor) it should look now look something like this:
    Code:
        # $language = "VBScript.Encode"
        # $interface = "1.0"
        '**Start Encode**#@~^WgAAAA=as;dlka;23=-sdfl93jfje8*()#*%^sl,>/w.3dke.......
  4. Now you should be able to run "encoded.vbe" from within SecureCRT.
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support

Last edited by jdev; 12-20-2007 at 02:01 PM.
Reply With Quote
  #3  
Old 09-10-2005, 07:07 AM
liufirst liufirst is offline
Registered User
 
Join Date: Aug 2005
Posts: 27
Thanks

Thanks for your answer. It works. But who'll answer
http://forums.vandyke.com/showthread.php?t=1006
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 02:39 AM.