A powerful HTML and JavaScript obfuscator tool built with Bun runtime. Supports advanced code obfuscation, HTML minification, and external JavaScript file processing.
强大的基于 Bun 运行时的 HTML 和 JavaScript 混淆工具。支持高级代码混淆、HTML 压缩以及外部 JavaScript 文件处理。
- 🚀 High Performance: Built with Bun runtime for lightning-fast processing
- 🛡️ Advanced Obfuscation: Multiple layers of code protection including control flow flattening, dead code injection, and string array encoding
- 📄 HTML Support: Process HTML files with inline and external JavaScript
- 🔧 Flexible Configuration: Extensive obfuscation options for different protection levels
- 🎯 CLI Tool: Easy-to-use command-line interface
- 📦 Global Installation: Install globally for system-wide usage
- 🚀 高性能:基于 Bun 运行时,处理速度极快
- 🛡️ 高级混淆:多层代码保护,包括控制流扁平化、死代码注入和字符串数组编码
- 📄 HTML 支持:处理包含内联和外部 JavaScript 的 HTML 文件
- 🔧 灵活配置:丰富的混淆选项,适用于不同保护级别
- 🎯 CLI 工具:易用的命令行界面
- 📦 全局安装:支持全局安装,系统级使用
npm install -g code-obfuscatornpm install code-obfuscator
# or
bun add code-obfuscatorgit clone https://github.com/openapphub/code-obfuscator.git
cd code-obfuscator
bun installcode-obfuscator --input <input-file> --output <output-file>
# Examples
code-obfuscator --input index.html --output obfuscated.html
code-obfuscator --input script.js --output obfuscated.js
code-obfuscator --input ./src/app.html --output ./dist/app.html| Option | Short | Description | Required |
|---|---|---|---|
--input |
-i |
Input HTML or JS file path | Yes |
--output |
-o |
Output file path | Yes |
--help |
-h |
Show help information | No |
--version |
Show version number | No |
code-obfuscator --input index.html --output dist/index.htmlcode-obfuscator --input app.js --output dist/app.js# Process multiple files
for file in *.html; do
code-obfuscator --input "$file" --output "dist/$file"
doneThe tool uses JavaScript Obfuscator with the following protection features:
- ✅ 压缩 (Compaction): Remove unnecessary whitespace and comments
- ✅ 控制流扁平化 (Control Flow Flattening): Transform code structure
- ✅ 死代码注入 (Dead Code Injection): Add meaningless code to confuse analysis
- ✅ 字符串数组 (String Array): Encode strings in arrays with transformations
- ✅ 标识符重命名 (Identifier Renaming): Use hexadecimal names
- ✅ 数字表达式 (Numbers to Expressions): Convert numbers to expressions
- ✅ 字符串分割 (String Splitting): Split strings into chunks
- ✅ 自我保护 (Self-Defending): Prevent code beautification
- ✅ 控制台禁用 (Console Output Disabled): Remove console statements
- ✅ 内联 JavaScript 混淆: Obfuscate
<script>tags without src - ✅ 外部 JavaScript 处理: Process external JS files referenced in HTML
- ✅ HTML 压缩: Minify HTML structure
- ✅ 路径保持: Maintain relative paths for external resources
your-project/
├── index.html # Original HTML file
├── js/
│ ├── app.js # Original JS file
│ └── utils.js # Original JS file
└── dist/ # Output directory
├── index.html # Obfuscated HTML
└── js/
├── app.js # Obfuscated JS
└── utils.js # Obfuscated JS
The obfuscator uses optimized default settings, but you can modify obfuscator.ts for custom configurations:
const jsObfuscatorOptions = {
compact: true,
controlFlowFlattening: true,
deadCodeInjection: true,
stringArray: true,
// ... other options
};Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
jinxiaoman
- GitHub: @openapphub
- NPM: jinxiaoman
- Bun - The blazing fast JavaScript runtime
- JavaScript Obfuscator - The core obfuscation library
- Cheerio - Fast, flexible, and lean implementation of core jQuery designed for the server
Made with ❤️ using Bun