웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
자바 스크립트 인코딩 된것 디코딩 하는 스크립트
2002.02.02 09:32
인터넷 돌아댕기다 퍼왔어요.
/***
* Soya/1.0.0-b3 (crlvl: 0; Thu, 25 Oct 2001 15:13:22 UTC)
* Copyright (c) 2001, Saltstorm.
**/
/*#KEEP**
* Soya.Encode.ScriptDecoder
* Decodes JScript/VBscript data encoded with the
* MS ScriptEncoder in true crossbrowser manner.
*
* This script was influenced by the C version (scrdec.c) by Mr.Brownstone.
* --------------------------------------------------------------------------------
* ! DISCLAIMER !
* This script is for demonstrative and educational purposes only.
* Use of this script is at your own risk. The author cannot be
* held responsible if any laws are broken by use of this script.
* --------------------------------------------------------------------------------
* scrdec1x.c is copyright (c) Mr.Brownstone <mrbrownstone@virtualconspiracy.com>
* http://www.virtualconspiracy.com/scrdec.html
*
* Soya.Encode.ScriptDecoder [ScriptDecoder.js] (this script)
* is copyright (c) 2001, Thomas Loo - Saltstorm. <soya@saltstorm.net>
*
* MS ScriptEncoder counterpart can be found here: (2001-05-13)
* http://msdn.microsoft.com/scripting/vbscript/download/vbsdown.htm
* --------------------------------------------------------------------------------
**/
function Soya_Encode_ScriptDecoder()
{
this.name = 'Soya.Encode.ScriptDecoder';
this.type = 'constructor';
this.version = '1.04';
this.dependencies = [];
this.decode = $Soya_Encode_ScriptDecoder_decode;
this.$matrix = null;
this.$createMatrix = $Soya_Encode_ScriptDecoder_$createMatrix;
this.$rotor = [
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];
this.$ccmap = [
0x7b,0x57,0x6e, 0x32,0x2e,0x2d, 0x30,0x47,0x75, 0x21,0x7a,0x52,
0x29,0x56,0x60, 0x5b,0x42,0x71, 0x38,0x6a,0x5e, 0x33,0x2f,0x49,
0x3d,0x26,0x5c, 0x58,0x49,0x62, 0x3a,0x41,0x7d, 0x35,0x34,0x29,
0x65,0x32,0x36, 0x39,0x5b,0x20, 0x5c,0x76,0x7c, 0x56,0x72,0x7a,
0x73,0x43,0x00, 0x66,0x38,0x6b, 0x4e,0x39,0x63, 0x45,0x70,0x33,
0x6b,0x45,0x2b, 0x62,0x68,0x68, 0x59,0x71,0x51, 0x78,0x4f,0x66,
0x5e,0x09,0x76, 0x7d,0x62,0x31, 0x4a,0x44,0x64, 0x6d,0x23,0x54,
0x71,0x75,0x43, 0x00,0x00,0x00, 0x60,0x7e,0x3a, 0x00,0x00,0x00,
0x53,0x5e,0x7e, 0x00,0x00,0x00, 0x42,0x77,0x45, 0x27,0x4a,0x2c,
0x48,0x61,0x2a, 0x72,0x5d,0x74, 0x75,0x22,0x27, 0x31,0x4b,0x37,
0x37,0x6f,0x44, 0x4d,0x4e,0x79, 0x52,0x3b,0x59, 0x22,0x4c,0x2f,
0x54,0x50,0x6f, 0x6a,0x67,0x26, 0x47,0x2a,0x72, 0x64,0x7d,0x6a,
0x2d,0x74,0x39, 0x20,0x54,0x7b, 0x00,0x2b,0x3f, 0x2e,0x2d,0x38,
0x4c,0x2c,0x77, 0x5d,0x30,0x67, 0x7e,0x6e,0x53, 0x6c,0x6b,0x47,
0x6f,0x66,0x34, 0x79,0x35,0x78, 0x74,0x25,0x5d, 0x43,0x21,0x30,
0x26,0x64,0x23, 0x76,0x4d,0x5a, 0x25,0x52,0x5b, 0x24,0x63,0x6c,
0x2b,0x3f,0x48, 0x28,0x7b,0x55, 0x23,0x78,0x70, 0x41,0x29,0x69,
0x34,0x28,0x2e, 0x09,0x73,0x4c, 0x2a,0x59,0x21, 0x44,0x33,0x24,
0x3f,0x00,0x4e, 0x77,0x6d,0x50, 0x3b,0x55,0x09, 0x55,0x53,0x56,
0x69,0x7c,0x73, 0x61,0x3a,0x35, 0x63,0x5f,0x61, 0x50,0x65,0x4b,
0x67,0x46,0x58, 0x51,0x58,0x3b, 0x49,0x31,0x57, 0x4f,0x69,0x22,
0x46,0x6c,0x6d, 0x68,0x5a,0x4d, 0x7c,0x48,0x25, 0x36,0x27,0x28,
0x70,0x5c,0x46, 0x6e,0x3d,0x4a, 0x7a,0x24,0x32, 0x2f,0x79,0x41,
0x5f,0x37,0x3d, 0x4b,0x60,0x5f, 0x5a,0x51,0x4f, 0x2c,0x20,0x42,
0x57,0x36,0x65 ];
}
function $Soya_Encode_ScriptDecoder_$createMatrix(){
// prebuilding the char-matrix will give us a
// *slight* performance boost for repeated decode calls.
var i, j,
afccs = function (cca) {
return String.fromCharCode
(cca[0], 0, cca[1], 0, cca[2]).split('x00');
};
this.$matrix = [];
this.$matrix[9] = afccs(this.$ccmap.slice(0, j = 3));
for(i = 0x20; i < 0x80; j += 3, i++)
this.$matrix[i] = afccs(this.$ccmap.slice(j, j + 3));
}
function $Soya_Encode_ScriptDecoder_decode(sData){
var i, j, cc, at, sEncoded, sDecoded = '';
// do we have anything to decode. if not, return an empty string.
if(!sData)
return sDecoded;
// else try isolating the sEncoded script from its surroundings.
else if(/#@~^.{6}==(.+).{6}==^#~@/.test(sData))
sEncoded = RegExp.$1;
// no surrounding checksum found, then subject everything for decoding.
else sEncoded = sData;
// is this the first time this method is called ??
// then build the magic matrix...
if(!this.$matrix)
this.$createMatrix();
// iterate the sEncoded string and decode it char by char...
for(at = i = j = 0; i < sEncoded.length; i++){
cc = sEncoded.charCodeAt(i);
// 'at' switched off and the charcode is less 128 means we have
// to perform decoding unless charcode equals 64 (@, at).
if(!at && cc < 0x80)
(cc != 0x40) ?
(sDecoded += this.$matrix[cc][this.$rotor[j++ % 0x40]]) : at = 1;
// 'at' switch is apparantly on...
// switch it off and replace char left of '@' if one of the key-chars
// Other values are not relevant.
else {
at = 0, j++;
switch(cc.toString()){
case '33' : sDecoded += 'x3c'; //<;
break;
case '35' : sDecoded += 'x0d';
break;
case '36' : sDecoded += 'x40'; //@
break;
case '38' : sDecoded += 'x0a';
break;
case '42' : sDecoded += 'x3e'; //>
break;
default :
break;
}
}
}
return sDecoded;
}
if(typeof(Soya) == 'object') Soya.registerBean('Soya.Encode.ScriptDecoder', false, 1);
...............................................................................................................
Written date/time: 2002-02-02 09:33:57
...............................................................................................................
COMPUTER - hardware, software, programming, flash, graphic, java, php
GAME - diablo2, fortress2, starcraft
...............................................................................................................
http://myhome.hananet.net/~changminyang
...............................................................................................................
/***
* Soya/1.0.0-b3 (crlvl: 0; Thu, 25 Oct 2001 15:13:22 UTC)
* Copyright (c) 2001, Saltstorm.
**/
/*#KEEP**
* Soya.Encode.ScriptDecoder
* Decodes JScript/VBscript data encoded with the
* MS ScriptEncoder in true crossbrowser manner.
*
* This script was influenced by the C version (scrdec.c) by Mr.Brownstone.
* --------------------------------------------------------------------------------
* ! DISCLAIMER !
* This script is for demonstrative and educational purposes only.
* Use of this script is at your own risk. The author cannot be
* held responsible if any laws are broken by use of this script.
* --------------------------------------------------------------------------------
* scrdec1x.c is copyright (c) Mr.Brownstone <mrbrownstone@virtualconspiracy.com>
* http://www.virtualconspiracy.com/scrdec.html
*
* Soya.Encode.ScriptDecoder [ScriptDecoder.js] (this script)
* is copyright (c) 2001, Thomas Loo - Saltstorm. <soya@saltstorm.net>
*
* MS ScriptEncoder counterpart can be found here: (2001-05-13)
* http://msdn.microsoft.com/scripting/vbscript/download/vbsdown.htm
* --------------------------------------------------------------------------------
**/
function Soya_Encode_ScriptDecoder()
{
this.name = 'Soya.Encode.ScriptDecoder';
this.type = 'constructor';
this.version = '1.04';
this.dependencies = [];
this.decode = $Soya_Encode_ScriptDecoder_decode;
this.$matrix = null;
this.$createMatrix = $Soya_Encode_ScriptDecoder_$createMatrix;
this.$rotor = [
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];
this.$ccmap = [
0x7b,0x57,0x6e, 0x32,0x2e,0x2d, 0x30,0x47,0x75, 0x21,0x7a,0x52,
0x29,0x56,0x60, 0x5b,0x42,0x71, 0x38,0x6a,0x5e, 0x33,0x2f,0x49,
0x3d,0x26,0x5c, 0x58,0x49,0x62, 0x3a,0x41,0x7d, 0x35,0x34,0x29,
0x65,0x32,0x36, 0x39,0x5b,0x20, 0x5c,0x76,0x7c, 0x56,0x72,0x7a,
0x73,0x43,0x00, 0x66,0x38,0x6b, 0x4e,0x39,0x63, 0x45,0x70,0x33,
0x6b,0x45,0x2b, 0x62,0x68,0x68, 0x59,0x71,0x51, 0x78,0x4f,0x66,
0x5e,0x09,0x76, 0x7d,0x62,0x31, 0x4a,0x44,0x64, 0x6d,0x23,0x54,
0x71,0x75,0x43, 0x00,0x00,0x00, 0x60,0x7e,0x3a, 0x00,0x00,0x00,
0x53,0x5e,0x7e, 0x00,0x00,0x00, 0x42,0x77,0x45, 0x27,0x4a,0x2c,
0x48,0x61,0x2a, 0x72,0x5d,0x74, 0x75,0x22,0x27, 0x31,0x4b,0x37,
0x37,0x6f,0x44, 0x4d,0x4e,0x79, 0x52,0x3b,0x59, 0x22,0x4c,0x2f,
0x54,0x50,0x6f, 0x6a,0x67,0x26, 0x47,0x2a,0x72, 0x64,0x7d,0x6a,
0x2d,0x74,0x39, 0x20,0x54,0x7b, 0x00,0x2b,0x3f, 0x2e,0x2d,0x38,
0x4c,0x2c,0x77, 0x5d,0x30,0x67, 0x7e,0x6e,0x53, 0x6c,0x6b,0x47,
0x6f,0x66,0x34, 0x79,0x35,0x78, 0x74,0x25,0x5d, 0x43,0x21,0x30,
0x26,0x64,0x23, 0x76,0x4d,0x5a, 0x25,0x52,0x5b, 0x24,0x63,0x6c,
0x2b,0x3f,0x48, 0x28,0x7b,0x55, 0x23,0x78,0x70, 0x41,0x29,0x69,
0x34,0x28,0x2e, 0x09,0x73,0x4c, 0x2a,0x59,0x21, 0x44,0x33,0x24,
0x3f,0x00,0x4e, 0x77,0x6d,0x50, 0x3b,0x55,0x09, 0x55,0x53,0x56,
0x69,0x7c,0x73, 0x61,0x3a,0x35, 0x63,0x5f,0x61, 0x50,0x65,0x4b,
0x67,0x46,0x58, 0x51,0x58,0x3b, 0x49,0x31,0x57, 0x4f,0x69,0x22,
0x46,0x6c,0x6d, 0x68,0x5a,0x4d, 0x7c,0x48,0x25, 0x36,0x27,0x28,
0x70,0x5c,0x46, 0x6e,0x3d,0x4a, 0x7a,0x24,0x32, 0x2f,0x79,0x41,
0x5f,0x37,0x3d, 0x4b,0x60,0x5f, 0x5a,0x51,0x4f, 0x2c,0x20,0x42,
0x57,0x36,0x65 ];
}
function $Soya_Encode_ScriptDecoder_$createMatrix(){
// prebuilding the char-matrix will give us a
// *slight* performance boost for repeated decode calls.
var i, j,
afccs = function (cca) {
return String.fromCharCode
(cca[0], 0, cca[1], 0, cca[2]).split('x00');
};
this.$matrix = [];
this.$matrix[9] = afccs(this.$ccmap.slice(0, j = 3));
for(i = 0x20; i < 0x80; j += 3, i++)
this.$matrix[i] = afccs(this.$ccmap.slice(j, j + 3));
}
function $Soya_Encode_ScriptDecoder_decode(sData){
var i, j, cc, at, sEncoded, sDecoded = '';
// do we have anything to decode. if not, return an empty string.
if(!sData)
return sDecoded;
// else try isolating the sEncoded script from its surroundings.
else if(/#@~^.{6}==(.+).{6}==^#~@/.test(sData))
sEncoded = RegExp.$1;
// no surrounding checksum found, then subject everything for decoding.
else sEncoded = sData;
// is this the first time this method is called ??
// then build the magic matrix...
if(!this.$matrix)
this.$createMatrix();
// iterate the sEncoded string and decode it char by char...
for(at = i = j = 0; i < sEncoded.length; i++){
cc = sEncoded.charCodeAt(i);
// 'at' switched off and the charcode is less 128 means we have
// to perform decoding unless charcode equals 64 (@, at).
if(!at && cc < 0x80)
(cc != 0x40) ?
(sDecoded += this.$matrix[cc][this.$rotor[j++ % 0x40]]) : at = 1;
// 'at' switch is apparantly on...
// switch it off and replace char left of '@' if one of the key-chars
// Other values are not relevant.
else {
at = 0, j++;
switch(cc.toString()){
case '33' : sDecoded += 'x3c'; //<;
break;
case '35' : sDecoded += 'x0d';
break;
case '36' : sDecoded += 'x40'; //@
break;
case '38' : sDecoded += 'x0a';
break;
case '42' : sDecoded += 'x3e'; //>
break;
default :
break;
}
}
}
return sDecoded;
}
if(typeof(Soya) == 'object') Soya.registerBean('Soya.Encode.ScriptDecoder', false, 1);
...............................................................................................................
Written date/time: 2002-02-02 09:33:57
...............................................................................................................
COMPUTER - hardware, software, programming, flash, graphic, java, php
GAME - diablo2, fortress2, starcraft
...............................................................................................................
http://myhome.hananet.net/~changminyang
...............................................................................................................