当前位置: 首页 > news >正文

javascript-obfuscator混淆

安装

npm install javascript-obfuscator -g

配置

重度混淆,性能低

性能下降50-100%

{  "compact": true,  "controlFlowFlattening": true,  "controlFlowFlatteningThreshold": 0.75, // 设置为0到1之间的值  "deadCodeInjection": true,  "deadCodeInjectionThreshold": 0.4, // 设置为0到1之间的值  "debugProtection": true,  "debugProtectionInterval": 1000, // 设置为一个正整数,表示毫秒数  "disableConsoleOutput": true,  "identifierNamesGenerator": "hexadecimal",  "log": false,  "numbersToExpressions": true,  "renameGlobals": false,  "rotateStringArray": true,  "selfDefending": true,  "shuffleStringArray": true,  "simplify": true,  "splitStrings": true,  "splitStringsChunkLength": 5,  "stringArray": true,  "stringArrayEncoding": ["rc4"], // 确保编码类型是有效的  "stringArrayIndexShift": true,  "stringArrayWrappersCount": 5,  "stringArrayWrappersChainedCalls": true,  "stringArrayWrappersParametersMaxCount": 5,  "stringArrayWrappersType": "function",  "stringArrayThreshold": 0.75, // 设置为0到1之间的值  "transformObjectKeys": true,  "unicodeEscapeSequence": false  
}

中度压缩,最佳性能

性能下降30-35%

{  "compact": true,  "controlFlowFlattening": true,  "controlFlowFlatteningThreshold": 0.75,  "deadCodeInjection": true,  "deadCodeInjectionThreshold": 0.4,  "debugProtection": false,  "disableConsoleOutput": true,  "identifierNamesGenerator": "hexadecimal",  "log": false,  "numbersToExpressions": true,  "renameGlobals": false,  "rotateStringArray": true,  "selfDefending": true,  "shuffleStringArray": true,  "simplify": true,  "splitStrings": true,  "splitStringsChunkLength": 10,  "stringArray": true,  "stringArrayEncoding": ["base64"],  "stringArrayIndexShift": true,  "stringArrayWrappersCount": 2,  "stringArrayWrappersChainedCalls": true,  "stringArrayWrappersParametersMaxCount": 4,  "stringArrayWrappersType": "function",  "stringArrayThreshold": 0.75,  "transformObjectKeys": true,  "unicodeEscapeSequence": false  
}

轻度压缩,高性能

性能略低于压缩之前

{  "compact": true,  "controlFlowFlattening": false,  "deadCodeInjection": false,  "debugProtection": false,  "disableConsoleOutput": true,  "identifierNamesGenerator": "hexadecimal",  "log": false,  "numbersToExpressions": false,  "renameGlobals": false,  "rotateStringArray": true,  "selfDefending": true,  "shuffleStringArray": true,  "simplify": true,  "splitStrings": false,  "stringArray": true,  "stringArrayEncoding": [], // 你可以根据需要添加支持的编码算法,如 ["base64", "rc4"]  "stringArrayIndexShift": true,  "stringArrayWrappersCount": 1,  "stringArrayWrappersChainedCalls": true,  "stringArrayWrappersParametersMaxCount": 2,  "stringArrayWrappersType": "variable",  "stringArrayThreshold": 0.75,  "unicodeEscapeSequence": false  
}

默认值,高性能

{  "compact": true,  "controlFlowFlattening": false,  "deadCodeInjection": false,  "debugProtection": false,  "disableConsoleOutput": false,  "identifierNamesGenerator": "hexadecimal",  "log": false,  "numbersToExpressions": false,  "renameGlobals": false,  "rotateStringArray": true,  "selfDefending": false,  "shuffleStringArray": true,  "simplify": true,  "splitStrings": false,  "stringArray": true,  "stringArrayEncoding": [],  "stringArrayIndexShift": true,  "stringArrayWrappersCount": 1,  "stringArrayWrappersChainedCalls": true,  "stringArrayWrappersParametersMaxCount": 2,  "stringArrayWrappersType": "variable",  "stringArrayThreshold": 0.75,  "unicodeEscapeSequence": false  
}

执行

混淆整个目录里的js

javascript-obfuscator ./js --output ./js/obfuscated --config obfuscator.json

混淆单个js

javascript-obfuscator index.af5ba3a0.js --output index.af5ba3a011111.js --config obfuscator.json

http://www.lryc.cn/news/374801.html

相关文章:

  • GitHub项目里的api
  • k8s可练习实验分享
  • 浏览器支持http-flv协议
  • 一千题,No.0077(计算谱半径)
  • 安卓/iOS/Linux系统影音边下边播P2P传输解决方案
  • STORM论文阅读笔记
  • Web前端遇到的难题:挑战与突破之路
  • C#防止多次注册事件
  • 【UML用户指南】-16-对高级结构建模-构件
  • 双Token方案实现Token自动续期(基于springboot+vue前后端分离项目)
  • 别太小看“静态免杀“
  • SQL server 内连接 左连接 右连接 全连接 语句
  • k8s中的pod域名解析失败定位案例
  • jingxiang制作
  • 【数据结构】线性表之《顺序表》超详细实现
  • 开源模型应用落地-音乐生成模型-suno/bark深度使用-AIGC应用探索(六)
  • 为何选择Xinstall?告别邀请码,让App推广更便捷!
  • JavaScript基础入门
  • windows11子系统Ubuntu 22.04.4子安装图形化界面
  • 对 2024 年美赛选题的建议
  • PyTorch tutorials:快速学会使用PyTorch
  • 【CT】LeetCode手撕—手撕快排
  • 使用ARK工具ATool清除典型蠕虫MyDoom
  • 在hue中使用ooize调度ssh任务无法执行成功,无法查看错误
  • 一套轻量、安全的问卷系统基座,提供面向个人和企业的一站式产品级解决方案
  • 3秒生成!这个AI模型画风也太治愈了,新手也能轻松驾驭
  • 数字人全拆解:如何构建一个基于大模型的实时对话3D数字人?
  • 实战 | 基于YOLOv10的车辆追踪与测速实战【附源码+步骤详解】
  • 2024北京智源大会
  • youlai-boot项目的学习—本地数据库安装与配置