Skip to content

Commit

Permalink
obf
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu committed Nov 24, 2024
1 parent 73df5c4 commit 6830845
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
28 changes: 24 additions & 4 deletions .github/workflows/obfuscator.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Obfuscate and Commit

on:
push:
branches: [beta]
workflow_dispatch:
push:
paths:
- '_worker.src.js'
workflow_dispatch:

jobs:
obfuscate:
Expand All @@ -24,9 +25,22 @@ jobs:
- name: Install dependencies
run: npm install -g javascript-obfuscator

- name: Prepare files for obfuscation
run: |
if grep -q "Obfuscate-cmliu" _worker.src.js; then
echo "检测到 Obfuscate 准备分段处理"
line_number=$(awk '/Obfuscate-cmliu/ {print NR; exit}' _worker.src.js)
echo "Obfuscate 分段处理行号为: $line_number"
head -n $line_number _worker.src.js > src.js
tail -n +$((line_number + 1)) _worker.src.js > obf.js
else
echo "未检测到 Obfuscate 执行全文件混淆"
cp _worker.src.js obf.js
fi
- name: Obfuscate code
run: |
javascript-obfuscator _worker.src.js --output _worker.js \
javascript-obfuscator obf.js --output _worker.js \
--compact true \
--control-flow-flattening true \
--control-flow-flattening-threshold 1 \
Expand All @@ -37,6 +51,12 @@ jobs:
--string-array-threshold 1 \
--transform-object-keys true \
--unicode-escape-sequence true
- name: Concatenate src.js if exists
run: |
if [ -f src.js ]; then
cat src.js _worker.js > temp && mv temp _worker.js
fi
- name: Commit changes
run: |
Expand Down
1 change: 1 addition & 0 deletions _worker.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ let effectiveTime = 7;//有效时间 单位:天
let updateTime = 3;//更新时间
let userIDLow;
let userIDTime = "";
/*Obfuscate-cmliu*/
if (!isValidUUID(userID)) {
throw new Error('uuid is not valid');
}
Expand Down

0 comments on commit 6830845

Please sign in to comment.