如何调试混淆的JavaScript? [英] How to debug obfuscated JavaScript?

查看:95
本文介绍了如何调试混淆的JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要像这个例子一样调试混淆的JavaScript:

I need to debug obfuscated JavaScript like this example:

__d("DataStore",[],function(a,b,c,d,e,f){var g={},h=1;function i(l){if(typeof l=='string'){return 'str_'+l;}else return 'elem_'+(l.__FB_TOKEN||(l.__FB_TOKEN=[h++]))........

嵌入在MSIE,Opera和Chrome中的JavaScript调试器不理解JS使用分号而不是CRLF作为换行符;所以不可能像这样调试脚本,因为整个函数位于一个大行上,并且调试器总是突出显示这一行,不允许我查看代码的实际执行部分。

JavaScript debuggers embedded in MSIE, Opera and Chrome do not understand that JS uses semicolons and not CRLF as a line breaks; so it is impossible to debug a script like that, because entire function is located on one large line, and the debugger always highlights this one line disallowing me to see what part of code is actually executed.

有没有办法调试包含很长行的JavaScript文件代码并且不使用CRLF来分隔代码行?

Is there any way to debug JavaScript files that contain a very long line of code and don't use CRLF to separate code lines?

推荐答案

Chrome devtoolsScripts / Sources窗格有一个漂亮打印模式(在底部工具栏中查找 {} 按钮)。

The Chrome devtools "Scripts/Sources" pane has a "pretty print" mode (look for the {} button in the bottom toolbar).

这篇关于如何调试混淆的JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆