混淆最新版本源码 #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 混淆最新版本源码 | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| obfuscate: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: 使用 Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "16" | |
| - name: 安装依赖 | |
| run: npm install -g javascript-obfuscator | |
| - name: 检查备份文件是否存在 | |
| run: | | |
| if [ ! -f _worker.js.backup ]; then | |
| echo "备份文件 _worker.js.backup 不存在,正在创建..." | |
| cp _worker.js _worker.js.backup | |
| fi | |
| - name: 加载源码 | |
| run: | | |
| curl -o 明文源码.js https://raw.githubusercontent.com/cmliu/edgetunnel/main/_worker.js | |
| - name: 混淆代码 | |
| run: | | |
| javascript-obfuscator 明文源码.js --output _worker.js \ | |
| --compact true \ | |
| --control-flow-flattening true \ | |
| --control-flow-flattening-threshold 1 \ | |
| --dead-code-injection true \ | |
| --dead-code-injection-threshold 1 \ | |
| --identifier-names-generator hexadecimal \ | |
| --rename-globals true \ | |
| --string-array true \ | |
| --string-array-encoding 'rc4' \ | |
| --string-array-threshold 1 \ | |
| --transform-object-keys true \ | |
| --unicode-escape-sequence true | |
| - name: 提交更改 | |
| 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 _worker.js.backup | |
| if git diff --cached --quiet; then | |
| echo "没有文件更改,跳过提交" | |
| else | |
| git commit -m "混淆 _worker.js 文件并备份原文件" | |
| fi | |
| - name: 推送更改 | |
| uses: ad-m/github-push-action@master | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| branch: ${{ github.ref }} |