Stunnix ASP and VBScript Obfuscator and Encoder, unlike other tools, can protect VBScript inside
string constants in any file with any programming language like C/C++, Java, C# or Pascal.
String constants should obey C-like syntax (begin with single or double quotes, end
with same quotation character, and use C-style escape sequences with use of slashes);
the constants to be protected should be wrapped into a call of some function or method.
Developers just have to pass the name of that method (even with the name of object it's called on)
to ASP and VBScript Obfuscator and Encoder and it will protect all source code in any string constants found
between parentheses, even if other expressions appear between those parentheses - e.g.
variables being concatenated, or even some other functions being called.
Consider the following C# code in .aspx.cs file that generates vbscript:
protected void AddVbs()
{
StringBuilder sb = new StringBuilder();
sb.Append(GenUtils.VBSCODE("Dim r: r = prepareReport(reportView,\"" + reportName +
"\",\"" + getReportId("mainReport",0) + "\"); " +
" r.titleOf = \"Report - standard view"; r.instance = 0; 'here is a comment "));
}
It even contains slash-escaped double quotes (near the end of the VBSCODE argument). Here
is how it's protected with
ASP and VBScript Obfuscator and Encoder:
protected void AddVbs()
{
StringBuilder sb = new StringBuilder();
sb.Append(GenUtils.VBSCODE("Dim z04526a1d1b: z04526a1d1b = z9c6e26c932(zda80ab51a2,\"" + reportName +
"\",\"" + getReportId("mainReport",0) + "\"); " +
" z04526a1d1b.z018b3115a6 = \"Report - standard view\"; z04526a1d1b.z0d2e08cd5a = (&h309+1231-&H7d8); ));
}
As you see, comments are removed, integer "0" has been mangled, and of course variables have
been renamed to match names used in raw VBScript files (that will be located on the same
server where .aspx.cs file is being executed on). C# code surronding it was not changed,
even string constant inside of the call of getReportId().
The commandline used was:
vbs-obfus -E othercode,dynamic-scripts-by=GenUtils.VBSCODE impl1.aspx.cs
Of course it's possible to achieve the same effect using Project Manager GUI, without writing
a piece of commandline code - just assign mode
"standard: pieces of VBScript inside the code of some programming language (e.g. Java or C++)"
to such files.
This allows users to create complex projects consisting of files with VBScript, files
with HTML markup and client-side VBScript code in them, and some raw server-side
code files (like Java or C# or C++) that refer to client-side code defined elsewhere,
and the names of all symbols will be changed in the same way.