Solution open Jscript.encode Code of ASP function _ Typical special effects

Source: Internet
Author: User
JavaScript functions already have, there is no ASP functions???
Or there is no master can put the following written as an ASP, extremely grateful ~!!

Copy Code code as follows:

<script language= "JavaScript" >
<!--
function Toencode (s,l)
{enc=new ActiveXObject ("Scripting.encoder");
Return ENC. Encodescriptfile (".") +l,s,0,l+ "Cript");
}


var state_copy_input = 100
var State_readlen = 101
var State_decode = 102
var state_unescape = 103

var pick_encoding = new Array (
1, 2, 0, 1, 2, 0, 2, 0, 0, 2, 0, 2, 1, 0, 2, 0,
1, 0, 2, 0, 1, 1, 2, 0, 0, 2, 1, 0, 2, 0, 0, 2,
1, 1, 0, 2, 0, 2, 0, 1, 0, 1, 1, 2, 0, 1, 0, 2,
1, 0, 2, 0, 1, 1, 2, 0, 0, 1, 1, 2, 0, 1, 0, 2
)

var rawdata = new Array (
0x64,0x37,0x69, 0x50,0x7e,0x2c, 0x22,0x5a,0x65, 0x4a,0x45,0x72,
0x61,0x3a,0x5b, 0x5e,0x79,0x66, 0x5d,0x59,0x75, 0x5b,0x27,0x4c,
0x42,0x76,0x45, 0x60,0x63,0x76, 0x23,0x62,0x2a, 0x65,0x4d,0x43,
0x5f,0x51,0x33, 0x7e,0x53,0x42, 0x4f,0x52,0x20, 0x52,0x20,0x63,
0X7A,0X26,0X4A, 0x21,0x54,0x5a, 0x46,0x71,0x38, 0x20,0x2b,0x79,
0x26,0x66,0x32, 0x63,0x2a,0x57, 0x2a,0x58,0x6c, 0x76,0x7f,0x2b,
0x47,0x7b,0x46, 0x25,0x30,0x52, 0x2c,0x31,0x4f, 0x29,0x6c,0x3d,
0X69,0X49,0X70, 0x3f,0x3f,0x3f, 0x27,0x78,0x7b, 0x3f,0x3f,0x3f,
0x67,0x5f,0x51, 0x3f,0x3f,0x3f, 0x62,0x29,0x7a, 0x41,0x24,0x7e,
0x5a,0x2f,0x3b, 0x66,0x39,0x47, 0x32,0x33,0x41, 0x73,0x6f,0x77,
0x4d,0x21,0x56, 0x43,0x75,0x5f, 0x71,0x28,0x26, 0x39,0x42,0x78,
0x7c,0x46,0x6e, 0x53,0x4a,0x64, 0x48,0x5c,0x74, 0x31,0x48,0x67,
0x72,0x36,0x7d, 0x6e,0x4b,0x68, 0x70,0x7d,0x35, 0x49,0x5d,0x22,
0x3f,0x6a,0x55, 0x4b,0x50,0x3a, 0x6a,0x69,0x60, 0x2e,0x23,0x6a,
0x7f,0x09,0x71, 0x28,0x70,0x6f, 0x35,0x65,0x49, 0x7d,0x74,0x5c,
0X24,0X2C,0X5D, 0x2d,0x77,0x27, 0x54,0x44,0x59, 0x37,0x3f,0x25,
0x7b,0x6d,0x7c, 0x3d,0x7c,0x23, 0x6c,0x43,0x6d, 0x34,0x38,0x28,
0x6d,0x5e,0x31, 0x4e,0x5b,0x39, 0x2b,0x6e,0x7f, 0x30,0x57,0x36,
0x6f,0x4c,0x54, 0x74,0x34,0x34, 0x6b,0x72,0x62, 0x4c,0x25,0x4e,
0x33,0x56,0x30, 0x56,0x73,0x5e, 0x3a,0x68,0x73, 0x78,0x55,0x09,
0X57,0X47,0X4B, 0x77,0x32,0x61, 0x3b,0x35,0x24, 0X44,0X2E,0X4D,
0x2f,0x64,0x6b, 0x59,0x4f,0x44, 0x45,0x3b,0x21, 0x5c,0x2d,0x37,
0x68,0x41,0x53, 0x36,0x61,0x58, 0x58,0x7a,0x48, 0x79,0x22,0x2e,
0x09,0x60,0x50, 0x75,0x6b,0x2d, 0x38,0x4e,0x29, 0x55,0x3d,0x3f
)

var transformed = new Array ()
for (Var i=0;   i<3; i++) Transformed[i] = new Array ()
for (Var i=31;   i<=126;   i++) for (Var j=0;   j<3;   J + +) transformed[j][rawdata[(i-31) * 3 + j]] = (i==31)? 9:i

var digits = new Array ()
for (Var i=0;   i<26; i++)
{
digits["A". charCodeAt (0) +i] = i
Digits["a". charCodeAt (0) +i] = i+26
}
for (Var i=0;   i<10; i++) digits["0". charCodeAt (0) +i] = i+52
DIGITS[0X2B] = 62
DIGITS[0X2F] = 63

function unescape (char)
{
var escapes = "#&!*$"
var escaped = "\r\n<>@"

if (char.charcodeat (0) > 126) return char
if (Escapes.indexof (char)!=-1) return Escaped.substr (Escapes.indexof (char), 1)
Return "?"
}

function DecodeBase64 (String)
{
var val = 0
Val + = (digits[string.substr (0,1). charCodeAt (0)] << 2)
Val + = (digits[string.substr (1,1). charCodeAt (0)] >> 4)
Val + = (digits[string.substr (1,1) charcodeat (0)] & 0xf) << 12
Val + = ((Digits[string.substr (2,1). charCodeAt (0)] >> 2) << 8)
Val + = ((Digits[string.substr (2,1). charCodeAt (0)] & 0x3) << 22)
Val + = (digits[string.substr (3,1). charCodeAt (0)] << 16)
Return Val
}

function Tranencode (encodingstring)
{

var marker = "#@~^"
var StringIndex = 0
var scriptindex =-1
var unencodingindex = 0
var char = null
var encodinglength = Unencodinglength = 0
var state = State_copy_input
var unencodingstring = ""
var Re, arr

while (state)
{
Switch (state)
{
Case (State_copy_input):
Scriptindex = Encodingstring.indexof (marker, StringIndex)
if (Scriptindex!=-1)
{
Unencodingstring + + encodingstring.substring (StringIndex, Scriptindex)
Scriptindex + + Marker.length
State = State_readlen
}
Else
{
StringIndex = stringindex==0? 0:stringindex
Unencodingstring + + encodingstring.substr (StringIndex, Encodingstring.length)
State = 0
}
Break

Case (State_readlen):
Encodinglength = Encodingstring.substr (Scriptindex, 6)
Unencodinglength = DecodeBase64 (encodinglength)
Scriptindex + = (6 + "= =". Length)
State = State_decode
Break

Case (State_decode):
if (!unencodinglength)
{
StringIndex = Scriptindex + "dqgaaa==^#~@". Length
Unencodingindex = 0
State = State_copy_input
Break
}
char = Encodingstring.substr (Scriptindex, 1)
if (char = = "@") state = State_unescape
Else
{
if (char.charcodeat (0) < 0xFF)
{
Unencodingstring + + string.fromcharcode (transformed[pick_encoding[unencodingindex%64]][char.charcodeat (0)])
unencodingindex++
}
Else
{
unencodingstring = Char
}
scriptindex++
unencodinglength--
Break
}

Case State_unescape:
Unencodingstring + + unescape (encodingstring.substr (++scriptindex, 1))
scriptindex++; Unencodinglength-=2
unencodingindex++
State = State_decode
Break
}
}

Re = new RegExp ("jscript| VBscript). Encode "," GMI ")
while (arr = re.exec (unencodingstring)) unencodingstring = Regexp.leftcontext + regexp.$1 + REGEXP.RIGHTC Ontext
Return unencodingstring
}
-->
</SCRIPT>

ASP is not equal to VBS, just a frame
This code, you add a runat= "server" to the script and call this function directly.
<script language= "JavaScript" runat= "Server" ....
<%
Toencode (XXX)
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.