使用Javascript保护电子邮件-代码是如何工作的?

使用Javascript保护电子邮件-代码是如何工作的?,javascript,email,Javascript,Email,有人能拆开它,向我解释它是如何工作的吗?这是受保护的电子邮件链接 <script type="text/javascript"> //<![CDATA[ <!-- var x="function f(x){var i,o=\"\",l=x.length;for(i=0;i<l;i+=2) {if(i+1<l)o+=" + "x.charAt(i+1);try{o+=x.charAt(i);}catch(e){}}return o;}f(\"ufcnitnof

有人能拆开它,向我解释它是如何工作的吗?这是受保护的电子邮件链接

<script type="text/javascript"> 
//<![CDATA[
<!--
var x="function f(x){var i,o=\"\",l=x.length;for(i=0;i<l;i+=2) {if(i+1<l)o+=" +
"x.charAt(i+1);try{o+=x.charAt(i);}catch(e){}}return o;}f(\"ufcnitnof x({)av" +
" r,i=o\\\"\\\"o,=l.xelgnhtl,o=;lhwli(e.xhcraoCedtAl(1/)3=!11)1t{yrx{=+;x+ll" +
"=};acct(h)e}{f}roi(l=1-i;=>;0-i)-o{=+.xhcratAi(;)r}teru n.oussbrt0(o,)l};(f" +
")\\\"43\\\\,q\\\"sydn%{~l/,\\\\\\\\\\\\\\\\20\\\\0r\\\\gggo2>02\\\\\\\\27\\" +
"\\07\\\\01\\\\\\\\23\\\\07\\\\02\\\\\\\\13\\\\0Y\\\\30\\\\04\\\\02\\\\\\\\3" +
"1\\\\04\\\\03\\\\\\\\00\\\\0O\\\\3R1L6Q01\\\\\\\\06\\\\05\\\\03\\\\\\\\01\\" +
"\\03\\\\02\\\\\\\\GF6801\\\\\\\\\\\\r2\\\\00\\\\\\\\3N<7<132\\\\06\\\\#3;?}" +
"'0< =w<?# &*)1d03\\\\\\\\%y3'7(03\\\\\\\\1_00\\\\\\\\36\\\\03\\\\02\\\\\\\\" +
"UTC]G_5C03\\\\\\\\_FBUN[OC\\\"\\\\f(;} ornture;}))++(y)^(iAtdeCoarchx.e(odr" +
"ChamCro.fngriSt+=;o27=1y%2;*=)yy)3+(4i>f({i+)i+l;i<0;i=r(foh;gten.l=x,l\\\"" +
"\\\\\\\"\\\\o=i,r va){,y(x fontincfu)\\\"\")" ;
while(x=eval(x));
//-->
//]]>
</script>

//
//]]>
eval()
获取字符串并将其解释为Javascript代码

while(x=eval(x))
循环所做的是将
x
中的字符串作为代码进行求值,并将结果存储回
x
,然后再次求值,直到结果为false

因此,内容是一些Javascript代码,这些代码随后被“抽象”为一组不同的Javascript代码,可以将原始代码作为字符串生成;这种抽象随后被重复任意次数。
while
循环展开这些重复的抽象,直到创建了原始Javascript代码,然后最后的
eval()
运行实际代码

var x="function f(x){var i,o=\"\",l=x.length;for(i=0;i<l;i+=2) {if(i+1<l)o+=" +
"x.charAt(i+1);try{o+=x.charAt(i);}catch(e){}}return o;}f(\"ufcnitnof x({)av" +
" r,i=o\\\"\\\"o,=l.xelgnhtl,o=;lhwli(e.xhcraoCedtAl(1/)3=!11)1t{yrx{=+;x+ll" +
"=};acct(h)e}{f}roi(l=1-i;=>;0-i)-o{=+.xhcratAi(;)r}teru n.oussbrt0(o,)l};(f" +
")\\\"43\\\\,q\\\"sydn%{~l/,\\\\\\\\\\\\\\\\20\\\\0r\\\\gggo2>02\\\\\\\\27\\" +
"\\07\\\\01\\\\\\\\23\\\\07\\\\02\\\\\\\\13\\\\0Y\\\\30\\\\04\\\\02\\\\\\\\3" +
"1\\\\04\\\\03\\\\\\\\00\\\\0O\\\\3R1L6Q01\\\\\\\\06\\\\05\\\\03\\\\\\\\01\\" +
"\\03\\\\02\\\\\\\\GF6801\\\\\\\\\\\\r2\\\\00\\\\\\\\3N<7<132\\\\06\\\\#3;?}" +
"'0< =w<?# &*)1d03\\\\\\\\%y3'7(03\\\\\\\\1_00\\\\\\\\36\\\\03\\\\02\\\\\\\\" +
"UTC]G_5C03\\\\\\\\_FBUN[OC\\\"\\\\f(;} ornture;}))++(y)^(iAtdeCoarchx.e(odr" +
"ChamCro.fngriSt+=;o27=1y%2;*=)yy)3+(4i>f({i+)i+l;i<0;i=r(foh;gten.l=x,l\\\"" +
"\\\\\\\"\\\\o=i,r va){,y(x fontincfu)\\\"\")" ;

var x=“function f(x){var i,o=\“\”,l=x.length;for(i=0;i上面由HiveLogic Enkoder生成的javascript代码看起来很难看,但实际上相当简单。它可以很容易地反转

它使用了3级模糊处理

简短回答 此代码的含义如下:

eval(swappletters_2by2(反向文本(XOR_解码(document.write)(“一些HTML”));

  • swappletters_2by2()将文本分成两个字母块并翻转它们。例如:
    “function”
    =>
    fu nc ti on
    =>
    uf cn it no
    =>
    “ufcnitno”

  • reverse_text()只需反转文本(与php或python中完全相同)

  • 最后,XOR_decode()解码一些XOR编码的文本

长话短说 以下是HiveLogic Enkoder用于解码某些编码HTML的三种算法:

XOR:第三级模糊处理 Enkoder用于XOR解码的javascipt函数如下所示:

function f(x,y)//x is the encoded text. y is the key for decoding (it's a number who increase)
{
   var i,o="",//o will be the decoded text
   l=x.length;
   
   for(i=0;i<l;i++)//for all letters of the text
   {
      y%=127;//127 because a char is a number from [-128;127]. 

      o+=String.fromCharCode(x.charCodeAt(i)^(y));// o+=x^y . o is a string, x a char
      y++;
   }
   return o;
}

f("the encoded text",A_RANDOM_NUMBER);
反向文本:第二级模糊处理 反转文本算法只是反转一个字符串:
helloworld
=>
dlrow olleH

function f(x)
{
    var i,o="",l=x.length;
     
    for(i=l-1;i>=0;i--)//for all letters from last to first.
    {
        o+=x.charAt(i);//and adding them into a new variable, from last to first
    }
    
    return o;
}

f("the XOR encoded AND reversed text");
我对函数进行了简化,因为添加了一些额外的代码,并用“如果”包围,这些代码永远不会被触发。这些代码只是为了让那些分析hiveLogic编码器的人发疯

交换字母:混淆的第一级 交换字母算法只是翻转两个字母的块

function f(x)
{
      var i,o="",l=x.length;

      for(i=0;i<l;i+=2)//for all 2 letters
      {
         if(i+1<l)o+=x.charAt(i+1);//adding first the letter at i+1 in a new var
         o+=x.charAt(i);//then adding the letter at i
      }
    return o;
}

f("XOR encoded, reversed, and 2 by 2 swapped text");
函数f(x)
{
变量i,o=“”,l=x.长度;

对于(i=0;这是答案的一部分,很清楚“eval”和“while”的作用。但真正的问题是“x”中的代码是如何工作的以及它是如何生成的?我已经添加了一个演练,作为手动运行每个
eval()的结果
javascript控制台中的迭代。谢谢,这正是我想要的,非常有用。有人知道我可以在哪个网站上编码这样的电子邮件地址吗?@machineaddict不必麻烦;这不值得你花时间。如果你想要防弹保护,请使用像reCaptcha的MailHide这样的东西;如果你愿意接受不到40美元的价格lletproof,只需使用地址的两部分或类似部分的简单JS字符串串联。后者将愚弄任何不计算JS的内容,这与OP中的代码愚弄的刮器完全相同。
function f(x,y)//x is the encoded text. y is the key for decoding (it's a number who increase)
{
   var i,o="",//o will be the decoded text
   l=x.length;
   
   for(i=0;i<l;i++)//for all letters of the text
   {
      y%=127;//127 because a char is a number from [-128;127]. 

      o+=String.fromCharCode(x.charCodeAt(i)^(y));// o+=x^y . o is a string, x a char
      y++;
   }
   return o;
}

f("the encoded text",A_RANDOM_NUMBER);
if(i>A_RANDOM_NUMBER+y)
{
   y*=SOMEVALUE or y+=SOMEVALUE; 
}
function f(x)
{
    var i,o="",l=x.length;
     
    for(i=l-1;i>=0;i--)//for all letters from last to first.
    {
        o+=x.charAt(i);//and adding them into a new variable, from last to first
    }
    
    return o;
}

f("the XOR encoded AND reversed text");
function f(x)
{
      var i,o="",l=x.length;

      for(i=0;i<l;i+=2)//for all 2 letters
      {
         if(i+1<l)o+=x.charAt(i+1);//adding first the letter at i+1 in a new var
         o+=x.charAt(i);//then adding the letter at i
      }
    return o;
}

f("XOR encoded, reversed, and 2 by 2 swapped text");
//the swaping 2 by 2 letters function
function f(x){var i,o="",l=x.length;for(i=0;i<l;i+=2) {if(i+1<l)o+=x.charAt(i+1);try{o+=x.charAt(i);}catch(e){}}return o;}

//the XOR, reversed and flipped text
f("ufcnitnof x({)av r,i=o\"\"o,=l.xelgnhtl,o=;lhwli(e.xhcraoCedtAl(1/)3=!11)1t{yrx{=+;x+ll=};acct(h)e}{f}roi(l=1-i;=>;0-i)-o{=+.xhcratAi(;)r}teru n.oussbrt0(o,)l};(f)\"43\\,q\"sydn%{~l/,\\\\\\\\20\\0r\\gggo2>02\\\\27\\07\\01\\\\23\\07\\02\\\\13\\0Y\\30\\04\\02\\\\31\\04\\03\\\\00\\0O\\3R1L6Q01\\\\06\\05\\03\\\\01\\03\\02\\\\GF6801\\\\\\r2\\00\\\\3N<7<132\\06\\#3;?}'0< =w<?# &*)1d03\\\\%y3'7(03\\\\1_00\\\\36\\03\\02\\\\UTC]G_5C03\\\\_FBUN[OC\"\\f(;} ornture;}))++(y)^(iAtdeCoarchx.e(odrChamCro.fngriSt+=;o27=1y%2;*=)yy)3+(4i>f({i+)i+l;i<0;i=r(foh;gten.l=x,l\"\\\"\\o=i,r va){,y(x fontincfu)\"") 
//the reverse text function
function f(x){var i,o="",ol=x.length,l=ol;while(x.charCodeAt(l/13)!=111){try{x+=x;l+=l;}catch(e){}}for(i=l-1;i>=0;i--){o+=x.charAt(i);}return o.substr(0,ol);}

//the XOR encoded and reversed text
f(")34,\"qysnd{%l~,/\\\\020\\rggog>220\\720\\710\\320\\720\\310\\Y030\\420\\130\\430\\000\\OR3L1Q610\\600\\530\\100\\320\\FG8610\\r\\200\\N37<1<230\\63#?;'}<0= <w#?& )*d130\\y%'3(730\\_100\\630\\320\\TU]C_GC530\\F_UB[NCO\"(f};o nruter};))++y(^)i(tAedoCrahc.x(edoCrahCmorf.gnirtS=+o;721=%y;2=*y))y+34(>i(fi{)++i;l<i;0=i(rof;htgnel.x=l,\"\"=o,i rav{)y,x(f noitcnuf");
//the XOR decoding function.
//Note that you have one additional encoding in it : if(i>43+y)y*=2;
function f(x,y){var i,o="",l=x.length;for(i=0;i<l;i++){if(i>(43+y))y*=2;y%=127;o+=String.fromCharCode(x.charCodeAt(i)^(y++));}return o;}

//the XOR encoded text.
f("OCN[BU_F\035CG_C]UT\023\036\001_\037(3'%y\031d*) &?#w< =0<}';?#36\032<1<73N\002\r\0168GF\023\001\035\006\016Q1L3RO\000\034\031\024\030Y\013\027\023\017\027\022>goggr\020\\/,~l%{dnsyq",43);
document.writeln("<a href=\"mailto:roman.[PROTECTED]@gmail.com\" title=\"\">roman.[PROTECTED]@gmail.com</a>");0;