javascript加密与解密

80酷酷网    80kuku.com

  javascript|加密|解密

javascript加密主要有JScript.Encode加密方式跟escape方式.

加密的用处主要有:1.隐藏自己的js代码,或者阻止他人使用自己的js成果.这方面在网页木马里面尤其使用的多.

2.阻止别人盗链.现在很多宽频网站或者网络电视网站,由于没有使用drm保护,

他们只能通过保护url地址来防止别人直接打开mms或者http地址.故而需要加密地址.这个现在的qq直播网站,sina,sohu的宽频都是这样.不过都是可以破解的.

因为js再怎么加密最终ie重要能解释的.

方法1.

javascript:s=document.documentElement.outerHTML;document.write('<body></body>');document.body.innerText=s;

这段代码拷入ie地址栏(注意首先要打开你觉得加密的网址,然后覆盖这个网址在ie输入上面代码)

方法2.

找到JScript.Encode加密以后的代码.直接将下面代码拷入一个html中

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>JScript.Encode加密解密</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="JScript.Encode脚本加密与解密_files/css.css" type=text/css rel=stylesheet>
<META
content=Encode加密解密,encode在线加密解密,jscript.encode解密,jscript.encode加密,网页加密解密,脚本加密与解密
name=keywords>
<META content="MSHTML 6.00.3790.2577" name=GENERATOR></HEAD>
<BODY leftMargin=0 topMargin=0>
<SCRIPT language=javascript>
<!--
function screncode(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 strdec(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.rightContext
return unEncodingString
}

//-->
</SCRIPT>

<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <SCRIPT language=javascript
      src="JScript.Encode脚本加密与解密_files/tools_hf.js"></SCRIPT>
    </TD></TR></TBODY></TABLE>
<DIV align=center>
<H2><B>JScript.Encode脚本加密与解密</B> </H2></DIV>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD vAlign=top>
      <P></P>
      <TABLE cellSpacing=0 cellPadding=0 width=778 align=center border=0>
        <TBODY>
        <TR>
          <TD>
            <DIV class=div>
            <DIV align=center>
            <P
            40px; PADDING-LEFT: 40px; PADDING-BOTTOM: 0px; WIDTH: 100%; COLOR: #666666; PADDING-TOP: 0px"
            align=left>   
            所谓加密解密是通过JScript.Encode脚本的转换实现的,但经过实验中文文字太多会导致将你的页面代码膨胀。英文反会有压缩效果。

使用方法:
   
            <FONT color=#ff0000>加密</FONT>:源代码粘贴在下面的框内,注意:<FONT
            color=#ff0000>请在加密前先备份您的网页</FONT>
    <FONT
            color=#ff0000>解密方法</FONT>:将引号内的乱码贴入按解密即可</P></DIV>
            <FORM method=post>
            <P align=center><TEXTAREA #ffffff 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px;

BACKGROUND: #cccccc; BORDER-LEFT: #ffffff 2px solid; WIDTH: 590px; BORDER-BOTTOM: #ffffff 2px solid; HEIGHT: 320px" name=codeinput rows=10 cols=55></TEXTAREA>
           

<INPUT #ff6600 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px; BACKGROUND: #ffcc00;

BORDER-LEFT: #ffffff 2px solid; WIDTH: 80px; BORDER-BOTTOM: #ff6600 2px solid; HEIGHT: 22px" type=button value=Encode加密 name=button>
<INPUT #339999 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px; BACKGROUND: #66b800;

BORDER-LEFT: #ffffff 2px solid; WIDTH: 80px;

 BORDER-BOTTOM: #339999 2px solid; HEIGHT: 22px" onclick=this.form.codeinput.value=strdec(this.form.codeinput.value) type=button

value=Encode解密 name=button>
           
</P>
            <P
            40px; PADDING-LEFT: 40px; PADDING-BOTTOM: 0px; WIDTH: 100%; COLOR: #666666; PADDING-TOP: 0px; TEXT-ALIGN: center">

说明:加密时应只加密脚本部分,不加密脚本标记<script
            language="javascript">,并且加密后脚本标记应改为:
<script
            language="JScript.Encode"></P>
            <P
            40px; PADDING-LEFT: 40px; PADDING-BOTTOM: 0px; WIDTH: 100%; COLOR: #666666; PADDING-TOP: 0px; TEXT-ALIGN: left">

注意:此页为jscript.encode解密以及jscript.encode加密或者称之为encode加密解密、encode在线加密解密
            如果你遇到这些关键词的问题此网页相信能帮助你,<FONT color="red">          

<B>如果你的问题是unescape加密解密,请在我的blog上查找escape解密</B>

unescape加密解密</FONT></A>
</P></FORM></DIV></TD></TR></TBODY></TABLE>
      <P></P></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV align=center>
      <SCRIPT language=javascript
      src="JScript.Encode脚本加密与解密_files/bot.js"></SCRIPT>
      </DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV align=center><FONT color=#222222 size=4>
      <SCRIPT src="JScript.Encode脚本加密与解密_files/mystat.htm"></SCRIPT>

      <SCRIPT language=javascript src="JScript.Encode脚本加密与解密_files/3653.js"
      type=text/javascript></SCRIPT>
      </FONT></DIV></TD></TR></TBODY></TABLE></BODY></HTML>

3.escape解密

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>网页在线加密解密-网页加密解密-unescape加密解密</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK
href="网页在线加密解密-网页加密解密-unescape加密解密_files/css.css" type=text/css rel=stylesheet>
<META content=网页在线加密解密,网页加密解密,unescape加密解密,网页源代码加密,网页代码加密,网页在线加密,网页制作加密
name=keywords>
<META content="MSHTML 6.00.3790.2577" name=GENERATOR></HEAD>
<BODY leftMargin=0 topMargin=0>
<SCRIPT language=JavaScript>
<!--
var Words;

function SetWords(word)
{
Words = word.value;
}

function SetNewWords(form)
{
var NewWords;
NewWords = unescape(Words);
form.NewWords.value = NewWords;
}

function SetNewWords1(form)
{
var NewWords;
NewWords = escape(Words);
form.NewWords.value = NewWords;
}


// -->
</SCRIPT>

<SCRIPT language=JavaScript>
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</SCRIPT>

<SCRIPT language=JavaScript>
<!--

function MM_timelinePlay(tmLnName, myID) { //v1.2
//Copyright 1997 Macromedia, Inc. All rights reserved.
var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
tmLn = document.MM_Time[tmLnName];
if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
if (myID == tmLn.ID) { //if Im newest
setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
fNew = ++tmLn.curFrame;
for (i=0; i<tmLn.length; i++) {
sprite = tmLn[i];
if (sprite.charAt(0) == 's') {
if (sprite.obj) {
numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
keyFrm=1;
for (j=0; j<sprite.values.length; j++) {
props = sprite.values[j];
if (numKeyFr != props.length) {
if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
} else {
while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
} } } } }
} else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
if (fNew > tmLn.lastFrame) tmLn.ID = 0;
} }
}
//-->
</SCRIPT>

<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <SCRIPT language=javascript
      src="网页在线加密解密-网页加密解密-unescape加密解密_files/tools_hf.js"></SCRIPT>
    </TD></TR></TBODY></TABLE>
<DIV align=center>
<H2>网页unescape码加密与解密</H2></DIV>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD vAlign=top>
      <P></P>
      <TABLE cellSpacing=0 cellPadding=0 width=778 align=center border=0>
        <TBODY>
        <TR>
          <TD>
            <TABLE align=center>
              <TBODY>
              <TR>
                <FORM method=post>
                <TD align=middle>
                  <DIV align=center>
                  <P
                  40px; PADDING-LEFT: 40px; PADDING-BOTTOM: 0px; WIDTH: 100%; COLOR: #666666; PADDING-TOP: 0px"
                  align=left>   
                  所谓加密解密是通过Unicode码的转换实现的,但经过实验中文文字太多会导致将你的页面代码膨胀。英文反会有压缩效果。

使用方法:
   
                  <FONT
                  color=#ff0000>加密</FONT>:源代码粘贴在下面的框内,如果你对Java教熟,也可只对部分内容加
密,在对应输出部分使用outword()即可。

注意:<FONT
                  color=#ff0000>请在加密前先备份您的网页</FONT>
    <FONT
                  color=#ff0000>解密方法</FONT>:将引号内的乱码贴入按解密即可
,<FONT color="red">          

<B>如果你的问题是unescape加密解密,请在我的blog上查找escape解密</B>unescape加密解密</FONT>
                  </P></DIV>
                  <DIV align=center>
                  <CENTER>
                  <P> </P></CENTER></DIV>
                  <DIV align=center>
                  <CENTER>
                  <P><TEXTAREA #ffffff 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px;

BACKGROUND: #cccccc; BORDER-LEFT: #ffffff 2px solid; WIDTH: 590px; BORDER-BOTTOM: #ffffff 2px solid; HEIGHT: 120px" name=Word rows=10 cols=65 onchange=SetWords(this)></TEXTAREA>
                  </P></CENTER></DIV>
                  <DIV align=center>
                  <CENTER>
                  <P><INPUT #ff6600 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px; BACKGROUND: #ffcc00;

BORDER-LEFT: #ffffff 2px solid; WIDTH: 80px; BORDER-BOTTOM: #ff6600 2px solid; HEIGHT: 22px" onclick=SetNewWords(this.form) type=button value=解密

name=uncode>
<INPUT #ff6600 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px; BACKGROUND: #ffcc00; BORDER-LEFT: #ffffff 2px solid;

 WIDTH: 80px; BORDER-BOTTOM: #ff6600 2px solid; HEIGHT: 22px" onclick=SetNewWords1(this.form) type=button value=加密 name=encode>
                  </P></CENTER></DIV>
                  <DIV align=center>
                  <CENTER>
                  <P><TEXTAREA #ffffff 2px solid; BORDER-TOP: #ffffff 2px solid; FONT-SIZE: 14px; BACKGROUND: #cccccc;

BORDER-LEFT: #ffffff 2px solid; WIDTH: 590px; BORDER-BOTTOM: #ffffff 2px solid; HEIGHT: 120px" name=NewWords rows=10 cols=65></TEXTAREA>
                  </P></CENTER></DIV></FORM>
                  <P
                  40px; PADDING-LEFT: 40px; PADDING-BOTTOM: 0px; WIDTH: 100%; COLOR: #666666; PADDING-TOP: 0px"
                  align=left>  
                  以上是转换好的代码,将他们加入如下脚本的引号“”区内,就是加密后的HTML了!

以下代码不可直接拷
入FrontPage可先贴在记事本中,再copy一次再贴就没问题了。
                  </P>
                  <DIV align=center>
                  <CENTER>
                  <TABLE width="65%" align=center border=0>
                    <TBODY>
                    <TR>
                      <TD height=314><FONT
                        face="Arial, Helvetica, sans-serif"><B><HTML>
<HEAD>
<SCRIPT
                        LANGUAGE="Javascript">
<!--
</B></FONT><FONT
                        size=2<FONT
                        face="Arial, Helvetica, sans-serif">
var Words
                        ="</FONT>把加密生成后的代码复到此处就<FONT
                        face="Arial, Helvetica, sans-serif">OK</FONT>了<FONT
                        face="Arial, Helvetica, sans-serif">" //put your cripto
                        code there
function OutWord()
{
var
                        NewWords;
NewWords =
                        unescape(Words);
document.write(NewWords);
}
                       
OutWord();
//
                        -->
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>

</FONT></B></TD></TR></TBODY>

</TABLE></CENTER></DIV>
              <TR>
                <TD align=middle></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <P></P></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV align=center>
      <SCRIPT language=javascript
      src="网页在线加密解密-网页加密解密-unescape加密解密_files/bot.js"></SCRIPT>
      </DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
  <TR>
    <TD>
      <DIV align=center><FONT color=#222222 size=4>
      <SCRIPT src="网页在线加密解密-网页加密解密-unescape加密解密_files/mystat.htm"></SCRIPT>

      <SCRIPT language=javascript
      src="网页在线加密解密-网页加密解密-unescape加密解密_files/3653.js"
      type=text/javascript></SCRIPT>
      </FONT></DIV></TD></TR></TBODY></TABLE></BODY></HTML>



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: