Decodes JavaScript code similar to eval (function (P, A, C, K, E, D) {}).

Source: Internet
Author: User

Reference: http://hi.baidu.com/xcb521/blog/item/2ac50dc6253c79d6d1006073.html

Here, Baidu access statistics code constructor is decoded as an example:

Baidu access statistics code JavaScript source code:
The red and bold parts will be modified.
Eval (function (P, A, C, K, E, D) {e = function (c) {return (C <? "": 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 = "1A"; a.6.z = 5. B + "7"; 5. r. J (a); 9
K = 8. I ("K");. J (k); K. A = "1B"; 9 J = 0; q (9G = 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");. 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;" + 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");. 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 | substring | 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 | u6708 | u65e5 | titxhl | getelementbyid | math | round | return | create | offsetheight | chart | hit | tity '. split ('|'), 0 ,{}));

Actually, this eval (function (P, A, C, K, E, D) {}) comes with the decoded function E ().
While (c --) {If (K [c]) {P = P. Replace (New
Regexp ('// B' + E (c) + '// B', 'G'), K [c])} return P


Every P produced by the while loop is the decoded function code. We delete the return P in the source code and do not need to return the result,
It is directly output in a text area, such as document. getelementbyid ("textareaid"). innertext = P.

Final code:
<! Doctype HTML public "-// 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 statistical constructor </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"
/>
<Meta http-equiv = "X-UA-compatible" content = "Ie = emulateie7"/>
<Meta name = "author" content = www.gemingcao.com
/>
<Meta name = "keywords" content = ""/>
<Meta name = "Description" content = ""/>
</Head>
<Body>
<Textarea id ="
Textareaid
"Rows =" 25"
Cols = "50"> </textarea>


<Script
Type = "text/javascrpt">


Eval (function (P, A, C, K, E, D) {e = function (c) {return (C <? "": 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 = "1A"; a.6.z = 5. B + "7"; 5. r. J (a); 9
K = 8. I ("K");. J (k); K. A = "1B"; 9 J = 0; q (9G = 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");. 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;" + 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");. 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 | substring | 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 | u6708 | u65e5 | titxhl | getelementbyid | math | round | return | create | offsetheight | chart | hit | tity '. split ('|'), 0 ,{}));

</SCRIPT>


</Body>
</Html>

Save as an HTML file and run.
Format the JavaScript code in the text area. The Code is as follows:
Function Chart (E, D, A, C, B ){
This. Parent = Document. getelementbyid (E );
This. XL = D;
This. yl =;
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
};
Chart. Prototype. Create = function (){
VaR A = Document. createelement ("Div ");
A. classname = "chart ";
A. style. Height = This. charth + "PX ";
This. Parent. appendchild ();
VaR K = Document. createelement ("Div ");
A. appendchild (k );
K. classname = "hit ";
VaR J = 0;
For (var g = 0; G <this. XL. length; 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 = "& nbsp ;";
F. ohit = K;
F. onmouseover = function (){
This. classname = "barhl ";
This. ohit. style. Display = "";
This. ohit. innerhtml = This. Id. substring (3, this. Id. Length );
This. ohit. style. Left = This. style. Left;
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. substring (0, c) + "/u6708" + I. substring (C +
1, I. Length) + "/u65e5 & nbsp;" + this. XL [g];
If (G % 4 = 0 ){
If (I. substring (C + 1, I. Length) = "1" | I. substring (C +
1, I. Length) = "2 ")){
E. classname = "titxhl ";
E. style. Left = (J-4) + "PX ";
E. innerhtml = I
} Else {
E. classname = "titx ";
E. style. Left = (J-1) + "PX ";
E. innerhtml = I. substring (C + 1, I. length)
}
} Else {
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. length; 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]
}
};

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.