Protecting VBScript and ASP code only in marked sections of code

Introduction to support for obfuscation of VBScript code surrounded by delimiters

Stunnix VBScript Obfuscator can obfuscate VBScript code only between certain strings. This is useful if you wish to keep some parts of your code totally unchanged, or if your VBScript is intermixed with some other high-level language.

When such support for delimiters is enabled, Stunnix VBScript Obfuscator scans input file for code start delimiter, and protects the VBScript till it encounters end delimiter.

You can define several different strings as start delimiter; also you can define several different strings as end delimiter. Once Stunnix VBScript Obfuscator encounters any variant of start delimiter, it will start protecting VBScript code, and it will stop mangling VBScript code once it encounters any version of end delimiter.

Start/end delimiter can be arbitrary sequence of characters except newline; it can contain spaces, characters used for operators or characters that mark up the comment. It is common practice to make start delimiter and end delimiter a single-line comment containg some keyword, so delimited code would look like this:

'CODESTART
  abc=def+42;
'CODEEND

- this way, code with delimiters will still be syntactically correct VBScript code.

Configuring project for obfuscating VBScript code surrounded by delimiters

Let's create a new processing mode that will enable protection of VBScript code only surrounded by delimiters. We'll assign that mode to files we are interested in using Settings ⇒ "For files" - by putting checkbox near those files, selecting the newly-created mode from dropdown list and then clicking on "Assign Processing Mode" button.

To create new mode, go to Settings ⇒ Edit modes, click on "Create new mode" button. Enter title "delimited" or the next screen. Select "Standard: treat as raw code" as PARENT mode from dropdown list. Scroll down to section "Support for VBScript code embedded into documents of various types", Select "Pieces for VBScript code between delimiters are protected", and check a checkbox to the left of dropdown list. Put checkboxes to the left of textfields with titles "Name of file containing strings that mark start of piece of code" and "Name of file containing strings that mark start of piece of code". Put "start-delimiters.txt" (without quotes) into "Name of file containing strings that mark start of piece of code" and put "end-delimiters.txt" (without quotes) "Name of file containing strings that mark start of piece of code". Click Save at the bottom of the page.

After that, put files with names "start-delimiters.txt" and "end-delimiters.txt" into your Project's input directory; list your start delimiters, one per line in the former and list your end delimiters into the later.

After that go to Settings ⇒ "For files", select files where start/end delimiters are present, select "delimited" from dropdown list and click on "Assign Processing Mode" button.

Possible applications

Some complex applications use VBScript as their scripting language, like PowerDesigner. Plugins for those applications are typically an XML file that defines handlers for different events as textual content of XML nodes. In order to obfuscate plugin for e.g. PowerDesigner there is a need to make the code inside that XML file to be made unreadble, keeping all markup around the code unchanged. Support for protecting delimited code is very handy for protecting such files that contain pieces of VBScript code.