收藏
回答

关于微信开发者工具的加固代码的功能,想知道加固后的源码却没有地方可以看吗?

只能看到加固后的映射文件:projectmaps,想知道加固后的源码却没有地方可以看,既然是加固,我们开发者肯定想看到加固后对应的效果,特别是代码片段加固前后的对比,还有code_obfuscation_config.json每次都要重新生成,假如我有上百上千文件需要加固呢,尝试过使用javascript-obfuscator混淆代码,但是混淆之后微信开发者工具直接编译失败了。。

这是我的javascript-obfuscator混淆配置:

{

	"compact": true,

	"controlFlowFlattening": false,

	"deadCodeInjection": false,

	"debugProtection": false,

	"debugProtectionInterval": 0,

	"disableConsoleOutput": false,

	"identifierNamesGenerator": "hexadecimal",

	"log": false,

	"numbersToExpressions": false,

	"renameGlobals": false,

	"selfDefending": false,

	"simplify": true,

	"splitStrings": false,

	"stringArray": true,

	"stringArrayCallsTransform": false,

	"stringArrayCallsTransformThreshold": 0.5,

	"stringArrayEncoding": [],

	"stringArrayIndexShift": true,

	"stringArrayRotate": true,

	"stringArrayShuffle": true,

	"stringArrayWrappersCount": 1,

	"stringArrayWrappersChainedCalls": true,

	"stringArrayWrappersParametersMaxCount": 2,

	"stringArrayWrappersType": "variable",

	"stringArrayThreshold": 0.75,

	"unicodeEscapeSequence": false

}

使用的是javascript-obfuscator官方默认的配置

然后这是我的混淆脚本:

cd C:\zjx\dpcloud-wxapp\dpcloud-wxapp\build




robocopy C:\zjx\dpcloud-wxapp\dpcloud-wxapp\unpackage\dist\build\mp-weixin C:\zjx\dpcloud-wxapp\dpcloud-wxapp\unpackage\dist\build\mp-weixin-confound /E /XD projectmaps /XF code_obfuscation_config.json




javascript-obfuscator C:\zjx\dpcloud-wxapp\dpcloud-wxapp\unpackage\dist\build\mp-weixin-confound --config setting.json --output C:\zjx\dpcloud-wxapp\dpcloud-wxapp\unpackage\dist\build\mp-weixin-confound --exclude vendor.js --exclude uview-ui

参考链接:

javascript-obfuscatorhttps://obfuscator.io/

uniapp 一键发行代码并混淆代码:https://blog.csdn.net/weixin_43965251/article/details/127439523?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522C2ED1BC8-9823-4949-B285-9EC2E972BDD3%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=C2ED1BC8-9823-4949-B285-9EC2E972BDD3&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~baidu_landing_v2~default-1-127439523-null-null.142^v100^pc_search_result_base1&utm_term=hbuilder%20%E6%B7%B7%E6%B7%86%E4%BB%A3%E7%A0%81&spm=1018.2226.3001.4187

还有加固代码后的反查流程是加固后必定报错还是说只是用来找错误的


回答关注问题邀请回答
收藏

1 个回答

  • yeah~
    yeah~
    09-26

    是我使用javascript-obfuscator的脚本不对,exclude只能指定一项,要排除多项得配置在setting.json里,同时我知道了是app.js不能混淆

    但是我有另一个不成熟的疑问。我点击上传时,上传的是哪一个mp-weixin?

    setting.json:

    {
    	"exclude": ["uview-ui", "app.js"],
    	"compact": true,
    	"controlFlowFlattening": false,
    	"deadCodeInjection": false,
    	"debugProtection": false,
    	"debugProtectionInterval": 0,
    	"disableConsoleOutput": false,
    	"identifierNamesGenerator": "hexadecimal",
    	"log": false,
    	"numbersToExpressions": false,
    	"renameGlobals": false,
    	"selfDefending": true,
    	"simplify": true,
    	"splitStrings": false,
    	"stringArray": true,
    	"stringArrayCallsTransform": false,
    	"stringArrayCallsTransformThreshold": 0.5,
    	"stringArrayEncoding": ["base64"],
    	"stringArrayIndexShift": true,
    	"stringArrayRotate": true,
    	"stringArrayShuffle": true,
    	"stringArrayWrappersCount": 1,
    	"stringArrayWrappersChainedCalls": true,
    	"stringArrayWrappersParametersMaxCount": 2,
    	"stringArrayWrappersType": "variable",
    	"stringArrayThreshold": 0.75,
    	"unicodeEscapeSequence": false
    }
    

    confound.bat:

    cd C:\zjx\dpcloud-wxapp\dpcloud-wxapp\build
    
    
    javascript-obfuscator C:\zjx\dpcloud-wxapp\dpcloud-wxapp\unpackage\dist\build\mp-weixin --config setting.json --output C:\zjx\dpcloud-wxapp\dpcloud-wxapp\unpackage\dist\build\mp-weixin
    
    
    
    09-26
    有用
    回复
登录 后发表内容