生产能力:P=min{ C装配尺寸链计算,C出厂 }怎么算?

eval(function(p,a,c,k,e,d) 加密破解和格式化JS代码最新算法
红色加粗部分将是要修改的地方.
eval(function(p,a,c,k,e,d){e=function(c){return(c&a?"":e(parseInt(c/a)))+((c=c%a)&35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('p w(E,D,A,C,B){5.R=8.14(E);5.o=D;5.d=A;5.r=(8.e)?C:(C-2);5.q=0;5.b=B+((8.e)?0:-2);5.x=5.d[0];5.O=5.d[5.d.c-1]}w.P.y=p(B){9 A=15.16(((B-5.x)*5.b/(5.O-5.x)))+((8.e)?2:0);s(A&5.b){A=5.b}17 A};w.P.18=p(){9 A=8.i("k");A.a="1a";A.6.z=5.b+"7";5.R.j(A);9 K=8.i("k");A.j(K);K.a="1b";9 J=0;Q(9 G=0;G&5.o.c;G+=2){9 B=5.y(5.o[G]);9 I=5.o[G+1];9 F=8.i("k");A.j(F);F.a="u";F.6.n=5.r+"7";F.6.z=B+"7";F.6.m=5.b-B-1+"7";F.6.g=(J-1)+"7";F.h="&v;";F.f=K;F.T=p(){5.a="V";5.f.6.L="";5.f.h=5.t.l(3,5.t.c);5.f.6.g=5.6.g;5.f.6.m=S(5.6.m)-S(5.f.19)+"7"};F.W=p(){5.a="u";5.f.6.L="Z"};9 E=8.i("k");A.j(E);E.6.n=5.r+"7";E.6.m=(8.e)?5.b:5.b+3+"7";9 C=I.10(".");F.t="u"+I.l(0,C)+"\\11"+I.l(C+1,I.c)+"\\12&v;&v;"+5.o[G];s(G%4==0){s((I.l(C+1,I.c)=="1"||I.l(C+1,I.c)=="2")){E.a="13";E.6.g=(J-4)+"7";E.h=I}N{E.a="M";E.6.g=(J-1)+"7";E.h=I.l(C+1,I.c)}}N{E.a="M";E.6.g=(J-1)+"7";E.h=""}J+=5.r+((8.e)?-1:1)}5.q=J+((8.e)?1:-1);A.6.n=5.q+"7";Q(9 G=0;G&5.d.c;G++){9 D=5.y(5.d[G]);s(G!=0&&G!=5.d.c-1){9 H=8.i("k");A.j(H);H.a="X";H.6.n=(5.q-((8.e)?1:-1))+"7";H.6.m=(5.b-D-1)+"7"}9 E=8.i("k");A.j(E);E.a="1c";E.6.n="Y";E.6.m=(5.b-D-2)+"7";E.6.g=-U+"7";E.h=5.d[G]}};',62,75,'|||||this|style|px|document|var|className|charth|length|yl|all|ohit|left|innerHTML|createElement|appendChild|div|s string|top|width|xl|function|chartw|barw|if|id|bar|nbsp|Chart|minpv|GetPVHeight|height||||||||||||display|titx|else|maxpv|prototype|for|parent|parseInt|onmouseover|42|barhl|onmouseout|liney|35px|none|indexOf|月|日|titxhl|getElementById|Math|round|return|Create|offsetHeight|chart|hit|tity'.split('|'),0,{}));
其实这个eval(function(p,a,c,k,e,d){}))中自带解码函数e(). while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p while循环产生的每个p就是解码后的函数代码,我们删掉源码中的return p,不用将结果返回, 而是直接输出在一个文本区域中,如document.getElementById(&textareaID&).innerText=p.
&!DOCTYPE html P LIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"& &html xmlns="http://www.w3.org/1999/xhtml"& &head& &title& Crack Baidu统计构造函数&/title& &meta http-equiv="content-type" content="text/ charset=UTF-8" /& &meta http-equiv="X- -Compatible" content="IE=EmulateIE7" /& &meta name="Author" content=/& &meta name="Keywords" content="" /& &meta name="Description" content="" /&
&/head& &body& &textarea id="textareaID" rows="25" cols="50"&&/textarea& &script type="text/javascript"& eval(function(p,a,c,k,e,d){e=function(c){return(c&a?"":e(parseInt(c/a)))+((c=c%a)&35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);document.getElementById('textareaID').innerText=p;}}}('p w(E,D,A,C,B){5.R=8.14(E);5.o=D;5.d=A;5.r=(8.e)?C:(C-2);5.q=0;5.b=B+((8.e)?0:-2);5.x=5.d[0];5.O=5.d[5.d.c-1]}w.P.y=p(B){9 A=15.16(((B-5.x)*5.b/(5.O-5.x)))+((8.e)?2:0);s(A&5.b){A=5.b}17 A};w.P.18=p(){9 A=8.i("k");A.a="1a";A.6.z=5.b+"7";5.R.j(A);9 K=8.i("k");A.j(K);K.a="1b";9 J=0;Q(9 G=0;G&5.o.c;G+=2){9 B=5.y(5.o[G]);9 I=5.o[G+1];9 F=8.i("k");A.j(F);F.a="u";F.6.n=5.r+"7";F.6.z=B+"7";F.6.m=5.b-B-1+"7";F.6.g=(J-1)+"7";F.h="&v;";F.f=K;F.T=p(){5.a="V";5.f.6.L="";5.f.h=5.t.l(3,5.t.c);5.f.6.g=5.6.g;5.f.6.m=S(5.6.m)-S(5.f.19)+"7"};F.W=p(){5.a="u";5.f.6.L="Z"};9 E=8.i("k");A.j(E);E.6.n=5.r+"7";E.6.m=(8.e)?5.b:5.b+3+"7";9 C=I.10(".");F.t="u"+I.l(0,C)+"\\11"+I.l(C+1,I.c)+"\\12&v;&v;"+5.o[G];s(G%4==0){s((I.l(C+1,I.c)=="1"||I.l(C+1,I.c)=="2")){E.a="13";E.6.g=(J-4)+"7";E.h=I}N{E.a="M";E.6.g=(J-1)+"7";E.h=I.l(C+1,I.c)}}N{E.a="M";E.6.g=(J-1)+"7";E.h=""}J+=5.r+((8.e)?-1:1)}5.q=J+((8.e)?1:-1);A.6.n=5.q+"7";Q(9 G=0;G&5.d.c;G++){9 D=5.y(5.d[G]);s(G!=0&&G!=5.d.c-1){9 H=8.i("k");A.j(H);H.a="X";H.6.n=(5.q-((8.e)?1:-1))+"7";H.6.m=(5.b-D-1)+"7"}9 E=8.i("k");A.j(E);E.a="1c";E.6.n="Y";E.6.m=(5.b-D-2)+"7";E.6.g=-U+"7";E.h=5.d[G]}};',62,75,'|||||this|style|px|document|var|className|charth|length|yl|all|ohit|left|innerHTML|createElement|appendChild|div|s string|top|width|xl|function|chartw|barw|if|id|bar|nbsp|Chart|minpv|GetPVHeight|height||||||||||||display|titx|else|maxpv|prototype|for|parent|parseInt|onmouseover|42|barhl|onmouseout|liney|35px|none|indexOf|月|日|titxhl|getElementById|Math|round|return|Create|offsetHeight|chart|hit|tity'.split('|'),0,{})); &/script& &/body& &/html&
保存为html文件,运行. 格式化文本区域中的JavaScript代码,代码如下:
function Chart(E, D, A, C, B) {
this.parent = document.getElementById(E);
this.xl = D;
this.yl = A;
this.barw = (document.all) ? C: (C - 2);
this.chartw = 0;
this.charth = B + ((document.all) ? 0 : -2);
this.minpv = this.yl[0];
this.maxpv = this.yl[this.yl.length - 1] } Chart.prototype.GetPVHeight = function(B) {
var A = Math.round(((B - this.minpv) * this.charth / (this.maxpv - this.minpv))) + ((document.all) ? 2 : 0);
if (A & this.charth) {
A = this.charth
return A }; Chart.prototype.Create = function() {
var A = document.createElement("div");
A.className = "chart";
A.style.height = this.charth + "px";
this.parent.appendChild(A);
var K = document.createElement("div");
A.appendChild(K);
K.className = "hit";
var J = 0;
for (var G = 0; G & this.xl. G += 2) {
var B = this.GetPVHeight(this.xl[G]);
var I = this.xl[G + 1];
var F = document.createElement("div");
A.appendChild(F);
F.className = "bar";
F.style.width = this.barw + "px";
F.style.height = B + "px";
F.style.top = this.charth - B - 1 + "px";
F.style.left = (J - 1) + "px";
F.innerHTML = "&";
F.ohit = K;
F.onmouseover = function() {
this.className = "barhl";
this.ohit.style.display = "";
this.ohit.innerHTML = this.id.s string(3, this.id.length);
this.ohit.style.left = this.style.
this.ohit.style.top = parseInt(this.style.top) - parseInt(this.ohit.offsetHeight) + "px"
F.onmouseout = function() {
this.className = "bar";
this.ohit.style.display = "none"
var E = document.createElement("div");
A.appendChild(E);
E.style.width = this.barw + "px";
E.style.top = (document.all) ? this.charth: this.charth + 3 + "px";
var C = I.indexOf(".");
F.id = "bar" + I.s string(0, C) + "\月" + I.s string(C + 1, I.length) + "\日&&" + this.xl[G];
if (G % 4 == 0) {
if ((I.s string(C + 1, I.length) == "1" || I.s string(C + 1, I.length) == "2")) {
E.className = "titxhl";
E.style.left = (J - 4) + "px";
E.innerHTML = I
E.className = "titx";
E.style.left = (J - 1) + "px";
E.innerHTML = I.s string(C + 1, I.length)
E.className = "titx";
E.style.left = (J - 1) + "px";
E.innerHTML = ""
J += this.barw + ((document.all) ? -1 : 1)
this.chartw = J + ((document.all) ? 1 : -1);
A.style.width = this.chartw + "px";
for (var G = 0; G & this.yl. G++) {
var D = this.GetPVHeight(this.yl[G]);
if (G != 0 && G != this.yl.length - 1) {
var H = document.createElement("div");
A.appendChild(H);
H.className = "liney";
H.style.width = (this.chartw - ((document.all) ? 1 : -1)) + "px";
H.style.top = (this.charth - D - 1) + "px"
var E = document.createElement("div");
A.appendChild(E);
E.className = "tity";
E.style.width = "35px";
E.style.top = (this.charth - D - 2) + "px";
E.style.left = -42 + "px";
E.innerHTML = this.yl[G]
修正以后发现一个更简单的方法..将eval直接替换成document.write,将代码输出,但是要注意一点.在输出前,先输出一个&xmp&标记 如:
document.write("&xmp&"); /*eval*/document.write("function(){.....代码}"); document.write("&/xmp&");
输出后是一堆代码. 把Javascript格式化一下 格式化的网页工具
阅读(...) 评论()本题难度:0.65&&题型:解答题
如图,公路上有A、B、C三个汽车站,一辆汽车8:00从离A站10km的P地出发,向C站匀速行驶,15min后离A站30km.(1)设出发x&h后,汽车离A站y&km,写出y与x之间的函数表达式;(2)当汽车行驶到离A站250km的B站时,接到通知要在12:00前赶到离B站60km的C站.汽车按原速行驶,能否准时到达?如果能,那么汽车何时到达C站?
来源:学年江苏省泰州市兴化市顾庄等三校联考八年级(上)期末数学试卷 | 【考点】一次函数的应用.
如图,公路上有A、B、C三个汽车站,一辆汽车8:00从离A站10km的P地出发,向C站匀速行驶,15min后离A站30km.(1)设出发x&h后,汽车离A站y&km,写出y与x之间的函数表达式;(2)当汽车行驶到离A站250km的B站时,接到通知要在12:00前赶到离B站60km的C站.汽车按原速行驶,能否准时到达?如果能,那么汽车何时到达C站?
如图,公路上有A、B、C三站,一辆汽车在上午8时从离A站10千米的P地出发向C站匀速前进,15分钟后离A站20千米.(1)设出发x小时后,汽车离A站y千米,写出y与x之间的函数关系式;(2)当汽车行驶到离A站150千米的B站时,接到通知要在中午12点前赶到离B站30千米的C站.汽车若按原速能否按时到达?若能,是在几点几分到达;若不能,车速最少应提高到多少?
解析与答案
(揭秘难题真相,上)
习题“如图,公路上有A、B、C三个汽车站,一辆汽车8:00从离A站10km的P地出发,向C站匀速行驶,15min后离A站30km.(1)设出发xh后,汽车离A站ykm,写出y与x之间的函数表达式;(2)当汽车行驶到离A站250km的B站时,接到通知要在12:00前赶到离B站60km的C站.汽车按原速行驶,能否准时到达?如果能,那么汽车何时到达C站?”的学库宝(/)教师分析与解答如下所示:
【分析】(1)由路程=速度×时间+原来的路程就可以得出结论(2)先求出AC之间的距离再将AC的值代入解析式求出其值即可.
【解答】解:(1)由题意得汽车速度为:(30-10)÷15×60=80km/hy与x之间函数表达式为:y=10+80x.答:y与x之间的函数表达式为y=10+80x(2)由题意得AB=250BC=60∴AC=310.当y=310时310=10+80x解得:x=154.∵8+154=分<12点.∴汽车按原速行驶可以准时到达.
【考点】一次函数的应用.
查看答案和解析
微信扫一扫手机看答案
知识点讲解
经过分析,习题“如图,公路上有A、B、C三个汽车站,一辆汽车8:00从离A站”主要考察你对
等考点的理解。
因为篇幅有限,只列出部分考点,详细请访问。
知识点试题推荐
1&&&&2&&&&3&&&&4&&&&5&&&&6&&&&7&&&&8&&&&9&&&&10&&&&11&&&&12&&&&13&&&&14&&&&15&&&&
作业互助QQ群:(小学)、(初中)、(高中)Copyright & 2008
All rights reserved. 医源世界 版权所有
医源世界所刊载之内容一般仅用于教育目的。您从医源世界获取的信息不得直接用于诊断、治疗疾病或应对您的健康问题。如果您怀疑自己有健康问题,请直接咨询您的保健医生。医源世界、作者、编辑都将不负任何责任和义务。
本站内容来源于网络,转载仅为传播信息促进医药行业发展,如果我们的行为侵犯了您的权益,请及时与我们联系我们将在收到通知后妥善处理该部分内容联系Email:难度较高,求用PHP解密eval(function(p,a,c,k,e,d){e=function(c){类JS加密代码(有加密源码)
要解密的JS代码:
eval(function(p,a,c,k,e,d){e=function(c){return(c&a?'':e(parseInt(c/a)))+((c=c%a)&35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('r m=m=\'[&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/t.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/u.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/v.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/p-n.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/q.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/o.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/s.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/D.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/C-E.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/F.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/w.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/B.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/A.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/x.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/y.9&,&h\\/%1%8%c%2%b%3%2%a%7%0%4%5%6\\/%1%f%l%0%k%j%0%g%3%d%i%e\\/z.9&]\';',42,42,'E8|E7|E5|B1|80|85|20Naruto|8D|81|jpg|BF|BD|AB|E6|87|AC|8B||96|9D|AF|AC631|pages|05|07|04|06|var|08|01|02|03|13|16|17|99|15|14|10|09|11|12'.split('|'),0,{}))
对应的PHP加密类:
/* 9 April 2008. version 1.1
* This is the php version of the Dean Edwards JavaScript's Packer,
* Based on :
* ParseMaster, version 1.0.2 () Copyright 2005, Dean Edwards
* a multi-pattern parser.
* KNOWN BUG: erroneous behavior when using escapeChar with a replacement
* value that is a function
* packer, version 2.0.2 () Copyright , Dean Edwards
* License: http://creativecommons.org/licenses/LGPL/2.1/
* Ported to PHP by Nicolas Martin.
* ----------------------------------------------------------------------
* changelog:
* 1.1 : correct a bug, '\0' packed then unpacked becomes '\'.
* ----------------------------------------------------------------------
* examples of usage :
* $myPacker = new JavaScriptPacker($script, 62, true, false);
* $packed = $myPacker-&pack();
* $myPacker = new JavaScriptPacker($script, 'Normal', true, false);
* $packed = $myPacker-&pack();
* or (default values)
* $myPacker = new JavaScriptPacker($script);
* $packed = $myPacker-&pack();
* params of the constructor :
* $script:
the JavaScript to pack, string.
* $encoding:
level of encoding, int or string :
0,10,62,95 or 'None', 'Numeric', 'Normal', 'High ASCII'.
default: 62.
* $fastDecode:
include the fast decoder in the packed result, boolean.
default : true.
* $specialChars: if you are flagged your private and local variables
in the script, boolean.
default: false.
* The pack() method return the compressed JavasScript, as a string.
* see http://dean.edwards.name/packer/usage/ for more information.
* # need PHP 5 . Tested with PHP 5.1.2, 5.1.3, 5.1.4, 5.2.3
* # The packed result may be different than with the Dean Edwards
version, but with the same length. The reason is that the PHP
function usort to sort array don't necessarily preserve the
original order of two equal member. The Javascript sort function
in fact preserve this order (but that's not require by the
ECMAScript standard). So the encoded keywords order can be
different in the two results.
* # Be careful with the 'High ASCII' Level encoding if you use
UTF-8 in your files...
class JavaScriptPacker {
// constants
const IGNORE = '$1';
// validate parameters
private $_script = '';
private $_encoding = 62;
private $_fastDecode =
private $_specialChars =
private $LITERAL_ENCODING = array(
'None' =& 0,
'Numeric' =& 10,
'Normal' =& 62,
'High ASCII' =& 95
public function __construct($_script, $_encoding = 62, $_fastDecode = true, $_specialChars = false)
$this-&_script = $_script . &\n&;
if (array_key_exists($_encoding, $this-&LITERAL_ENCODING))
$_encoding = $this-&LITERAL_ENCODING[$_encoding];
$this-&_encoding = min((int)$_encoding, 95);
$this-&_fastDecode = $_fastD
$this-&_specialChars = $_specialC
public function pack() {
$this-&_addParser('_basicCompression');
if ($this-&_specialChars)
$this-&_addParser('_encodeSpecialChars');
if ($this-&_encoding)
$this-&_addParser('_encodeKeywords');
return $this-&_pack($this-&_script);
// apply all parsing routines
private function _pack($script) {
for ($i = 0; isset($this-&_parsers[$i]); $i++) {
$script = call_user_func(array(&$this,$this-&_parsers[$i]), $script);
// keep a list of parsing functions, they'll be executed all at once
private $_parsers = array();
private function _addParser($parser) {
$this-&_parsers[] = $
// zero encoding - just removal of white space and comments
private function _basicCompression($script) {
$parser = new ParseMaster();
// make safe
$parser-&escapeChar = '\\';
// protect strings
$parser-&add('/\'[^\'\\n\\r]*\'/', self::IGNORE);
$parser-&add('/&[^&\\n\\r]*&/', self::IGNORE);
// remove comments
$parser-&add('/\\/\\/[^\\n\\r]*[\\n\\r]/', ' ');
$parser-&add('/\\/\\*[^*]*\\*+([^\\/][^*]*\\*+)*\\//', ' ');
// protect regular expressions
$parser-&add('/\\s+(\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?)/', '$2'); // IGNORE
$parser-&add('/[^\\w\\x24\\/\'&*)\\?:]\\/[^\\/\\n\\r\\*][^\\/\\n\\r]*\\/g?i?/', self::IGNORE);
// remove: ;;; doSomething();
if ($this-&_specialChars) $parser-&add('/;;;[^\\n\\r]+[\\n\\r]/');
// remove redundant semi-colons
$parser-&add('/\\(;;\\)/', self::IGNORE); // protect for (;;) loops
$parser-&add('/;+\\s*([};])/', '$2');
// apply the above
$script = $parser-&exec($script);
// remove white-space
$parser-&add('/(\\b|\\x24)\\s+(\\b|\\x24)/', '$2 $3');
$parser-&add('/([+\\-])\\s+([+\\-])/', '$2 $3');
$parser-&add('/\\s+/', '');
return $parser-&exec($script);
private function _encodeSpecialChars($script) {
$parser = new ParseMaster();
// replace: $name -& n, $$name -& na
$parser-&add('/((\\x24+)([a-zA-Z$_]+))(\\d*)/',
array('fn' =& '_replace_name')
// replace: _name -& _0, double-underscore (__name) is ignored
$regexp = '/\\b_[A-Za-z\\d]\\w*/';
// build the word list
$keywords = $this-&_analyze($script, $regexp, '_encodePrivate');
// quick ref
$encoded = $keywords['encoded'];
$parser-&add($regexp,
'fn' =& '_replace_encoded',
'data' =& $encoded
return $parser-&exec($script);
private function _encodeKeywords($script) {
// escape high-ascii values already in the script (i.e. in strings)
if ($this-&_encoding & 62)
$script = $this-&_escape95($script);
// create the parser
$parser = new ParseMaster();
$encode = $this-&_getEncoder($this-&_encoding);
// for high-ascii, don't encode single character low-ascii
$regexp = ($this-&_encoding & 62) ? '/\\w\\w+/' : '/\\w+/';
// build the word list
$keywords = $this-&_analyze($script, $regexp, $encode);
$encoded = $keywords['encoded'];
$parser-&add($regexp,
'fn' =& '_replace_encoded',
'data' =& $encoded
if (empty($script)) return $
//$res = $parser-&exec($script);
//$res = $this-&_bootStrap($res, $keywords);
//return $
return $this-&_bootStrap($parser-&exec($script), $keywords);
private function _analyze($script, $regexp, $encode) {
// analyse
// retreive all words in the script
$all = array();
preg_match_all($regexp, $script, $all);
$_sorted = array(); // list of words sorted by frequency
$_encoded = array(); // dictionary of word-&encoding
$_protected = array(); // instances of &protected& words
$all = $all[0]; // simulate the javascript comportement of global match
if (!empty($all)) {
$unsorted = array(); // same list, not sorted
$protected = array(); // &protected& words (dictionary of word-&&word&)
$value = array(); // dictionary of charCode-&encoding (eg. 256-&ff)
$this-&_count = array(); // word-&count
$i = count($all); $j = 0; //$word =
// count the occurrences - used for sorting later
$word = '$' . $all[$i];
if (!isset($this-&_count[$word])) {
$this-&_count[$word] = 0;
$unsorted[$j] = $
// make a dictionary of all of the protected words in this script
these are words that might be mistaken for encoding
//if (is_string($encode) && method_exists($this, $encode))
$values[$j] = call_user_func(array(&$this, $encode), $j);
$protected['$' . $values[$j]] = $j++;
// increment the word counter
$this-&_count[$word]++;
} while ($i & 0);
// prepare to sort the word list, first we must protect
words that are also used as codes. we assign them a code
equivalent to the word itself.
// e.g. if &do& falls within our encoding range
then we store keywords[&do&] = &do&;
// this avoids problems when decoding
$i = count($unsorted);
$word = $unsorted[--$i];
if (isset($protected[$word]) /*!= null*/) {
$_sorted[$protected[$word]] = substr($word, 1);
$_protected[$protected[$word]] =
$this-&_count[$word] = 0;
} while ($i);
// sort the words by frequency
// Note: the javascript and php version of sort can be different :
// in php manual, usort :
// & If two members compare as equal,
// their order in the sorted array is undefined.&
// so the final packed script is different of the Dean's javascript version
// but equivalent.
// the ECMAscript standard does not guarantee this behaviour,
// and thus not all browsers (e.g. Mozilla versions dating back to at
// least 2003) respect this.
usort($unsorted, array(&$this, '_sortWords'));
// because there are &protected& words in the list
we must add the sorted words around them
if (!isset($_sorted[$i]))
$_sorted[$i] = substr($unsorted[$j++], 1);
$_encoded[$_sorted[$i]] = $values[$i];
} while (++$i & count($unsorted));
return array(
=& $_sorted,
'encoded' =& $_encoded,
'protected' =& $_protected);
private $_count = array();
private function _sortWords($match1, $match2) {
return $this-&_count[$match2] - $this-&_count[$match1];
// build the boot function used for loading and decoding
private function _bootStrap($packed, $keywords) {
$ENCODE = $this-&_safeRegExp('$encode\\($count\\)');
// $packed: the packed script
$packed = &'& . $this-&_escape($packed) . &'&;
// $ascii: base for encoding
$ascii = min(count($keywords['sorted']), $this-&_encoding);
if ($ascii == 0) $ascii = 1;
// $count: number of words contained in the script
$count = count($keywords['sorted']);
// $keywords: list of words contained in the script
foreach ($keywords['protected'] as $i=&$value) {
$keywords['sorted'][$i] = '';
// convert from a string to an array
ksort($keywords['sorted']);
$keywords = &'& . implode('|',$keywords['sorted']) . &'.split('|')&;
$encode = ($this-&_encoding & 62) ? '_encode95' : $this-&_getEncoder($ascii);
$encode = $this-&_getJSFunction($encode);
$encode = preg_replace('/_encoding/','$ascii', $encode);
$encode = preg_replace('/arguments\\.callee/','$encode', $encode);
$inline = '\\$count' . ($ascii & 10 ? '.toString(\\$ascii)' : '');
// $decode: code snippet to speed up decoding
if ($this-&_fastDecode) {
// create the decoder
$decode = $this-&_getJSFunction('_decodeBody');
if ($this-&_encoding & 62)
$decode = preg_replace('/\\\\w/', '[\\xa1-\\xff]', $decode);
// perform the encoding inline for lower ascii values
elseif ($ascii & 36)
$decode = preg_replace($ENCODE, $inline, $decode);
// special case: when $count==0 there are no keywords. I want to keep
the basic shape of the unpacking funcion so i'll frig the code...
if ($count == 0)
$decode = preg_replace($this-&_safeRegExp('($count)\\s*=\\s*1'), '$1=0', $decode, 1);
// boot function
$unpack = $this-&_getJSFunction('_unpack');
if ($this-&_fastDecode) {
// insert the decoder
$this-&buffer = $
$unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastDecode'), $unpack, 1);
$unpack = preg_replace('/&/', &'&, $unpack);
if ($this-&_encoding & 62) { // high-ascii
// get rid of the word-boundaries for regexp matches
$unpack = preg_replace('/\'\\\\\\\\b\'\s*\\+|\\+\s*\'\\\\\\\\b\'/', '', $unpack);
if ($ascii & 36 || $this-&_encoding & 62 || $this-&_fastDecode) {
// insert the encode function
$this-&buffer = $
$unpack = preg_replace_callback('/\\{/', array(&$this, '_insertFastEncode'), $unpack, 1);
// perform the encoding inline
$unpack = preg_replace($ENCODE, $inline, $unpack);
// pack the boot function too
$unpackPacker = new JavaScriptPacker($unpack, 0, false, true);
$unpack = $unpackPacker-&pack();
// arguments
$params = array($packed, $ascii, $count, $keywords);
if ($this-&_fastDecode) {
$params[] = 0;
$params[] = '{}';
$params = implode(',', $params);
// the whole thing
return 'eval(' . $unpack . '(' . $params . &))\n&;
private function _insertFastDecode($match) {
return '{' . $this-&buffer . ';';
private function _insertFastEncode($match) {
return '{$encode=' . $this-&buffer . ';';
// mmm.. ..which one do i need ??
private function _getEncoder($ascii) {
return $ascii & 10 ? $ascii & 36 ? $ascii & 62 ?
'_encode95' : '_encode62' : '_encode36' : '_encode10';
// zero encoding
// characters:
private function _encode10($charCode) {
return $charC
// inherent base36 support
// characters: abcdefghijklmnopqrstuvwxyz
private function _encode36($charCode) {
return base_convert($charCode, 10, 36);
// hitch a ride on base36 and add the upper case alpha characters
// characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
private function _encode62($charCode) {
$res = '';
if ($charCode &= $this-&_encoding) {
$res = $this-&_encode62((int)($charCode / $this-&_encoding));
$charCode = $charCode % $this-&_
if ($charCode & 35)
return $res . chr($charCode + 29);
return $res . base_convert($charCode, 10, 36);
// use high-ascii values
// characters: &&&&&&&&&&&&&&&&&²³&&&&&¹&&¼½¾&&A&A&A&A&A&A&AE&C&E&E&E&E&I&I&I&IÐ&N&O&O&O&O&O&&O&U&U&U&U&YÞ&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
private function _encode95($charCode) {
$res = '';
if ($charCode &= $this-&_encoding)
$res = $this-&_encode95($charCode / $this-&_encoding);
return $res . chr(($charCode % $this-&_encoding) + 161);
private function _safeRegExp($string) {
return '/'.preg_replace('/\$/', '\\\$', $string).'/';
private function _encodePrivate($charCode) {
return &_& . $charC
// protect characters used by the parser
private function _escape($script) {
return preg_replace('/([\\\\\'])/', '\\\$1', $script);
// protect high-ascii characters already in the script
private function _escape95($script) {
return preg_replace_callback(
'/[\\xa1-\\xff]/',
array(&$this, '_escape95Bis'),
private function _escape95Bis($match) {
return '\x'.((string)dechex(ord($match)));
private function _getJSFunction($aName) {
if (defined('self::JSFUNCTION'.$aName))
return constant('self::JSFUNCTION'.$aName);
return '';
// JavaScript Functions used.
// Note : In Dean's version, these functions are converted
// with 'String(aFunctionName);'.
// This internal conversion complete the original code, ex :
// 'while (aBool) anAction();' is converted to
// 'while (aBool) { anAction(); }'.
// The JavaScript functions below are corrected.
// unpacking function - this is the boot strap function
data extracted from this packing routine is passed to
this function when decoded in the target
// NOTE ! : without the ';' final.
const JSFUNCTION_unpack =
'function($packed, $ascii, $count, $keywords, $encode, $decode) {
while ($count--) {
if ($keywords[$count]) {
$packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]);
'function($packed, $ascii, $count, $keywords, $encode, $decode) {
while ($count--)
if ($keywords[$count])
$packed = $packed.replace(new RegExp(\'\\\\b\' + $encode($count) + \'\\\\b\', \'g\'), $keywords[$count]);
// code-snippet inserted into the unpacker to speed up decoding
const JSFUNCTION_decodeBody =
//_decode = function() {
// does the browser support String.replace where the
replacement value is a function?
if (!\'\'.replace(/^/, String)) {
// decode all the values we need
while ($count--) {
$decode[$encode($count)] = $keywords[$count] || $encode($count);
// global replacement function
$keywords = [function ($encoded) {return $decode[$encoded]}];
// generic match
$encode = function () {return \'\\\\w+\'};
// reset the loop counter -
we are now doing a global replace
$count = 1;
' if (!\'\'.replace(/^/, String)) {
// decode all the values we need
while ($count--) $decode[$encode($count)] = $keywords[$count] || $encode($count);
// global replacement function
$keywords = [function ($encoded) {return $decode[$encoded]}];
// generic match
$encode = function () {return\'\\\\w+\'};
// reset the loop counter -
we are now doing a global replace
$count = 1;
// zero encoding
// characters:
const JSFUNCTION_encode10 =
'function($charCode) {
return $charC
// inherent base36 support
// characters: abcdefghijklmnopqrstuvwxyz
const JSFUNCTION_encode36 =
'function($charCode) {
return $charCode.toString(36);
// hitch a ride on base36 and add the upper case alpha characters
// characters: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
const JSFUNCTION_encode62 =
'function($charCode) {
return ($charCode & _encoding ? \'\' : arguments.callee(parseInt($charCode / _encoding))) +
(($charCode = $charCode % _encoding) & 35 ? String.fromCharCode($charCode + 29) : $charCode.toString(36));
// use high-ascii values
// characters: &&&&&&&&&&&&&&&&&²³&&&&&¹&&¼½¾&&A&A&A&A&A&A&AE&C&E&E&E&E&I&I&I&IÐ&N&O&O&O&O&O&&O&U&U&U&U&YÞ&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
const JSFUNCTION_encode95 =
'function($charCode) {
return ($charCode & _encoding ? \'\' : arguments.callee($charCode / _encoding)) +
String.fromCharCode($charCode % _encoding + 161);
class ParseMaster {
public $ignoreCase =
public $escapeChar = '';
// constants
const EXPRESSION = 0;
const REPLACEMENT = 1;
const LENGTH = 2;
// used to determine nesting levels
private $GROUPS = '/\\(/';//g
private $SUB_REPLACE = '/\\$\\d/';
private $INDEXED = '/^\\$\\d+$/';
private $TRIM = '/([\'&])\\1\\.(.*)\\.\\1\\1$/';
private $ESCAPE = '/\\\./';//g
private $QUOTE = '/\'/';
private $DELETED = '/\\x01[^\\x01]*\\x01/';//g
public function add($expression, $replacement = '') {
// count the number of sub-expressions
- add one because each pattern is itself a sub-expression
$length = 1 + preg_match_all($this-&GROUPS, $this-&_internalEscape((string)$expression), $out);
// treat only strings $replacement
if (is_string($replacement)) {
// does the pattern deal with sub-expressions?
if (preg_match($this-&SUB_REPLACE, $replacement)) {
// a simple lookup? (e.g. &$2&)
if (preg_match($this-&INDEXED, $replacement)) {
// store the index (used for fast retrieval of matched strings)
$replacement = (int)(substr($replacement, 1)) - 1;
} else { // a complicated lookup (e.g. &Hello $2 $1&)
// build a function to do the lookup
$quote = preg_match($this-&QUOTE, $this-&_internalEscape($replacement))
? '&' : &'&;
$replacement = array(
'fn' =& '_backReferences',
'data' =& array(
'replacement' =& $replacement,
'length' =& $length,
'quote' =& $quote
// pass the modified arguments
if (!empty($expression)) $this-&_add($expression, $replacement, $length);
else $this-&_add('/^$/', $replacement, $length);
public function exec($string) {
// execute the global replacement
$this-&_escaped = array();
// simulate the _patterns.toSTring of Dean
$regexp = '/';
foreach ($this-&_patterns as $reg) {
$regexp .= '(' . substr($reg[self::EXPRESSION], 1, -1) . ')|';
$regexp = substr($regexp, 0, -1) . '/';
$regexp .= ($this-&ignoreCase) ? 'i' : '';
$string = $this-&_escape($string, $this-&escapeChar);
$string = preg_replace_callback(
'_replacement'
$string = $this-&_unescape($string, $this-&escapeChar);
return preg_replace($this-&DELETED, '', $string);
public function reset() {
// clear the patterns collection so that this object may be re-used
$this-&_patterns = array();
// private
private $_escaped = array();
// escaped characters
private $_patterns = array(); // patterns stored by index
// create and add a new pattern to the patterns collection
private function _add() {
$arguments = func_get_args();
$this-&_patterns[] = $
// this is the global replace function (it's quite complicated)
private function _replacement($arguments) {
if (empty($arguments)) return '';
$i = 1; $j = 0;
// loop through the patterns
while (isset($this-&_patterns[$j])) {
$pattern = $this-&_patterns[$j++];
// do we have a result?
if (isset($arguments[$i]) && ($arguments[$i] != '')) {
$replacement = $pattern[self::REPLACEMENT];
if (is_array($replacement) && isset($replacement['fn'])) {
if (isset($replacement['data'])) $this-&buffer = $replacement['data'];
return call_user_func(array(&$this, $replacement['fn']), $arguments, $i);
} elseif (is_int($replacement)) {
return $arguments[$replacement + $i];
$delete = ($this-&escapeChar == '' ||
strpos($arguments[$i], $this-&escapeChar) === false)
? '' : &\x01& . $arguments[$i] . &\x01&;
return $delete . $
// skip over references to sub-expressions
$i += $pattern[self::LENGTH];
private function _backReferences($match, $offset) {
$replacement = $this-&buffer['replacement'];
$quote = $this-&buffer['quote'];
$i = $this-&buffer['length'];
while ($i) {
$replacement = str_replace('$'.$i--, $match[$offset + $i], $replacement);
private function _replace_name($match, $offset){
$length = strlen($match[$offset + 2]);
$start = $length - max($length - strlen($match[$offset + 3]), 0);
return substr($match[$offset + 1], $start, $length) . $match[$offset + 4];
private function _replace_encoded($match, $offset) {
return $this-&buffer[$match[$offset]];
// php : we cannot pass additional data to preg_replace_callback,
// and we cannot use &$this in create_function, so let's go to lower level
// encode escaped characters
private function _escape($string, $escapeChar) {
if ($escapeChar) {
$this-&buffer = $escapeC
return preg_replace_callback(
'/\\' . $escapeChar . '(.)' .'/',
array(&$this, '_escapeBis'),
private function _escapeBis($match) {
$this-&_escaped[] = $match[1];
return $this-&
// decode escaped characters
private function _unescape($string, $escapeChar) {
if ($escapeChar) {
$regexp = '/'.'\\'.$escapeChar.'/';
$this-&buffer = array('escapeChar'=& $escapeChar, 'i' =& 0);
return preg_replace_callback
array(&$this, '_unescapeBis'),
private function _unescapeBis() {
if (isset($this-&_escaped[$this-&buffer['i']])
&& $this-&_escaped[$this-&buffer['i']] != '')
$temp = $this-&_escaped[$this-&buffer['i']];
$temp = '';
$this-&buffer['i']++;
return $this-&buffer['escapeChar'] . $
private function _internalEscape($string) {
return preg_replace($this-&ESCAPE, '', $string);
求PHP解密。。
eval()-&document.write()
--- 共有 1 条评论 ---
这个要在服务器端解密,即用PHP解密,JS没用的。因为处理过程不在浏览器中。
这。。看来是有点难。。

我要回帖

更多关于 装配尺寸链计算 的文章

 

随机推荐