javascript-obfuscator 代码混淆

转自:https://www.againfly.com/flytag_605.html
参考:https://blog.csdn.net/foupwang/article/details/103306332

官网:
https://www.npmjs.com/package/javascript-obfuscator

民间安装方式

npm init -f
npm install formidable --save
npm install -g javascript-obfuscator

官网安装方式

npm install --save-dev javascript-obfuscator

默认不用参数的加密直接执行也可以

javascript-obfuscator input.js --output output.js

使用部分自定义参数

--target 'browser-no-eval'
--disable-console-output true
--debug-protection true
--debug-protection-interval true
--identifier-names-generator 'hexadecimal'
--string-array true
--rotate-string-array true
--string-array-encoding 'rc4'
--string-array-threshold 0.8

更多的详细配置参数可以看官网

javascript-obfuscator 1.js --output 2.js --compact true --target 'browser-no-eval' --disable-console-output true --debug-protection true --debug-protection-interval true --identifier-names-generator 'hexadecimal' --string-array true --rotate-string-array true --string-array-encoding 'rc4' --string-array-threshold 0.8

官方推荐的三种配置

1.性能将比没有混淆的情况下慢50-100%
{
    compact: true,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 1,
    deadCodeInjection: true,
    deadCodeInjectionThreshold: 1,
    debugProtection: true,
    debugProtectionInterval: true,
    disableConsoleOutput: true,
    identifierNamesGenerator: 'hexadecimal',
    log: false,
    renameGlobals: false,
    rotateStringArray: true,
    selfDefending: true,
    stringArray: true,
    stringArrayEncoding: 'rc4',
    stringArrayThreshold: 1,
    transformObjectKeys: true,
    unicodeEscapeSequence: false
}
2.性能将比没有混淆的情况下降低30-35%
{
    compact: true,
    controlFlowFlattening: true,
    controlFlowFlatteningThreshold: 0.75,
    deadCodeInjection: true,
    deadCodeInjectionThreshold: 0.4,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: true,
    identifierNamesGenerator: 'hexadecimal',
    log: false,
    renameGlobals: false,
    rotateStringArray: true,
    selfDefending: true,
    stringArray: true,
    stringArrayEncoding: 'base64',
    stringArrayThreshold: 0.75,
    transformObjectKeys: true,
    unicodeEscapeSequence: false
}
3.性能会比没有混淆的情况稍微慢一些
{
    compact: true,
    controlFlowFlattening: false,
    deadCodeInjection: false,
    debugProtection: false,
    debugProtectionInterval: false,
    disableConsoleOutput: true,
    identifierNamesGenerator: 'hexadecimal',
    log: false,
    renameGlobals: false,
    rotateStringArray: true,
    selfDefending: true,
    stringArray: true,
    stringArrayEncoding: false,
    stringArrayThreshold: 0.75,
    unicodeEscapeSequence: false
}
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值