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 ea617e6 commit 3497856
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 5 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/obfuscator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Obfuscate and Commit

on:
push:
paths:
- '_worker.src.js'
workflow_dispatch:

jobs:
obfuscate:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16"

- 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 obf.js --output _worker.js \
--compact true \
--control-flow-flattening true \
--control-flow-flattening-threshold 1 \
--dead-code-injection true \
--dead-code-injection-threshold 1 \
--string-array true \
--string-array-encoding 'rc4' \
--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: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add _worker.js
git commit -m "Obfuscate _worker.js" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ Telegram交流群:[@CMLiussss](https://t.me/CMLiussss),**感谢[Alice Networ
- clash.meta([FlClash](https://github.com/chen08209/FlClash))

# 感谢
[ca110us](https://github.com/ca110us/epeius)、[xream](https://github.com/xream)、[3Kmfi6HP](https://github.com/3Kmfi6HP/EDtunnel/tree/trojan)、[zizifn](https://github.com/zizifn/edgetunnel)、[emn178](https://github.com/emn178/js-sha256)、[ACL4SSR](https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash/config)、[SHIJS1999](https://github.com/SHIJS1999/cloudflare-worker-vless-ip)、<a href="https://url.cmliussss.com/alice"><img src="https://alicenetworks.net/templates/lagom2/assets/img/logo/logo_big.194980063.png" width="150" height="75" alt="Alice Networks LTD"/></a>、
[ca110us](https://github.com/ca110us/epeius)、[xream](https://github.com/xream)、[3Kmfi6HP](https://github.com/6Kmfi6HP/EDtunnel)、[zizifn](https://github.com/zizifn/edgetunnel)、[emn178](https://github.com/emn178/js-sha256)、[ACL4SSR](https://github.com/ACL4SSR/ACL4SSR/tree/master/Clash/config)、[SHIJS1999](https://github.com/SHIJS1999/cloudflare-worker-vless-ip)、<a href="https://url.cmliussss.com/alice"><img src="https://alicenetworks.net/templates/lagom2/assets/img/logo/logo_big.194980063.png" width="150" height="75" alt="Alice Networks LTD"/></a>、
8 changes: 4 additions & 4 deletions _worker.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ let sha224Password ;
const expire = 4102329600;//2099-12-31
const regex = /^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[.*\]):?(\d+)?#?(.*)?$/;

let parsedSocks5Address = {};
let enableSocks = false;
let httpsPorts = ["2053","2083","2087","2096","8443"];
/*Obfuscate-cmliu*/
/*
if (!isValidSHA224(sha224Password)) {
throw new Error('sha224Password is not valid');
}
*/

let parsedSocks5Address = {};
let enableSocks = false;
let httpsPorts = ["2053","2083","2087","2096","8443"];
export default {
async fetch(request, env, ctx) {
try {
Expand Down

0 comments on commit 3497856

Please sign in to comment.