【CC3 插件 WEO】: 混淆代码勾勾、选选就完事!!

CC3.WebEasyObfus

Static Badge Static Badge Static Badge

store_banner

勾勾、选选就完事,WebEasyObfus 混淆項目代码就这样简单。

「走過路過,別錯過,點顆星星,支持我!」

安装方法

  1. 下载项目成 ZIP 文件。

  2. 解压后将内容复制到 ${your_project_path}/extensions/web-easy-obfus

  3. 打开终端

    • 输入 cd ${your_project_path}/extensions/web-zip-bundle

      • 安装扩展依赖包 npm install

      • 构建扩展 npm run build

  4. 到 Editor 菜单 Extension -> Extension Manager -> Installed 启用 web-easy-obfus

如何使用

  1. 到 Build Setting 新增 New Build Task 并选择平台 WebMobile/WebDesktop。到 Panel 中下拉找到 web-easy-obfus 选项。

    • Enable:启用或关闭功能。

      • 启用后,会对建置项目资料夹中 ${your_project_path}/build/web-mobile/assets/main/index.js 进行混淆。
    • Select Obfus Level:混淆分为五个等级,等级越高,混淆程度越彻底,但文件体积会增大,执行性能可能略受影响。

      • 基础 (Minimal),對 javascript-obfuscator 設定分別為:

        {
            // Minifies the output code to reduce file size.
            "compact": true, 
            // Disables converting code into a more complex control flow structure.
            "controlFlowFlattening": false,
            // Disables adding redundant dead code blocks. 
            "deadCodeInjection": false,
            // Keeps global variable names unchanged. 
            "renameGlobals": false,
            // Avoids extracting strings into a separate array for simplicity. 
            "stringArray": false 
        }
        
      • 标准 (Standard),對 javascript-obfuscator 設定分別為:

        {
            // Minifies the output code to reduce file size.
            "compact": true, 
            // Enables control flow flattening for added complexity.
            "controlFlowFlattening": true, 
            // Applies control flow flattening to 75% of the code.
            "controlFlowFlatteningThreshold": 0.75, 
            // Avoids injecting unnecessary dead code.
            "deadCodeInjection": false, 
            // Moves strings into a separate array for obfuscation.
            "stringArray": true, 
            // Applies string array obfuscation to 75% of strings.
            "stringArrayThreshold": 0.75 
        }
        
      • 增强 (Enhanced),對 javascript-obfuscator 設定分別為:

        {
            // Minifies the output code to reduce file size.
            "compact": true, 
            // Enables control flow flattening for added complexity.
            "controlFlowFlattening": true,
            // Applies control flow flattening to 90% of the code.
            "controlFlowFlatteningThreshold": 0.9,
            // Adds dead code to make reverse engineering harder.
            "deadCodeInjection": true,
            // Inserts dead code in 40% of places.
            "deadCodeInjectionThreshold": 0.4,
            // Keeps global variable names unchanged for compatibility.
            "renameGlobals": false, 
            // Moves strings into a separate array for obfuscation.
            "stringArray": true,
            // Encodes strings in the array using Base64.
            "stringArrayEncoding": ["base64"],
            // Applies string array obfuscation to 90% of strings.
            "stringArrayThreshold": 0.9,
            // Obfuscates object keys for added security.
            "transformObjectKeys": true 
        }
        
      • 安全 (Secure),對 javascript-obfuscator 設定分別為:

        {
            // Minifies the output code to reduce file size.
            "compact": true, 
            // Enables control flow flattening for added complexity.
            "controlFlowFlattening": true, 
            // Applies control flow flattening to all code.
            "controlFlowFlatteningThreshold": 1,
            // Adds dead code to make reverse engineering harder. 
            "deadCodeInjection": true, 
            // Inserts dead code in 50% of places.
            "deadCodeInjectionThreshold": 0.5, 
            // Renames global variables for better obfuscation.
            "renameGlobals": true,
            // Moves strings into a separate array for obfuscation. 
            "stringArray": true, 
            // Encodes strings in the array using RC4 encryption.
            "stringArrayEncoding": ["rc4"],
            // Applies string array obfuscation to all strings. 
            "stringArrayThreshold": 1, 
            // Obfuscates object keys for added security.
            "transformObjectKeys": true 
        }
        
      • 极致 (Ultimate),對 javascript-obfuscator 設定分別為:

        {
            // Minifies the output code to reduce file size.
            "compact": true, 
            // Enables control flow flattening for added complexity.
            "controlFlowFlattening": true, 
            // Applies control flow flattening to all code.
            "controlFlowFlatteningThreshold": 1, 
            // Adds dead code to make reverse engineering harder.
            "deadCodeInjection": true, 
            // Inserts dead code in all possible places.
            "deadCodeInjectionThreshold": 1, 
            // Renames global variables for better obfuscation.
            "renameGlobals": true,
            // Moves strings into a separate array for obfuscation. 
            "stringArray": true, 
            // Encodes strings using both Base64 and RC4 encryption.
            "stringArrayEncoding": ["base64", "rc4"], 
            // Applies string array obfuscation to all strings.
            "stringArrayThreshold": 1, 
            // Obfuscates object keys for added security.
            "transformObjectKeys": true, 
            // Converts characters to Unicode escape sequences for obfuscation.
            "unicodeEscapeSequence": true,
            // Replaces console output calls with empty functions to hide debugging messages. 
            "disableConsoleOutput": true 
        }
        

CI/CD

本插件天然支持 CI/CD,只需從 Build Panel 导出当前平台的构建选项配置为 json 文件,用于命令行构建

build_panel_export

作者相關

参考文献

16赞

好东西 ~ :+1: :+1: :+1:

1赞

感謝,能幫得上忙最重要

感谢大佬。不知道那是不是小游戏平台和原生平台是不是其实也有可能使用? :see_no_evil:

1赞

谢大佬赐教 这很有用!

1赞

hhhh,把价格打下来了 :+1:

1赞

我目前的項目只有h5,原生有空再看怎搞

大佬微信小游戏可以用吗?

1赞

沒試過耶! 沒有開發微信小程序的經驗,還是版上有哪位大佬可以指點一下呢?

h5可以那微信小游戏应该也是可以的,但是没有实践过不能肯定

1赞

v 1.0.1 上線摟!

  1. 修正發布工具錯誤,導致zip無法被 Cocos Creator 讀取解壓。

  2. 修正商店無法直接匯入項目的問題。

1赞

大佬NB,大佬可以研究下怎么H5加密图片吗?

1赞

虽然你很强,但是他现在是我的了

好好好,mark!!!

1赞

我看商店裡都有些不錯的解法了,要不…試試看?

更新版本 1.0.2

  1. 編輯器版本需求降至 >= 3.7.1

mark一下,并留下了一个赞

1赞