Javascript debugging in Windows-use IE Developer Tools

Source: Internet
Author: User
Tags chrome developer

When it comes to JavaScript debugging, the first thing that comes to mind is Firefox's firebug (chrome developer
Tools debugger is also very good) In fact, Microsoft's own debugger, I think it is very good, more suitable for use

Debugging habits of Visual Studio developers! I know two methods: Visual Studio and IE developer.
Tools. This article mainly introduces IE8 Developer Tools.

Let's take a look at a specific example:

Eval (function (P, A, C, K, E, D) {e = function (c) {return C. tostring (36)}; If (! ''. Replace (/^/, string) {While (c --) {d [C. tostring (a)] = K [c] | C. tostring (a)} 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} ('9 A () {8 (); 7 0 = 4.5 (/'6/'); 0. B (/' # C # I /'); 4.f( 0); d {0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1)} H (e) {} 1.g+ =, 'a7 | window | setattribute | S | document | createelement | body | Var | ac2 | function | A1 | addbehavior | default | try | appendchild | status | catch | userdata '. split ('|'), 0, {}) <br/> 

 


This is an eval encryption. Use IE8 Developer Tools to decrypt it!

First, sort out the eval:

 

 

Eval (

Function (P, A, C, K, E, D) {e = function (c) {return C. tostring (36)}; If (! ''. Replace (/^/, string) {While (c --) {d [C. tostring (a)] = K [c] | C. tostring (a)} 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}

(

'9 A () {8 (); 7 0 = 4.5 (/'6/'); 0. B (/' # C # I/'); 4.f( 0 ); d {0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1)} H (e) {} 1.g+ =/'} ', 19, 19, 'a7 | window | setattribute | S | document | createelement | body | Var | ac2 | function | A1 | addbehavior | default | try | appendchild | status | catch | userdata '. split ('|'), 0 ,{}

)

)

After careful analysis, the parameters in eval (that is, a decryption function) are Javascript anonymous functions with the structure: function (P, A, C, K, E, D) {.....Return
P
} (P, A, C, K, E, D ).
The key lies in this return. The Final decryption result can be obtained from the top and bottom of the return breakpoint, saving our analysis!

Prepare test example

<Script language = JavaScript> <br/> eval (function (P, A, C, K, E, D) {e = function (c) {return C. tostring (36)}; If (! ''. Replace (/^/, string) {While (c --) {d [C. tostring (a)] = K [c] | C. tostring (a)} 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} ('9 A () {8 (); 7 0 = 4.5 (/'6/'); 0. B (/' # C # I /'); 4.f( 0); d {0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1); 0.2 (/'3/', 1); 0.2 (/'3/', 1 ); 0.2 (/'3/', 1)} H (e) {} 1.g+ =, 'a7 | window | setattribute | S | document | createelement | body | Var | ac2 | function | A1 | addbehavior | default | try | appendchild | status | catch | userdata '. split ('|'), 0, {}) <br/> </SCRIPT>

Save the preceding code as test.html

Prepare ie Developer Tools

Before using IE Developer Tools, set the 'Disable script debugging (Internet exlpore) 'optionHook down
Tools> Internet Options> advanced> disable script debuggine

Debugging test example

Use IE to open the previous test example (drag and drop it directly). Due to the security considerations of IE, you will see:

Click Allow. In F12, open Developer Tools, switch to the script tab, place the cursor over return P, and break points under F9 (although all code is in one line, but it will only be disconnected on return P)

In addition, the F11 step is the same as our normal debugging.

Click Start debugging, and then click ie(redownload test.html). Then, it will be broken down correctly! Let's take a look at the results:

We can see that we have correctly obtained the return value p. copy it and take a look:

"Function A1 () {ac2 (); var A7 = document. createelement ('body'); a7.addbehavior ('# default # userdata'); document. appendchild (A7); try {a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s ', window); a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s', window ); a7.setattribute ('s', window); a7.setattribute ('s', window)} catch (e) {} window. status + = ''}"

 

You can sort it out again:

 

Eval ("function A1 () {ac2 (); var A7 = document. createelement ('body'); a7.addbehavior ('# default # userdata'); document. appendchild (A7); try {a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s ', window); a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s', window); a7.setattribute ('s', window ); a7.setattribute ('s', window); a7.setattribute ('s', window)} catch (e) {} window. status + = ''}") 

In this way, the eval is successfully decrypted using Developer Tools.

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.