只能看到加固后的映射文件: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-obfuscator:https://obfuscator.io/
还有加固代码后的反查流程是加固后必定报错还是说只是用来找错误的
是我使用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