深圳外贸网站建设哪家好,mvc5网站开发之美,crm系统排行榜,安徽二建标准密码学笔记——eval(function(p,a,c,k,e,d) 的加密破解 例题#xff1a; 小明某天在看js的时候#xff0c;突然看到了这么一段代码#xff0c;发现怎么也理不出代码逻辑#xff0c;你能帮帮他吗#xff1f; 格式#xff1a;SimCTF{} eval(function(p,a,c,k,e,d){efunctio… 密码学笔记——eval(function(p,a,c,k,e,d) 的加密破解 例题 小明某天在看js的时候突然看到了这么一段代码发现怎么也理不出代码逻辑你能帮帮他吗 格式SimCTF{} eval(function(p,a,c,k,e,d){efunction(c){return(ca?:e(parseInt(c/a)))((cc%a)35?String.fromCharCode(c29):c.toString(36))};if(!.replace(/^/,String)){while(c--)d[e(c)]k[c]||e(c);k[function(e){return d[e]}];efunction(){return\\w};c1;};while(c--)if(k[c])pp.replace(new RegExp(\\be(c)\\b,g),k[c]);return p;}(1 87/a9(\\\6\\3\\2\\5\\4\\b\\i\\h\\k\\j\\0\\g\\d\\c\\f\\0\\e\)/1,21,21,u0065|script|u006d|u0069|u0054|u0043|u0053|text|type|alert|javascript|u0046|u006f|u0063|u007d|u0064|u006e|u006a|u007b|u005f|u0073.split(|),0,{})) 1、其实这个eval(function(p,a,c,k,e,d){}))中自带解码函数e()“while(c--)if(k[c])pp.replace(new RegExp(\\be(c)\\b,g),k[c]);return p” while循环产生的每个p就是解码后的函数代码,我们删掉源码中的“return p”,不用将结果返回, 而是直接输出在一个文本区域中,如“document.getElementById(”textareaID”).innerTextp” 2、 原代码 eval(function(p,a,c,k,e,d){efunction(c){return(ca?:e(parseInt(c/a)))((cc%a)35?String.fromCharCode(c29):c.toString(36))};if(!.replace(/^/,String)){while(c--)d[e(c)]k[c]||e(c);k[function(e){return d[e]}];efunction(){return\\w};c1;};while(c--)if(k[c])pp.replace(new RegExp(\\be(c)\\b,g),k[c]);return p;}(1 87/a9(\\\6\\3\\2\\5\\4\\b\\i\\h\\k\\j\\0\\g\\d\\c\\f\\0\\e\)/1,21,21,u0065|script|u006d|u0069|u0054|u0043|u0053|text|type|alert|javascript|u0046|u006f|u0063|u007d|u0064|u006e|u006a|u007b|u005f|u0073.split(|),0,{})) 修改后的代码 eval(function(p,a,c,k,e,d){efunction(c){return(ca?:e(parseInt(c/a)))((cc%a)35?String.fromCharCode(c29):c.toString(36))};if(!.replace(/^/,String)){while(c--)d[e(c)]k[c]||e(c);k[function(e){return d[e]}];efunction(){return\\w};c1;};while(c--)if(k[c])pp.replace(new RegExp(\\be(c)\\b,g),k[c]);document.getElementById(textareaID).innerTextp;}(1 87/a9(\\\6\\3\\2\\5\\4\\b\\i\\h\\k\\j\\0\\g\\d\\c\\f\\0\\e\)/1,21,21,u0065|script|u006d|u0069|u0054|u0043|u0053|text|type|alert|javascript|u0046|u006f|u0063|u007d|u0064|u006e|u006a|u007b|u005f|u0073.split(|),0,{})) 代码如下 !DOCTYPE html P LIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhtml xmlnshttp://www.w3.org/1999/xhtmlheadtitle Crack Baidu统计构造函数/titlemeta http-equivcontent-type contenttext/html; charsetUTF-8 /meta http-equivX- -Compatible contentIEEmulateIE7 /meta nameAuthor contentwww.gemingcao.com/meta nameKeywords content /meta nameDescription content / /headbodytextarea idtextareaID rows25 cols50/textareascript typetext/javascripteval(function(p,a,c,k,e,d){efunction(c){return(ca?:e(parseInt(c/a)))((cc%a)35?String.fromCharCode(c29):c.toString(36))};if(!.replace(/^/,String)){while(c--)d[e(c)]k[c]||e(c);k[function(e){return d[e]}];efunction(){return\\w};c1;};while(c--)if(k[c])pp.replace(new RegExp(\\be(c)\\b,g),k[c]);document.getElementById(textareaID).innerTextp;}(1 87/a9(\\\6\\3\\2\\5\\4\\b\\i\\h\\k\\j\\0\\g\\d\\c\\f\\0\\e\)/1,21,21,u0065|script|u006d|u0069|u0054|u0043|u0053|text|type|alert|javascript|u0046|u006f|u0063|u007d|u0064|u006e|u006a|u007b|u005f|u0073.split(|),0,{}))/script/body/html 3、保存为html文件其结果为 4、发现是Unicode编码用 http://tool.chinaz.com/tools/unicode.aspx 5、另一种方法是用在线的js混淆还原工具 http://tool.lu/js 注本笔记参考http://www.cnblogs.com/wangchunming/archive/2012/04/01/2429455.html ----------------------------------------------------------------分割线--------------------------------------------------------- ps:萌新一枚本文纯为学习笔记以防某日犯傻忘记--。如有不妥处望大佬们赐教~ 转载于:https://www.cnblogs.com/xdjun/p/7467981.html