一款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 identifiersDictionary list  通過查字典來獲取標識符名稱

hexadecimal 16進制

Generates random identifier names using a hexadecimal pattern (e.g: 0xabc123) 使用十六進制模式生成隨機標識符名稱(例如:0xabc123)

mangled 單字母變量

Uses short identifier names (e.g: abc, etc.) 使用簡短的標識符名稱(例如:a,b,c等)

Identifiers Dictionary

標識符字典

This options sets identifiers list for identifierNamesGenerator: dictionary option

此選項設置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頁面上的文檔。
 

Control Flow Flattening Threshold

控制流展平閾值

You can use this setting to adjust the probability (from 0 to 1) that a controlFlowFlattening transformation will be applied to a node.您可以使用此設置來調整將controlFlowFlattening轉換應用於節點的可能性(從0到1)。

In larger codebases it's advised to lower this value, because larger amounts of control flow transformations can increase the size of your code and slow it down.在較大的代碼庫中,建議降低此值,因爲大量的控制流轉換會增加代碼的大小並減慢其速度。

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頁面上的文檔。

 

Dead Code Injection Threshold

花指令注入閾值

You can use this setting to adjust the probability (from 0 to 1) that a node will be affected by the deadCodeInjection option.

您可以使用此設置調整節點受deadCodeInjection選項影響的概率(從0到1)。

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 option value.

此功能將文字字符串拆分爲具有splitStringsChunkLength選項值長度的塊。

Split Strings Chunk Length

分叉弦塊長度

You can use this setting to set chunk length of the splitStrings option.

您可以使用此設置來設置splitStrings選項的塊長度。

String Array

字符串數組

Removes string literals and place them in a special array. For instance the string "Hello World" in var m = "Hello World"; will be replaced to a call to a function that will retrieve its value at runtime, e.g: var m = _0xb0c3('0x1');

刪除字符串文字並將其放置在特殊數組中。例如,在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.

請參閱以下有關如何配置此功能或多或少具有彈性的選項。

Rotate String Array

旋轉字符串數組

Shift the stringArray array by a fixed and random (generated at the code obfuscation) places. This makes it harder to match the order of the removed strings to their original place.

將stringArray數組移動一個在混淆代碼中隨機生成的固定位置。這使得將刪除的字符串的順序與其原始位置匹配變得更加困難。

作者注:例如數組[1,2,4,6,7],代碼隨機生成一個偏移2,則數組變成[6,7,1,2,4]

This option is recommended if your original source code isn't small, as the helper function can attract attention.

如果原始源代碼不小,則建議使用此選項,因爲輔助功能會引起注意。

Shuffle String Array

隨機字符串數組

Randomly shuffles the stringArray array items.

隨機改組stringArray數組項。
 

Encode String Literals

加密字符串

 This option can slightly slow down your script.此選項會稍微降低腳本速度。

Encode all string literals of the stringArray using either Base64 or RC4 and inserts a special function that it's used to decode it back at runtime.使用Base64或RC4對stringArray的所有字符串文字進行編碼,並插入一個特殊的函數,用於在運行時對其進行解碼。

Beware that the RC4 option is about 30-35% slower than the Base64 option, but it's more difficult to retrieve the strings back.請注意,RC4選項比​​Base64選項慢大約30-35%,但更難找回字符串。

String Array Threshold

字符串數組閾值

You can use this setting to adjust the probability (from 0 to 1) that a string literal will be inserted into the stringArray.您可以使用此設置來調整將字符串文字插入到stringArray中的比例(從0到1)。

This setting is useful in large codebases as repeatdely calls to the stringArray function can slow down your code.此選項在大型代碼庫中很有用,因爲反覆調用stringArray函數會降低代碼速度。

Transform Object Keys

轉換對象鍵

Transforms (obfuscates) object keys.轉換(混淆)對象鍵。

For instance, this code var a = {enabled: true}; when obfuscated with this option will hide the enabled object key: var a = {}; a[_0x2ae0[('0x0')] = true;.例如,這段代碼var a = {enabled:true}; 當對此選項進行混淆時,將隱藏啓用的對象鍵:var a = {}; a [_0x2ae0 [('0x0')] = true;。

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 "Hello World!" will be converted to "'\x48\x65\x6c\x6c\x6f\x20\x57\x6f\x72\x6c\x64\x21".

將所有字符串轉換爲它們的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.logconsole.infoconsole.error and console.warn by replacing them with empty functions. This makes the use of the debugger harder.

禁用控制檯輸出通過將它們替換爲空函數來禁用對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上)。

Debug Protection Interval

調試保護間隔

If checked, an interval is used to force the debug mode on the Console tab, making it harder to use other features of the Developer Tools.如果選中該選項,則會使用一個時間間隔強制在“控制檯”選項卡上啓用調試模式,這使得使用開發人員工具的其他功能更加困難。

How does it works? A special code that calls debugger; repeatedly is inserted throughout the obfuscated source code.如何運作?調用調試器的特殊代碼;重複地被插入到混淆的源代碼中。

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, to make it work on any sub-domain from example.com, use .example.com.

可以將代碼鎖定到多個域或子域。例如,要對其進行鎖定以使代碼僅在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, the obfuscator will ensure that all variables, function names and function arguments that starts with someName will not get mangled.

例如,如果添加^ someName,混淆器將確保不會破壞以someName開頭的所有變量,函數名稱和函數參數。

Reserved Strings

保留字串

Disables transformation of string literals, which being matched by passed RegExp patterns.

禁用字符串文字的轉換,該文字與通過的RegExp模式匹配。

For instance, if you add ^some *string, the obfuscator will ensure that all strings that starts with some string will not get moved to the `stringArray`.

例如,如果添加^ 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 sourceMappingURL property that will get appended to the end of your obfuscated code.

使用Source Map Base URL和Source Map File Name來定製sourceMappingURL屬性,該屬性將附加到混淆代碼的末尾。

For instance, if you set the Base URL to "http://localhost:9000" and File Name to "example", you'll get: //# sourceMappingURL=http://localhost:9000/example.js.map. appended to the end of your obfuscated code.

例如,如果將基本URL設置爲“ http:// localhost:9000”,文件名設置爲“ example”,則將得到://#sourceMappingURL = http:// localhost:9000 / example.js.map 。附加到混淆代碼的末尾。

Seed

種子

By default (seed = 0), each time you obfuscate your code you'll get a new result (i.e: different variable names, different variables inserted into the stringArray, etc). If you want repeatable results, set the seed to a specific integer.

默認情況下(seed = 0),每次混淆代碼時,您都會得到一個新結果(即:不同的變量名,插入stringArray中的變量不同,等等)。 如果要獲得可重複的結果,請將種子設置爲特定的整數。

Target

目標

You can set the target environment of the obfuscated code to one of the following:您可以將混淆代碼的目標環境設置爲以下之一:

  • Browser
  • Browser No Eval
  • Node

Currently the output of browser and node is identical.當前,瀏覽器和節點的輸出是相同的。

網站功能區截圖:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章