Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
cmliu committed Dec 5, 2024
1 parent 3731380 commit 63aff66
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 19 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/混淆.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: 混淆 _worker.js 文件

on:
#push:
#paths:
#- '_worker.js'
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 grep -q "Obfuscate-cmliu" _worker.js; then
echo "检测到 Obfuscate 准备分段处理"
line_number=$(awk '/Obfuscate-cmliu/ {print NR; exit}' _worker.js)
echo "Obfuscate 分段处理行号为: $line_number"
head -n $line_number _worker.js > src.js
tail -n +$((line_number + 1)) _worker.js > index.js
rm _worker.js
else
echo "未检测到 Obfuscate 执行全文件混淆"
mv _worker.js index.js
fi
- name: 混淆代码
run: |
javascript-obfuscator index.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
git commit -m "Obfuscate _worker.js" || echo "No changes to commit"
- name: 推送更改到 main 分支
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git fetch origin
git checkout main
git merge --no-ff ${{ github.sha }}
git push origin main
60 changes: 41 additions & 19 deletions _worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ let addressesapi = [];
let addressesnotls = [];
let addressesnotlsapi = [];

let DLS = 7;
let addressescsv = [];
let DLS = 7;
let remarkIndex = 1;//CSV备注所在列偏移量

let subconverter = 'SUBAPI.fxxk.dedyn.io';
let subconfig = atob('aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL2NtbGl1L0FDTDRTU1IvbWFpbi9DbGFzaC9jb25maWcvQUNMNFNTUl9PbmxpbmVfRnVsbF9NdWx0aU1vZGUuaW5p');
Expand Down Expand Up @@ -39,7 +40,7 @@ let updateTime = 3;
let MamaJustKilledAMan = ['telegram','twitter','miaoko'];
let proxyIPPool = [];
let socks5Data;

/*Obfuscate-cmliu*/
async function 整理优选列表(api) {
if (!api || api.length === 0) return [];

Expand Down Expand Up @@ -71,24 +72,44 @@ async function 整理优选列表(api) {
// 获取响应的内容
const content = await response.value;

// 验证当前apiUrl是否带有'proxyip=true'
if (api[index].includes('proxyip=true')) {
// 如果URL带有'proxyip=true',则将内容添加到proxyIPPool
proxyIPPool = proxyIPPool.concat((await 整理(content)).map(item => {
const baseItem = item.split('#')[0] || item;
if (baseItem.includes(':')) {
const port = baseItem.split(':')[1];
if (!httpsPorts.includes(port)) {
return baseItem;
}
} else {
return `${baseItem}:443`;
const lines = content.split(/\r?\n/);
let 节点备注 = '';
let 测速端口 = '443';

if (lines[0].split(',').length > 3){
const idMatch = api[index].match(/id=([^&]*)/);
if (idMatch) 节点备注 = idMatch[1];

const portMatch = api[index].match(/port=([^&]*)/);
if (portMatch) 测速端口 = portMatch[1];

for (let i = 1; i < lines.length; i++) {
const columns = lines[i].split(',')[0];
if(columns){
newapi += `${columns}:${测速端口}${节点备注 ? `#${节点备注}` : ''}\n`;
if (api[index].includes('proxyip=true')) proxyIPPool.push(`${columns}:${测速端口}`);
}
return null; // 不符合条件时返回 null
}).filter(Boolean)); // 过滤掉 null 值
}
} else {
// 验证当前apiUrl是否带有'proxyip=true'
if (api[index].includes('proxyip=true')) {
// 如果URL带有'proxyip=true',则将内容添加到proxyIPPool
proxyIPPool = proxyIPPool.concat((await 整理(content)).map(item => {
const baseItem = item.split('#')[0] || item;
if (baseItem.includes(':')) {
const port = baseItem.split(':')[1];
if (!httpsPorts.includes(port)) {
return baseItem;
}
} else {
return `${baseItem}:443`;
}
return null; // 不符合条件时返回 null
}).filter(Boolean)); // 过滤掉 null 值
}
// 将内容添加到newapi中
newapi += content + '\n';
}
// 将内容添加到newapi中
newapi += content + '\n';
}
}
} catch (error) {
Expand Down Expand Up @@ -156,7 +177,7 @@ async function 整理测速结果(tls) {
.map(row => {
const ipAddress = row[0];
const port = row[1];
const dataCenter = row[tlsIndex + 1];
const dataCenter = row[tlsIndex + remarkIndex];
const formattedAddress = `${ipAddress}:${port}#${dataCenter}`;

// 处理代理IP池
Expand Down Expand Up @@ -476,6 +497,7 @@ export default {
if (env.ADDNOTLSAPI) addressesnotlsapi = await 整理(env.ADDNOTLSAPI);
if (env.ADDCSV) addressescsv = await 整理(env.ADDCSV);
DLS = env.DLS || DLS;
remarkIndex = env.CSVREMARK || remarkIndex;

if (socks5DataURL) {
try {
Expand Down

0 comments on commit 63aff66

Please sign in to comment.