一款JavaScript 混淆(Obfuscator)工具(Tool)的研究(一)
1.研究使用的工具及网站
https://obfuscator.io 主要研究对象,主要是研究此网站的各种混淆方法及**办法。
http://jsnice.org/ 用来格式化代码,方便调试。
notepad++ 编辑代码。
某浏览器 具有谷歌内核的浏览器,主要用来调试JS代码。
2.网站功能选项翻译
Compact Code 紧凑代码 |
Removes line breaks from the output obfuscated code. 从输出的混淆代码中删除换行符。 | ||||||||
Identifier Names Generator 标识符名称生成器 |
Use this option to control how identifiers (variable names, functions names, etc) will be obfuscated. 使用此选项来控制如何混淆标识符(变量名,函数名等)。 dictionary 字典Generates identifier names using names from Generates random identifier names using a hexadecimal pattern (e.g: Uses short identifier names (e.g: |
||||||||
Identifiers Dictionary 标识符字典 |
This options sets identifiers list for 此选项设置identifierNamesGenerator的标识符列表:dictionary选项。简单的说所有的标识符(常量,变量函数名等)都不可见了,只能通过查字典来获取标识符。 |
||||||||
Identifiers Prefix 标识符前缀 |
This options makes all global identifiers have a specific prefix. 此选项使所有全局标识符具有特定的前缀。 Use this option when obfuscating multiple files that are loaded on the same page. This option helps to avoid conflicts between global identifiers of these files. Use a different prefix for each file.当混淆同一页面上加载的多个文件时,请使用此选项。此选项有助于避免这些文件的全局标识符之间的冲突。为每个文件使用不同的前缀。 |
||||||||
Rename Globals 全局变量重命名 |
This option can break your code. Only enable it if you know what it does. Enables the obfuscation of global variables and function names with declaration. 此选项可能会破坏您的代码。仅在知道它的功能时启用它。 |
||||||||
Self Defending 自我保护 |
This option makes the output code resilient against formating and variable renaming. 此选项使输出代码可抵抗格式设置和变量重命名。 If one tries to use a JavaScript beautifier on the obfuscated code, the code won't work anymore, making it harder to understand and modify it.如果尝试在混淆后的代码上使用JavaScript美化器,则该代码将无法再使用,从而使其难以理解和修改。 requires the Compact Code setting. |
||||||||
Control Flow Flattening 平坦控制流 |
This option greatly affects the performance up to 1.5x slower runtime speed.此选项对性能的影响最大为运行速度降低1.5倍。 Enables code control flow flattening. Control flow flattening is a structure transformation of the source code that hinders program comprehension. See the docs on JavaScript's obfuscator GH page for an example of how the transformation works. 启用代码控制流平坦。控制流扁平化是源代码的结构转换,它阻碍了程序的理解。有关转换如何工作的示例,请参见JavaScript的混淆器GH页面上的文档。
|
||||||||
Dead Code Injection 加入花指令 |
This option increases the size of the obfuscated code greatly (up to 200%).此选项极大地增加了混淆代码的大小(最多200%)。 This feature adds random blocks of dead code (i.e: code that won't be executed) to the obfuscated output, making it harder to be reverserd-engineered. See the docs on JavaScript Obfuscator's GH page for an example of how this feature works. 此功能将混淆代码的随机块(即将不会执行的代码)添加到混淆后的输出中,从而更难进行反向工程。有关此功能如何工作的示例,请参见JavaScript Obfuscator的GH页面上的文档。
requires the String Array option.需要“字符串数组”选项。 |
||||||||
Split Strings 分割字符串 |
This option increases the size of the obfuscated code.此选项增加了混淆代码的大小。 This feature splits literal strings into chunks with length of the 此功能将文字字符串拆分为具有splitStringsChunkLength选项值长度的块。
|
||||||||
String Array 字符串数组 |
Removes string literals and place them in a special array. For instance the string "Hello World" in 删除字符串文字并将其放置在特殊数组中。例如,在var m =“ Hello World”中的字符串“ Hello World”;将替换为对将在运行时检索其值的函数的调用,例如:var m = _0xb0c3('0x1'); See the options below on how to configure this feature be more or less resilient. 请参阅以下有关如何配置此功能或多或少具有弹性的选项。
|
||||||||
Transform Object Keys 转换对象键 |
Transforms (obfuscates) object keys.转换(混淆)对象键。 For instance, this code See the official documentation of the JavaScript Obfuscator on GitHub for a full example.有关完整示例,请参见GitHub上的JavaScript Obfuscator的官方文档。 ideally used with the String Array setting. 此最想通常跟字符数据选项一起使用。 |
||||||||
Escape Unicode Sequence 转义Unicode序列 |
Converts all the strings to their unicode representation. For instance, the string 将所有字符串转换为它们的unicode表示形式。 例如,字符串“ Hello World!”。 将被转换为“'\ x48 \ x65 \ x6c \ x6c \ x6f \ x20 \ x57 \ x6f \ x72 \ x6c \ x64 \ x21”。 This convertion is pretty easy to revert, and will increase the obfuscated code size greatly. It's not recommended on larger code bases.此转换非常容易还原,并且将大大增加混淆的代码大小。 不建议在较大的代码库中使用。 |
||||||||
Disable Console Output 禁用控制台输出 |
Disables the use of 禁用控制台输出通过将它们替换为空函数来禁用对console.log,console.info,console.error和console.warn的使用。 这使得调试器的使用更加困难。 |
||||||||
Debug Protection 反调试 |
Can freeze your browser if you open the Developer Tools.如果打开开发人员工具,则可以卡死浏览器。 This option makes it almost impossible to use the Console tab of the Developer Tools (both on Google Chrome and Mozilla Firefox). 使用此选项几乎无法使用开发人员工具的控制台选项卡(在Google Chrome和Mozilla Firefox上)。
|
||||||||
Domain Lock 域锁 |
Locks the obfuscated source code so it only runs on specific domains and/or sub-domains. This makes really hard for someone just copy and paste your source code and run elsewhere.锁定混淆的源代码,使其仅在特定的域和/或子域上运行。对于仅复制并粘贴源代码并在其他地方运行的人来说,这真的很难。 Multiple domains and sub-domains 多个域和子域It's possible to lock your code to more than one domain or sub-domain. For instance, to lock it so the code only runs on www.example.com add 可以将代码锁定到多个域或子域。例如,要对其进行锁定以使代码仅在www.example.com上运行,请添加www.example.com,以使其在example.com的任何子域中均可使用,请使用.example.com。 |
||||||||
Reserved Names 保留名称 |
Disables obfuscation and generation of identifiers, which being matched by passed RegExp patterns. 禁用混淆和标识符的生成,这些标识符与通过的RegExp模式匹配。 For instance, if you add 例如,如果添加^ someName,混淆器将确保不会破坏以someName开头的所有变量,函数名称和函数参数。 |
||||||||
Reserved Strings 保留字串 |
Disables transformation of string literals, which being matched by passed RegExp patterns. 禁用字符串文字的转换,该文字与通过的RegExp模式匹配。 For instance, if you add 例如,如果添加^ some * string,混淆器将确保所有以某个字符串开头的字符串都不会移到`stringArray`中。 |
||||||||
Source Map 源图 |
Be sure not to upload the obfuscated source code with the inline source map embedded on it, as it contains your original source code.确保不要上传嵌入了嵌入式源代码映射的混淆后的源代码,因为它包含原始源代码。 Source maps can be useful to help you debug your obfuscated Java Script source code. If you want or need to debug in production, you can upload the separate source map file to a secret location and then point your browser there. Read more about source maps on the Google Chrome Developer Tools website. 源映射可以帮助您调试混淆的Java Script源代码。如果要在生产中进行调试,可以将单独的源映射文件上载到秘密位置,然后将浏览器指向该位置。在Google Chrome开发者工具网站上详细了解源地图。 Inline Source Map内联源地图This embeds the source map of your source in the result of the obfuscated code. Useful if you just want to debug locally on your machine.这会将源代码的源映射嵌入到混淆代码的结果中。如果只想在计算机上进行本地调试,则很有用。 Separate Source Map单独的源地图This generates a separate file with the source map. Useful to debug code in production, as this enables you to upload the source map to a secret location on your server and then point your browser to use it. 这将与源映射一起生成一个单独的文件。这对于调试生产中的代码很有用,因为这使您可以将源映射上载到服务器上的秘密位置,然后指向浏览器使用它。 Use the Source Map Base URL and Source Map File Name to customize the 使用Source Map Base URL和Source Map File Name来定制sourceMappingURL属性,该属性将附加到混淆代码的末尾。 For instance, if you set the Base URL to 例如,如果将基本URL设置为“ http:// localhost:9000”,文件名设置为“ example”,则将得到://#sourceMappingURL = http:// localhost:9000 / example.js.map 。附加到混淆代码的末尾。 |
||||||||
Seed 种子 |
By default ( 默认情况下(seed = 0),每次混淆代码时,您都会得到一个新结果(即:不同的变量名,插入stringArray中的变量不同,等等)。 如果要获得可重复的结果,请将种子设置为特定的整数。 |
||||||||
Target 目标 |
You can set the target environment of the obfuscated code to one of the following:您可以将混淆代码的目标环境设置为以下之一:
Currently the output of |
网站功能区截图: