Skip to content

Commit 22017e0

Browse files
committed
feat: ECH开启时Clash使用本地模板生成,节点格式完全匹配模板
1 parent 15cc6ce commit 22017e0

File tree

4 files changed

+8962
-33
lines changed

4 files changed

+8962
-33
lines changed

obfuscate.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const JavaScriptObfuscator = require('javascript-obfuscator');
2+
const fs = require('fs');
3+
const path = require('path');
4+
5+
const sourceFileName = '明文源吗';
6+
const outputFileName = '少年你相信光吗';
7+
const sourceFilePath = path.join(process.cwd(), sourceFileName);
8+
9+
if (!fs.existsSync(sourceFilePath)) {
10+
console.error('错误:在路径 \'' + sourceFilePath + '\' 未找到源文件。请确保您的仓库根目录有名为 \'明文源吗\' 的文件。');
11+
process.exit(1);
12+
}
13+
14+
const originalCode = fs.readFileSync(sourceFilePath, 'utf8');
15+
16+
if (!originalCode || originalCode.trim().length === 0) {
17+
console.error('错误:源文件 ' + sourceFileName + ' 为空。');
18+
process.exit(1);
19+
}
20+
21+
const obfuscationOptions = {
22+
compact: true,
23+
controlFlowFlattening: false,
24+
controlFlowFlatteningThreshold: 0,
25+
deadCodeInjection: false,
26+
stringArray: true,
27+
stringArrayEncoding: ['base64'],
28+
stringArrayThreshold: 1.0,
29+
stringArrayRotate: true,
30+
stringArrayShuffle: true,
31+
stringArrayWrappersCount: 2,
32+
stringArrayWrappersChainedCalls: false,
33+
stringArrayWrappersParametersMaxCount: 3,
34+
renameGlobals: true,
35+
identifierNamesGenerator: 'mangled-shuffled',
36+
identifierNamesCache: null,
37+
identifiersPrefix: '',
38+
renameProperties: false,
39+
renamePropertiesMode: 'safe',
40+
ignoreImports: false,
41+
target: 'browser',
42+
numbersToExpressions: false,
43+
simplify: false,
44+
splitStrings: true,
45+
splitStringsChunkLength: 1,
46+
transformObjectKeys: false,
47+
unicodeEscapeSequence: true,
48+
selfDefending: false,
49+
debugProtection: false,
50+
debugProtectionInterval: 0,
51+
disableConsoleOutput: true,
52+
domainLock: []
53+
};
54+
55+
const obfuscatedCode = JavaScriptObfuscator.obfuscate(originalCode, obfuscationOptions).getObfuscatedCode();
56+
57+
fs.writeFileSync(path.join(process.cwd(), outputFileName), obfuscatedCode, 'utf8');
58+
console.log('成功将 \'' + sourceFileName + '\' 混淆并保存至 \'' + outputFileName + '\'。');

少年你相信光吗

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)