mirror of https://github.com/6dylan6/jdpro.git
This commit is contained in:
commit
122d60219e
|
@ -0,0 +1,558 @@
|
||||||
|
/*
|
||||||
|
由于 canvas 依赖系统底层需要编译且预编译包在 github releases 上,改用另一个纯 js 解码图片。若想继续使用 canvas 可调用 runWithCanvas 。
|
||||||
|
添加 injectToRequest 用以快速修复需验证的请求。eg: $.get=injectToRequest($.get.bind($))
|
||||||
|
*/
|
||||||
|
const https = require('https');
|
||||||
|
const http = require('http');
|
||||||
|
const stream = require('stream');
|
||||||
|
const zlib = require('zlib');
|
||||||
|
const vm = require('vm');
|
||||||
|
const PNG = require('png-js');
|
||||||
|
const UA = require('./USER_AGENTS.js').USER_AGENT;
|
||||||
|
|
||||||
|
|
||||||
|
Math.avg = function average() {
|
||||||
|
var sum = 0;
|
||||||
|
var len = this.length;
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
sum += this[i];
|
||||||
|
}
|
||||||
|
return sum / len;
|
||||||
|
};
|
||||||
|
|
||||||
|
function sleep(timeout) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, timeout));
|
||||||
|
}
|
||||||
|
|
||||||
|
class PNGDecoder extends PNG {
|
||||||
|
constructor(args) {
|
||||||
|
super(args);
|
||||||
|
this.pixels = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
decodeToPixels() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
try {
|
||||||
|
this.decode((pixels) => {
|
||||||
|
this.pixels = pixels;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.info(e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getImageData(x, y, w, h) {
|
||||||
|
const {pixels} = this;
|
||||||
|
const len = w * h * 4;
|
||||||
|
const startIndex = x * 4 + y * (w * 4);
|
||||||
|
|
||||||
|
return {data: pixels.slice(startIndex, startIndex + len)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const PUZZLE_GAP = 8;
|
||||||
|
const PUZZLE_PAD = 10;
|
||||||
|
|
||||||
|
class PuzzleRecognizer {
|
||||||
|
constructor(bg, patch, y) {
|
||||||
|
// console.log(bg);
|
||||||
|
const imgBg = new PNGDecoder(Buffer.from(bg, 'base64'));
|
||||||
|
const imgPatch = new PNGDecoder(Buffer.from(patch, 'base64'));
|
||||||
|
|
||||||
|
// console.log(imgBg);
|
||||||
|
|
||||||
|
this.bg = imgBg;
|
||||||
|
this.patch = imgPatch;
|
||||||
|
this.rawBg = bg;
|
||||||
|
this.rawPatch = patch;
|
||||||
|
this.y = y;
|
||||||
|
this.w = imgBg.width;
|
||||||
|
this.h = imgBg.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
async run() {
|
||||||
|
try {
|
||||||
|
await this.bg.decodeToPixels();
|
||||||
|
await this.patch.decodeToPixels();
|
||||||
|
|
||||||
|
return this.recognize();
|
||||||
|
} catch (e) {
|
||||||
|
console.info(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
recognize() {
|
||||||
|
const {ctx, w: width, bg} = this;
|
||||||
|
const {width: patchWidth, height: patchHeight} = this.patch;
|
||||||
|
const posY = this.y + PUZZLE_PAD + ((patchHeight - PUZZLE_PAD) / 2) - (PUZZLE_GAP / 2);
|
||||||
|
// const cData = ctx.getImageData(0, a.y + 10 + 20 - 4, 360, 8).data;
|
||||||
|
const cData = bg.getImageData(0, posY, width, PUZZLE_GAP).data;
|
||||||
|
const lumas = [];
|
||||||
|
|
||||||
|
for (let x = 0; x < width; x++) {
|
||||||
|
var sum = 0;
|
||||||
|
|
||||||
|
// y xais
|
||||||
|
for (let y = 0; y < PUZZLE_GAP; y++) {
|
||||||
|
var idx = x * 4 + y * (width * 4);
|
||||||
|
var r = cData[idx];
|
||||||
|
var g = cData[idx + 1];
|
||||||
|
var b = cData[idx + 2];
|
||||||
|
var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
|
||||||
|
sum += luma;
|
||||||
|
}
|
||||||
|
|
||||||
|
lumas.push(sum / PUZZLE_GAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = 2; // minium macroscopic image width (px)
|
||||||
|
const margin = patchWidth - PUZZLE_PAD;
|
||||||
|
const diff = 20; // macroscopic brightness difference
|
||||||
|
const radius = PUZZLE_PAD;
|
||||||
|
for (let i = 0, len = lumas.length - 2 * 4; i < len; i++) {
|
||||||
|
const left = (lumas[i] + lumas[i + 1]) / n;
|
||||||
|
const right = (lumas[i + 2] + lumas[i + 3]) / n;
|
||||||
|
const mi = margin + i;
|
||||||
|
const mLeft = (lumas[mi] + lumas[mi + 1]) / n;
|
||||||
|
const mRigth = (lumas[mi + 2] + lumas[mi + 3]) / n;
|
||||||
|
|
||||||
|
if (left - right > diff && mLeft - mRigth < -diff) {
|
||||||
|
const pieces = lumas.slice(i + 2, margin + i + 2);
|
||||||
|
const median = pieces.sort((x1, x2) => x1 - x2)[20];
|
||||||
|
const avg = Math.avg(pieces);
|
||||||
|
|
||||||
|
// noise reducation
|
||||||
|
if (median > left || median > mRigth) return;
|
||||||
|
if (avg > 100) return;
|
||||||
|
// console.table({left,right,mLeft,mRigth,median});
|
||||||
|
// ctx.fillRect(i+n-radius, 0, 1, 360);
|
||||||
|
// console.log(i+n-radius);
|
||||||
|
return i + n - radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
runWithCanvas() {
|
||||||
|
const {createCanvas, Image} = require('canvas');
|
||||||
|
const canvas = createCanvas();
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
const imgBg = new Image();
|
||||||
|
const imgPatch = new Image();
|
||||||
|
const prefix = 'data:image/png;base64,';
|
||||||
|
|
||||||
|
imgBg.src = prefix + this.rawBg;
|
||||||
|
imgPatch.src = prefix + this.rawPatch;
|
||||||
|
const {naturalWidth: w, naturalHeight: h} = imgBg;
|
||||||
|
canvas.width = w;
|
||||||
|
canvas.height = h;
|
||||||
|
ctx.clearRect(0, 0, w, h);
|
||||||
|
ctx.drawImage(imgBg, 0, 0, w, h);
|
||||||
|
|
||||||
|
const width = w;
|
||||||
|
const {naturalWidth, naturalHeight} = imgPatch;
|
||||||
|
const posY = this.y + PUZZLE_PAD + ((naturalHeight - PUZZLE_PAD) / 2) - (PUZZLE_GAP / 2);
|
||||||
|
// const cData = ctx.getImageData(0, a.y + 10 + 20 - 4, 360, 8).data;
|
||||||
|
const cData = ctx.getImageData(0, posY, width, PUZZLE_GAP).data;
|
||||||
|
const lumas = [];
|
||||||
|
|
||||||
|
for (let x = 0; x < width; x++) {
|
||||||
|
var sum = 0;
|
||||||
|
|
||||||
|
// y xais
|
||||||
|
for (let y = 0; y < PUZZLE_GAP; y++) {
|
||||||
|
var idx = x * 4 + y * (width * 4);
|
||||||
|
var r = cData[idx];
|
||||||
|
var g = cData[idx + 1];
|
||||||
|
var b = cData[idx + 2];
|
||||||
|
var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
|
||||||
|
sum += luma;
|
||||||
|
}
|
||||||
|
|
||||||
|
lumas.push(sum / PUZZLE_GAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = 2; // minium macroscopic image width (px)
|
||||||
|
const margin = naturalWidth - PUZZLE_PAD;
|
||||||
|
const diff = 20; // macroscopic brightness difference
|
||||||
|
const radius = PUZZLE_PAD;
|
||||||
|
for (let i = 0, len = lumas.length - 2 * 4; i < len; i++) {
|
||||||
|
const left = (lumas[i] + lumas[i + 1]) / n;
|
||||||
|
const right = (lumas[i + 2] + lumas[i + 3]) / n;
|
||||||
|
const mi = margin + i;
|
||||||
|
const mLeft = (lumas[mi] + lumas[mi + 1]) / n;
|
||||||
|
const mRigth = (lumas[mi + 2] + lumas[mi + 3]) / n;
|
||||||
|
|
||||||
|
if (left - right > diff && mLeft - mRigth < -diff) {
|
||||||
|
const pieces = lumas.slice(i + 2, margin + i + 2);
|
||||||
|
const median = pieces.sort((x1, x2) => x1 - x2)[20];
|
||||||
|
const avg = Math.avg(pieces);
|
||||||
|
|
||||||
|
// noise reducation
|
||||||
|
if (median > left || median > mRigth) return;
|
||||||
|
if (avg > 100) return;
|
||||||
|
// console.table({left,right,mLeft,mRigth,median});
|
||||||
|
// ctx.fillRect(i+n-radius, 0, 1, 360);
|
||||||
|
// console.log(i+n-radius);
|
||||||
|
return i + n - radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const DATA = {
|
||||||
|
"appId": "17839d5db83",
|
||||||
|
"product": "embed",
|
||||||
|
"lang": "zh_CN",
|
||||||
|
};
|
||||||
|
const SERVER = '61.49.99.122';
|
||||||
|
|
||||||
|
class JDJRValidator {
|
||||||
|
constructor() {
|
||||||
|
this.data = {};
|
||||||
|
this.x = 0;
|
||||||
|
this.t = Date.now();
|
||||||
|
this.trynum = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(scene) {
|
||||||
|
try {
|
||||||
|
if (this.trynum > 5) return '';
|
||||||
|
const tryRecognize = async () => {
|
||||||
|
const x = await this.recognize(scene);
|
||||||
|
|
||||||
|
if (x > 0) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
// retry
|
||||||
|
return 124;
|
||||||
|
};
|
||||||
|
const puzzleX = await tryRecognize();
|
||||||
|
// console.log(puzzleX);
|
||||||
|
const pos = new MousePosFaker(puzzleX).run();
|
||||||
|
const d = getCoordinate(pos);
|
||||||
|
|
||||||
|
// console.log(pos[pos.length-1][2] -Date.now());
|
||||||
|
// await sleep(4500);
|
||||||
|
//console.log(pos[pos.length - 1][2] - Date.now());
|
||||||
|
await sleep(pos[pos.length - 1][2] - Date.now());
|
||||||
|
const result = await JDJRValidator.jsonp('/slide/s.html', {d, ...this.data}, scene);
|
||||||
|
|
||||||
|
if (result.message === 'success') {
|
||||||
|
// console.log(result);
|
||||||
|
console.log('JDJR验证用时: %fs', (Date.now() - this.t) / 1000);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
console.count("验证失败");
|
||||||
|
this.trynum++
|
||||||
|
// console.count(JSON.stringify(result));
|
||||||
|
await sleep(300);
|
||||||
|
return await this.run(scene);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.info(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async recognize(scene) {
|
||||||
|
try {
|
||||||
|
const data = await JDJRValidator.jsonp('/slide/g.html', {e: ''}, scene);
|
||||||
|
const {bg, patch, y} = data;
|
||||||
|
if (bg.length < 10000) return;
|
||||||
|
// const uri = 'data:image/png;base64,';
|
||||||
|
// const re = new PuzzleRecognizer(uri+bg, uri+patch, y);
|
||||||
|
const re = new PuzzleRecognizer(bg, patch, y);
|
||||||
|
const puzzleX = await re.run();
|
||||||
|
|
||||||
|
if (puzzleX > 0) {
|
||||||
|
this.data = {
|
||||||
|
c: data.challenge,
|
||||||
|
w: re.w,
|
||||||
|
e: '',
|
||||||
|
s: '',
|
||||||
|
o: '',
|
||||||
|
};
|
||||||
|
this.x = puzzleX;
|
||||||
|
}
|
||||||
|
return puzzleX;
|
||||||
|
} catch (e) {
|
||||||
|
console.info(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async report(n) {
|
||||||
|
console.time('PuzzleRecognizer');
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const x = await this.recognize();
|
||||||
|
|
||||||
|
if (x > 0) count++;
|
||||||
|
if (i % 50 === 0) {
|
||||||
|
// console.log('%f\%', (i / n) * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('验证成功: %f\%', (count / n) * 100);
|
||||||
|
console.timeEnd('PuzzleRecognizer');
|
||||||
|
}
|
||||||
|
|
||||||
|
static jsonp(api, data = {}, scene) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const fnId = `jsonp_${String(Math.random()).replace('.', '')}`;
|
||||||
|
const extraData = {callback: fnId};
|
||||||
|
const query = new URLSearchParams({...DATA, ...{"scene": scene}, ...extraData, ...data}).toString();
|
||||||
|
const url = `http://${SERVER}${api}?${query}`;
|
||||||
|
const headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Encoding': 'gzip,deflate,br',
|
||||||
|
'Accept-Language': 'zh-CN,en-US',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Host': SERVER,
|
||||||
|
'Proxy-Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/2wuqXrZrhygTQzYA7VufBEpj4amH/index.html',
|
||||||
|
'User-Agent': UA,
|
||||||
|
};
|
||||||
|
const req = http.get(url, {headers}, (response) => {
|
||||||
|
let res = response;
|
||||||
|
if (res.headers['content-encoding'] === 'gzip') {
|
||||||
|
const unzipStream = new stream.PassThrough();
|
||||||
|
stream.pipeline(
|
||||||
|
response,
|
||||||
|
zlib.createGunzip(),
|
||||||
|
unzipStream,
|
||||||
|
reject,
|
||||||
|
);
|
||||||
|
res = unzipStream;
|
||||||
|
}
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
|
||||||
|
let rawData = '';
|
||||||
|
|
||||||
|
res.on('data', (chunk) => rawData += chunk);
|
||||||
|
res.on('end', () => {
|
||||||
|
try {
|
||||||
|
const ctx = {
|
||||||
|
[fnId]: (data) => ctx.data = data,
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.createContext(ctx);
|
||||||
|
vm.runInContext(rawData, ctx);
|
||||||
|
|
||||||
|
// console.log(ctx.data);
|
||||||
|
res.resume();
|
||||||
|
resolve(ctx.data);
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', reject);
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCoordinate(c) {
|
||||||
|
function string10to64(d) {
|
||||||
|
var c = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~".split("")
|
||||||
|
, b = c.length
|
||||||
|
, e = +d
|
||||||
|
, a = [];
|
||||||
|
do {
|
||||||
|
mod = e % b;
|
||||||
|
e = (e - mod) / b;
|
||||||
|
a.unshift(c[mod])
|
||||||
|
} while (e);
|
||||||
|
return a.join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
function prefixInteger(a, b) {
|
||||||
|
return (Array(b).join(0) + a).slice(-b)
|
||||||
|
}
|
||||||
|
|
||||||
|
function pretreatment(d, c, b) {
|
||||||
|
var e = string10to64(Math.abs(d));
|
||||||
|
var a = "";
|
||||||
|
if (!b) {
|
||||||
|
a += (d > 0 ? "1" : "0")
|
||||||
|
}
|
||||||
|
a += prefixInteger(e, c);
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
var b = new Array();
|
||||||
|
for (var e = 0; e < c.length; e++) {
|
||||||
|
if (e == 0) {
|
||||||
|
b.push(pretreatment(c[e][0] < 262143 ? c[e][0] : 262143, 3, true));
|
||||||
|
b.push(pretreatment(c[e][1] < 16777215 ? c[e][1] : 16777215, 4, true));
|
||||||
|
b.push(pretreatment(c[e][2] < 4398046511103 ? c[e][2] : 4398046511103, 7, true))
|
||||||
|
} else {
|
||||||
|
var a = c[e][0] - c[e - 1][0];
|
||||||
|
var f = c[e][1] - c[e - 1][1];
|
||||||
|
var d = c[e][2] - c[e - 1][2];
|
||||||
|
b.push(pretreatment(a < 4095 ? a : 4095, 2, false));
|
||||||
|
b.push(pretreatment(f < 4095 ? f : 4095, 2, false));
|
||||||
|
b.push(pretreatment(d < 16777215 ? d : 16777215, 4, true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
const HZ = 5;
|
||||||
|
|
||||||
|
class MousePosFaker {
|
||||||
|
constructor(puzzleX) {
|
||||||
|
this.x = parseInt(Math.random() * 20 + 20, 10);
|
||||||
|
this.y = parseInt(Math.random() * 80 + 80, 10);
|
||||||
|
this.t = Date.now();
|
||||||
|
this.pos = [[this.x, this.y, this.t]];
|
||||||
|
this.minDuration = parseInt(1000 / HZ, 10);
|
||||||
|
// this.puzzleX = puzzleX;
|
||||||
|
this.puzzleX = puzzleX + parseInt(Math.random() * 2 - 1, 10);
|
||||||
|
|
||||||
|
this.STEP = parseInt(Math.random() * 6 + 5, 10);
|
||||||
|
this.DURATION = parseInt(Math.random() * 7 + 14, 10) * 100;
|
||||||
|
// [9,1600] [10,1400]
|
||||||
|
this.STEP = 9;
|
||||||
|
// this.DURATION = 2000;
|
||||||
|
// console.log(this.STEP, this.DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
run() {
|
||||||
|
const perX = this.puzzleX / this.STEP;
|
||||||
|
const perDuration = this.DURATION / this.STEP;
|
||||||
|
const firstPos = [this.x - parseInt(Math.random() * 6, 10), this.y + parseInt(Math.random() * 11, 10), this.t];
|
||||||
|
|
||||||
|
this.pos.unshift(firstPos);
|
||||||
|
this.stepPos(perX, perDuration);
|
||||||
|
this.fixPos();
|
||||||
|
|
||||||
|
const reactTime = parseInt(60 + Math.random() * 100, 10);
|
||||||
|
const lastIdx = this.pos.length - 1;
|
||||||
|
const lastPos = [this.pos[lastIdx][0], this.pos[lastIdx][1], this.pos[lastIdx][2] + reactTime];
|
||||||
|
|
||||||
|
this.pos.push(lastPos);
|
||||||
|
return this.pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
stepPos(x, duration) {
|
||||||
|
let n = 0;
|
||||||
|
const sqrt2 = Math.sqrt(2);
|
||||||
|
for (let i = 1; i <= this.STEP; i++) {
|
||||||
|
n += 1 / i;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < this.STEP; i++) {
|
||||||
|
x = this.puzzleX / (n * (i + 1));
|
||||||
|
const currX = parseInt((Math.random() * 30 - 15) + x, 10);
|
||||||
|
const currY = parseInt(Math.random() * 7 - 3, 10);
|
||||||
|
const currDuration = parseInt((Math.random() * 0.4 + 0.8) * duration, 10);
|
||||||
|
|
||||||
|
this.moveToAndCollect({
|
||||||
|
x: currX,
|
||||||
|
y: currY,
|
||||||
|
duration: currDuration,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fixPos() {
|
||||||
|
const actualX = this.pos[this.pos.length - 1][0] - this.pos[1][0];
|
||||||
|
const deviation = this.puzzleX - actualX;
|
||||||
|
|
||||||
|
if (Math.abs(deviation) > 4) {
|
||||||
|
this.moveToAndCollect({
|
||||||
|
x: deviation,
|
||||||
|
y: parseInt(Math.random() * 8 - 3, 10),
|
||||||
|
duration: 250,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moveToAndCollect({x, y, duration}) {
|
||||||
|
let movedX = 0;
|
||||||
|
let movedY = 0;
|
||||||
|
let movedT = 0;
|
||||||
|
const times = duration / this.minDuration;
|
||||||
|
let perX = x / times;
|
||||||
|
let perY = y / times;
|
||||||
|
let padDuration = 0;
|
||||||
|
|
||||||
|
if (Math.abs(perX) < 1) {
|
||||||
|
padDuration = duration / Math.abs(x) - this.minDuration;
|
||||||
|
perX = 1;
|
||||||
|
perY = y / Math.abs(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (Math.abs(movedX) < Math.abs(x)) {
|
||||||
|
const rDuration = parseInt(padDuration + Math.random() * 16 - 4, 10);
|
||||||
|
|
||||||
|
movedX += perX + Math.random() * 2 - 1;
|
||||||
|
movedY += perY;
|
||||||
|
movedT += this.minDuration + rDuration;
|
||||||
|
|
||||||
|
const currX = parseInt(this.x + movedX, 10);
|
||||||
|
const currY = parseInt(this.y + movedY, 10);
|
||||||
|
const currT = this.t + movedT;
|
||||||
|
|
||||||
|
this.pos.push([currX, currY, currT]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.x += x;
|
||||||
|
this.y += y;
|
||||||
|
this.t += Math.max(duration, movedT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// new JDJRValidator().run();
|
||||||
|
// new JDJRValidator().report(1000);
|
||||||
|
// console.log(getCoordinate(new MousePosFaker(100).run()));
|
||||||
|
|
||||||
|
function injectToRequest2(fn, scene = 'cww') {
|
||||||
|
return (opts, cb) => {
|
||||||
|
fn(opts, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
console.error('验证请求失败.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.search('验证') > -1) {
|
||||||
|
console.log('JDJR验证中......');
|
||||||
|
const res = await new JDJRValidator().run(scene);
|
||||||
|
if (res) {
|
||||||
|
opts.url += `&validate=${res.validate}`;
|
||||||
|
}
|
||||||
|
fn(opts, cb);
|
||||||
|
} else {
|
||||||
|
cb(err, resp, data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.info(e)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
async function injectToRequest(scene = 'cww') {
|
||||||
|
console.log('JDJR验证中......');
|
||||||
|
const res = await new JDJRValidator().run(scene);
|
||||||
|
if (res == '') return;
|
||||||
|
return res.validate;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
sleep,
|
||||||
|
injectToRequest,
|
||||||
|
injectToRequest2
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,92 @@
|
||||||
|
const USER_AGENTS = [
|
||||||
|
'jdltapp;iPad;3.7.0;14.4;network/wifi;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;2346663656561603-4353564623932316;network/wifi;model/ONEPLUS A5010;addressid/0;aid/2dfceea045ed292a;oaid/;osVer/29;appBuild/1436;psn/BS6Y9SAiw0IpJ4ro7rjSOkCRZTgR3z2K|10;psq/5;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/10.5;jdv/;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/oppo;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.1;59d6ae6e8387bd09fe046d5b8918ead51614e80a;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone12,1;hasOCPay/0;appBuild/1017;supportBestPay/0;addressid/;pv/1.26;apprpd/;ref/JDLTSubMainPageViewController;psq/0;ads/;psn/59d6ae6e8387bd09fe046d5b8918ead51614e80a|3;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.5;22d679c006bf9c087abf362cf1d2e0020ebb8798;network/wifi;ADID/10857A57-DDF8-4A0D-A548-7B8F43AC77EE;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone12,1;addressid/2378947694;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/15.7;apprpd/Allowance_Registered;ref/JDLTTaskCenterViewController;psq/6;ads/;psn/22d679c006bf9c087abf362cf1d2e0020ebb8798|22;jdv/0|kong|t_1000170135|tuiguang|notset|1614153044558|1614153044;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.5;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;2616935633265383-5333463636261326;network/UNKNOWN;model/M2007J3SC;addressid/1840745247;aid/ba9e3b5853dccb1b;oaid/371d8af7dd71e8d5;osVer/29;appBuild/1436;psn/t7JmxZUXGkimd4f9Jdul2jEeuYLwxPrm|8;psq/6;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/5.6;jdv/;ref/com.jd.jdlite.lib.jdlitemessage.view.activity.MessageCenterMainActivity;partner/xiaomi;apprpd/MessageCenter_MessageMerge;eufv/1;Mozilla/5.0 (Linux; Android 10; M2007J3SC Build/QKQ1.200419.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045135 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;d7beab54ae7758fa896c193b49470204fbb8fce9;network/4g;ADID/97AD46C9-6D49-4642-BF6F-689256673906;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/6.28;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/d7beab54ae7758fa896c193b49470204fbb8fce9|8;jdv/0|kong|t_1001707023_|jingfen|79ad0319fa4d47e38521a616d80bc4bd|1613800945610|1613824900;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;9;D246836333735-3264353430393;network/4g;model/MIX 2;addressid/138678023;aid/bf8bcf1214b3832a;oaid/308540d1f1feb2f5;osVer/28;appBuild/1436;psn/Z/rGqfWBY/h5gcGFnVIsRw==|16;psq/3;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 9;osv/9;pv/13.7;jdv/;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/xiaomi;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 9; MIX 2 Build/PKQ1.190118.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045135 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;eb5a9e7e596e262b4ffb3b6b5c830984c8a5c0d5;network/wifi;ADID/5603541B-30C1-4B5C-A782-20D0B569D810;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,2;addressid/1041002757;hasOCPay/0;appBuild/101;supportBestPay/0;pv/34.6;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/5;ads/;psn/eb5a9e7e596e262b4ffb3b6b5c830984c8a5c0d5|44;jdv/0|androidapp|t_335139774|appshare|CopyURL|1612612940307|1612612944;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;21631ed983b3e854a3154b0336413825ad0d6783;network/3g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,4;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.47;apprpd/;ref/JDLTSubMainPageViewController;psq/8;ads/;psn/21631ed983b3e854a3154b0336413825ad0d6783|9;jdv/0|direct|-|none|-|1614150725100|1614225882;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.5;500a795cb2abae60b877ee4a1930557a800bef1c;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone8,1;addressid/669949466;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/9.11;apprpd/;ref/JDLTSubMainPageViewController;psq/10;ads/;psn/500a795cb2abae60b877ee4a1930557a800bef1c|11;jdv/;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.5;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPad;3.7.0;14.4;f5e7b7980fb50efc9c294ac38653c1584846c3db;network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPad6,3;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/231.11;pap/JA2020_3112531|3.7.0|IOS 14.4;apprpd/;psn/f5e7b7980fb50efc9c294ac38653c1584846c3db|305;usc/kong;jdv/0|kong|t_1000170135|tuiguang|notset|1613606450668|1613606450;umd/tuiguang;psq/2;ucp/t_1000170135;app_device/IOS;utr/notset;ref/JDLTRedPacketViewController;adk/;ads/;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;19fef5419f88076c43f5317eabe20121d52c6a61;network/wifi;ADID/00000000-0000-0000-0000-000000000000;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,8;addressid/3430850943;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/10.4;apprpd/;ref/JDLTSubMainPageViewController;psq/3;ads/;psn/19fef5419f88076c43f5317eabe20121d52c6a61|16;jdv/0|kong|t_1001327829_|jingfen|f51febe09dd64b20b06bc6ef4c1ad790#/|1614096460311|1614096511;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
||||||
|
'jdltapp;iPhone;3.7.0;12.2;f995bc883282f7c7ea9d7f32da3f658127aa36c7;network/4g;ADID/9F40F4CA-EA7C-4F2E-8E09-97A66901D83E;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,4;addressid/525064695;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/11.11;apprpd/;ref/JDLTSubMainPageViewController;psq/2;ads/;psn/f995bc883282f7c7ea9d7f32da3f658127aa36c7|22;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 12.2;Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;5366566313931326-6633931643233693;network/wifi;model/Mi9 Pro 5G;addressid/0;aid/5fe6191bf39a42c9;oaid/e3a9473ef6699f75;osVer/29;appBuild/1436;psn/b3rJlGi AwLqa9AqX7Vp0jv4T7XPMa0o|5;psq/4;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/5.4;jdv/;ref/HomeFragment;partner/xiaomi;apprpd/Home_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; Mi9 Pro 5G Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045135 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;4e6b46913a2e18dd06d6d69843ee4cdd8e033bc1;network/3g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,2;addressid/666624049;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/54.11;apprpd/MessageCenter_MessageMerge;ref/MessageCenterController;psq/10;ads/;psn/4e6b46913a2e18dd06d6d69843ee4cdd8e033bc1|101;jdv/0|kong|t_2010804675_|jingfen|810dab1ba2c04b8588c5aa5a0d44c4bd|1614183499;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.2;c71b599e9a0bcbd8d1ad924d85b5715530efad06;network/wifi;ADID/751C6E92-FD10-4323-B37C-187FD0CF0551;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,8;addressid/4053561885;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/263.8;apprpd/;ref/JDLTSubMainPageViewController;psq/2;ads/;psn/c71b599e9a0bcbd8d1ad924d85b5715530efad06|481;jdv/0|kong|t_1001610202_|jingfen|3911bea7ee2f4fcf8d11fdf663192bbe|1614157052210|1614157056;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.2;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;2d306ee3cacd2c02560627a5113817ebea20a2c9;network/4g;ADID/A346F099-3182-4889-9A62-2B3C28AB861E;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,3;hasOCPay/0;appBuild/1017;supportBestPay/0;addressid/;pv/1.35;apprpd/Allowance_Registered;ref/JDLTTaskCenterViewController;psq/0;ads/;psn/2d306ee3cacd2c02560627a5113817ebea20a2c9|2;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;28355aff16cec8bcf3e5728dbbc9725656d8c2c2;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,2;addressid/833058617;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.10;apprpd/;ref/JDLTWebViewController;psq/9;ads/;psn/28355aff16cec8bcf3e5728dbbc9725656d8c2c2|5;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.5;24ddac73a3de1b91816b7aedef53e97c4c313733;network/4g;ADID/598C6841-76AC-4512-AA97-CBA940548D70;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone11,6;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/12.6;apprpd/;ref/JDLTSubMainPageViewController;psq/5;ads/;psn/24ddac73a3de1b91816b7aedef53e97c4c313733|23;jdv/0|kong|t_1000170135|tuiguang|notset|1614126110904|1614126110;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.5;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;d7732ba60c8ff73cc3f5ba7290a3aa9551f73a1b;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone12,1;addressid/25239372;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/8.6;apprpd/;ref/JDLTSubMainPageViewController;psq/5;ads/;psn/d7732ba60c8ff73cc3f5ba7290a3aa9551f73a1b|14;jdv/0|kong|t_1001226363_|jingfen|5713234d1e1e4893b92b2de2cb32484d|1614182989528|1614182992;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;ca1a32afca36bc9fb37fd03f18e653bce53eaca5;network/wifi;ADID/3AF380AB-CB74-4FE6-9E7C-967693863CA3;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone8,1;addressid/138323416;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/72.12;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/ca1a32afca36bc9fb37fd03f18e653bce53eaca5|109;jdv/0|kong|t_1000536212_|jingfen|c82bfa19e33a4269a5884ffc614790f4|1614141246;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;7346933333666353-8333366646039373;network/wifi;model/ONEPLUS A5010;addressid/138117973;aid/7d933f6583cfd097;oaid/;osVer/29;appBuild/1436;psn/T/eqfRSwp8VKEvvXyEunq09Cg2MUkiQ5|17;psq/4;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/11.4;jdv/0|kong|t_1001849073_|jingfen|495a47f6c0b8431c9d460f61ad2304dc|1614084403978|1614084407;ref/HomeFragment;partner/oppo;apprpd/Home_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; ONEPLUS A5010 Build/QKQ1.191014.012; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;11;4626269356736353-5353236346334673;network/wifi;model/M2006J10C;addressid/0;aid/dbb9e7655526d3d7;oaid/66a7af49362987b0;osVer/30;appBuild/1436;psn/rQRQgJ 4 S3qkq8YDl28y6jkUHmI/rlX|3;psq/4;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 11;osv/11;pv/3.4;jdv/;ref/HomeFragment;partner/xiaomi;apprpd/Home_Main;eufv/1;Mozilla/5.0 (Linux; Android 11; M2006J10C Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045513 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;78fc1d919de0c8c2de15725eff508d8ab14f9c82;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,1;addressid/137829713;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/23.11;apprpd/;ref/JDLTSubMainPageViewController;psq/10;ads/;psn/78fc1d919de0c8c2de15725eff508d8ab14f9c82|34;jdv/0|iosapp|t_335139774|appshare|Wxfriends|1612508702380|1612534293;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;0373263343266633-5663030363465326;network/wifi;model/Redmi Note 7;addressid/590846082;aid/07b34bf3e6006d5b;oaid/17975a142e67ec92;osVer/29;appBuild/1436;psn/OHNqtdhQKv1okyh7rB3HxjwI00ixJMNG|4;psq/3;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/2.3;jdv/;ref/activityId=8a8fabf3cccb417f8e691b6774938bc2;partner/xiaomi;apprpd/jsbqd_home;eufv/1;Mozilla/5.0 (Linux; Android 10; Redmi Note 7 Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.152 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;10;3636566623663623-1693635613166646;network/wifi;model/ASUS_I001DA;addressid/1397761133;aid/ccef2fc2a96e1afd;oaid/;osVer/29;appBuild/1436;psn/T8087T0D82PHzJ4VUMGFrfB9dw4gUnKG|76;psq/5;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/73.5;jdv/0|kong|t_1002354188_|jingfen|2335e043b3344107a2750a781fde9a2e#/|1614097081426|1614097087;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/yingyongbao;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; ASUS_I001DA Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,2;addressid/138419019;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/5.7;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/6;ads/;psn/4ee6af0db48fd605adb69b63f00fcbb51c2fc3f0|9;jdv/0|direct|-|none|-|1613705981655|1613823229;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/wifi;ADID/F9FD7728-2956-4DD1-8EDD-58B07950864C;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,1;addressid/1346909722;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/30.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/40d4d4323eb3987226cae367d6b0d8be50f2c7b3|39;jdv/0|kong|t_1000252057_0|tuiguang|eba7648a0f4445aa9cfa6f35c6f36e15|1613995717959|1613995723;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;ADID/5D306F0D-A131-4B26-947E-166CCB9BFFFF;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,6;addressid/138164461;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/7.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/d40e5d4a33c100e8527f779557c347569b49c304|7;jdv/0|kong|t_1001226363_|jingfen|3bf5372cb9cd445bbb270b8bc9a34f00|1608439066693|1608439068;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPad;3.7.0;14.5;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPad8,9;hasOCPay/0;appBuild/1017;supportBestPay/0;addressid/;pv/1.20;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/5;ads/;psn/d9f5ddaa0160a20f32fb2c8bfd174fae7993c1b4|3;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.5;Mozilla/5.0 (iPad; CPU OS 14_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/wifi;ADID/31548A9C-8A01-469A-B148-E7D841C91FD0;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/10.5;apprpd/;ref/JDLTSubMainPageViewController;psq/4;ads/;psn/a858fb4b40e432ea32f80729916e6c3e910bb922|12;jdv/0|direct|-|none|-|1613898710373|1613898712;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.5;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,2;addressid/2237496805;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/13.6;apprpd/;ref/JDLTSubMainPageViewController;psq/5;ads/;psn/48e495dcf5dc398b4d46b27e9f15a2b427a154aa|15;jdv/0|direct|-|none|-|1613354874698|1613952828;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.5;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;3346332626262353-1666434336539336;network/wifi;model/ONEPLUS A6000;addressid/0;aid/3d3bbb25af44c59c;oaid/;osVer/29;appBuild/1436;psn/ECbc2EqmdSa7mDF1PS1GSrV/Tn7R1LS1|6;psq/8;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/2.67;jdv/0|direct|-|none|-|1613822479379|1613991194;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/oppo;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;8.1.0;8363834353530333132333132373-43D2930366035323639333662383;network/wifi;model/16th Plus;addressid/0;aid/f909e5f2c464c7c6;oaid/;osVer/27;appBuild/1436;psn/c21YWvVr77Hn6 pOZfxXGY4TZrre1 UOL5hcPbCEDMo=|3;psq/10;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 8.1.0;osv/8.1.0;pv/2.15;jdv/;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/jsxdlyqj09;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 8.1.0; 16th Plus Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045514 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;11;1343467336264693-3343562673463613;network/wifi;model/Mi 10 Pro;addressid/0;aid/14d7cbd934eb7dc1;oaid/335f198546eb3141;osVer/30;appBuild/1436;psn/ZcQh/Wov sNYfZ6JUjTIUBu28 KT0T3u|1;psq/24;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 11;osv/11;pv/1.24;jdv/;ref/com.jd.jdlite.lib.jdlitemessage.view.activity.MessageCenterMainActivity;partner/xiaomi;apprpd/MessageCenter_MessageMerge;eufv/1;Mozilla/5.0 (Linux; Android 11; Mi 10 Pro Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.181 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;10;8353636393732346-6646931673935346;network/wifi;model/MI 8;addressid/1969998059;aid/8566972dfd9a795d;oaid/4a8b773c3e307386;osVer/29;appBuild/1436;psn/PhYbUtCsCJo r 1b8hwxjnY8rEv5S8XC|383;psq/14;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/374.14;jdv/0|iosapp|t_335139774|liteshare|CopyURL|1609306590175|1609306596;ref/com.jd.jdlite.lib.jdlitemessage.view.activity.MessageCenterMainActivity;partner/jsxdlyqj09;apprpd/MessageCenter_MessageMerge;eufv/1;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;6d343c58764a908d4fa56609da4cb3a5cc1396d3;network/wifi;ADID/4965D884-3E61-4C4E-AEA7-9A8CE3742DA7;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,1;addressid/70390480;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.24;apprpd/MyJD_Main;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fafter%2Findex.action%3FcategoryId%3D600%26v%3D6%26entry%3Dm_self_jd;psq/4;ads/;psn/6d343c58764a908d4fa56609da4cb3a5cc1396d3|17;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.6.1;4606ddccdfe8f343f8137de7fea7f91fc4aef3a3;network/4g;ADID/C6FB6E20-D334-45FA-818A-7A4C58305202;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone10,1;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/5.9;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/8;ads/;psn/4606ddccdfe8f343f8137de7fea7f91fc4aef3a3|5;jdv/0|iosapp|t_335139774|liteshare|Qqfriends|1614206359106|1614206366;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.6.1;Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;3b6e79334551fc6f31952d338b996789d157c4e8;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,1;addressid/138051400;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/14.34;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/12;ads/;psn/3b6e79334551fc6f31952d338b996789d157c4e8|46;jdv/0|kong|t_1001707023_|jingfen|e80d7173a4264f4c9a3addcac7da8b5d|1613837384708|1613858760;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;1346235693831363-2373837393932673;network/wifi;model/LYA-AL00;addressid/3321567203;aid/1d2e9816278799b7;oaid/00000000-0000-0000-0000-000000000000;osVer/29;appBuild/1436;psn/45VUZFTZJkhP5fAXbeBoQ0 O2GCB I|7;psq/5;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/5.8;jdv/0|iosapp|t_335139774|liteshare|CopyURL|1614066210320|1614066219;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/huawei;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; LYA-AL00 Build/HUAWEILYA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;c2a8854e622a1b17a6c56c789f832f9d78ef1ba7;network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPhone12,5;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/3.9;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/8;ads/;psn/c2a8854e622a1b17a6c56c789f832f9d78ef1ba7|6;jdv/0|direct|-|none|-|1613541016735|1613823566;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;9;;network/wifi;model/MIX 2S;addressid/;aid/f87efed6d9ed3c65;oaid/94739128ef9dd245;osVer/28;appBuild/1436;psn/R7wD/OWkQjYWxax1pDV6kTIDFPJCUid7C/nl2hHnUuI=|3;psq/13;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 9;osv/9;pv/1.42;jdv/;ref/activityId=8a8fabf3cccb417f8e691b6774938bc2;partner/xiaomi;apprpd/jsbqd_home;eufv/1;Mozilla/5.0 (Linux; Android 9; MIX 2S Build/PKQ1.180729.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.181 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;network/wifi;Mozilla/5.0 (Linux; Android 10; Redmi Note 7 Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.152 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/3g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
||||||
|
'jdltapp;iPad;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/1;lang/zh_CN;model/iPad6,3;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/231.11;pap/JA2020_3112531|3.7.0|IOS 14.4;apprpd/;psn/f5e7b7980fb50efc9c294ac38653c1584846c3db|305;usc/kong;jdv/0|kong|t_1000170135|tuiguang|notset|1613606450668|1613606450;umd/tuiguang;psq/2;ucp/t_1000170135;app_device/IOS;utr/notset;ref/JDLTRedPacketViewController;adk/;ads/;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.5;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone8,1;addressid/669949466;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/9.11;apprpd/;ref/JDLTSubMainPageViewController;psq/10;ads/;psn/500a795cb2abae60b877ee4a1930557a800bef1c|11;jdv/;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.5;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/3g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,4;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.47;apprpd/;ref/JDLTSubMainPageViewController;psq/8;ads/;psn/21631ed983b3e854a3154b0336413825ad0d6783|9;jdv/0|direct|-|none|-|1614150725100|1614225882;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/3g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,4;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.47;apprpd/;ref/JDLTSubMainPageViewController;psq/8;ads/;psn/21631ed983b3e854a3154b0336413825ad0d6783|9;jdv/0|direct|-|none|-|1614150725100|1614225882;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/3.15;apprpd/;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fchat%2Findex.action%3Fentry%3Djd_m_JiSuCommodity%26pid%3D7763388%26lng%3D118.159665%26lat%3D24.504633%26sid%3D31cddc2d58f6e36bf2c31c4e8a79767w%26un_area%3D16_1315_3486_0;psq/12;ads/;psn/c10e0db6f15dec57a94637365f4c3d43e05bbd48|4;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/3.15;apprpd/;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fchat%2Findex.action%3Fentry%3Djd_m_JiSuCommodity%26pid%3D7763388%26lng%3D118.159665%26lat%3D24.504633%26sid%3D31cddc2d58f6e36bf2c31c4e8a79767w%26un_area%3D16_1315_3486_0;psq/12;ads/;psn/c10e0db6f15dec57a94637365f4c3d43e05bbd48|4;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone13,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/3.15;apprpd/;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fchat%2Findex.action%3Fentry%3Djd_m_JiSuCommodity%26pid%3D7763388%26lng%3D118.159665%26lat%3D24.504633%26sid%3D31cddc2d58f6e36bf2c31c4e8a79767w%26un_area%3D16_1315_3486_0;psq/12;ads/;psn/c10e0db6f15dec57a94637365f4c3d43e05bbd48|4;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,6;hasOCPay/0;appBuild/1017;supportBestPay/0;addressid/2813715704;pv/67.38;apprpd/MyJD_Main;ref/https%3A%2F%2Fh5.m.jd.com%2FbabelDiy%2FZeus%2F2ynE8QDtc2svd36VowmYWBzzDdK6%2Findex.html%3Flng%3D103.957532%26lat%3D30.626962%26sid%3D4fe8ef4283b24723a7bb30ee87c18b2w%26un_area%3D22_1930_49324_52512;psq/4;ads/;psn/5aef178f95931bdbbde849ea9e2fc62b18bc5829|127;jdv/0|direct|-|none|-|1612588090667|1613822580;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/6.28;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/d7beab54ae7758fa896c193b49470204fbb8fce9|8;jdv/0|kong|t_1001707023_|jingfen|79ad0319fa4d47e38521a616d80bc4bd|1613800945610|1613824900;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/6.28;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/d7beab54ae7758fa896c193b49470204fbb8fce9|8;jdv/0|kong|t_1001707023_|jingfen|79ad0319fa4d47e38521a616d80bc4bd|1613800945610|1613824900;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/6.28;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/d7beab54ae7758fa896c193b49470204fbb8fce9|8;jdv/0|kong|t_1001707023_|jingfen|79ad0319fa4d47e38521a616d80bc4bd|1613800945610|1613824900;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/6.28;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/d7beab54ae7758fa896c193b49470204fbb8fce9|8;jdv/0|kong|t_1001707023_|jingfen|79ad0319fa4d47e38521a616d80bc4bd|1613800945610|1613824900;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,2;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/6.28;apprpd/;ref/JDLTRedPacketViewController;psq/3;ads/;psn/d7beab54ae7758fa896c193b49470204fbb8fce9|8;jdv/0|kong|t_1001707023_|jingfen|79ad0319fa4d47e38521a616d80bc4bd|1613800945610|1613824900;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone12,1;addressid/3104834020;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.6;apprpd/;ref/JDLTSubMainPageViewController;psq/5;ads/;psn/c633e62b5a4ad0fdd93d9862bdcacfa8f3ecef63|6;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,1;addressid/1346909722;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/30.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/40d4d4323eb3987226cae367d6b0d8be50f2c7b3|39;jdv/0|kong|t_1000252057_0|tuiguang|eba7648a0f4445aa9cfa6f35c6f36e15|1613995717959|1613995723;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.3;network/wifi;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone10,1;addressid/1346909722;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/30.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/40d4d4323eb3987226cae367d6b0d8be50f2c7b3|39;jdv/0|kong|t_1000252057_0|tuiguang|eba7648a0f4445aa9cfa6f35c6f36e15|1613995717959|1613995723;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.3;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,6;addressid/138164461;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/7.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/d40e5d4a33c100e8527f779557c347569b49c304|7;jdv/0|kong|t_1001226363_|jingfen|3bf5372cb9cd445bbb270b8bc9a34f00|1608439066693|1608439068;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,6;addressid/138164461;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/7.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/d40e5d4a33c100e8527f779557c347569b49c304|7;jdv/0|kong|t_1001226363_|jingfen|3bf5372cb9cd445bbb270b8bc9a34f00|1608439066693|1608439068;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone11,6;addressid/138164461;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/7.8;apprpd/;ref/JDLTSubMainPageViewController;psq/7;ads/;psn/d40e5d4a33c100e8527f779557c347569b49c304|7;jdv/0|kong|t_1001226363_|jingfen|3bf5372cb9cd445bbb270b8bc9a34f00|1608439066693|1608439068;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;13.5;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,2;addressid/2237496805;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/13.6;apprpd/;ref/JDLTSubMainPageViewController;psq/5;ads/;psn/48e495dcf5dc398b4d46b27e9f15a2b427a154aa|15;jdv/0|direct|-|none|-|1613354874698|1613952828;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 13.5;Mozilla/5.0 (iPhone; CPU iPhone OS 13_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;android;3.7.0;10;network/wifi;model/ONEPLUS A6000;addressid/0;aid/3d3bbb25af44c59c;oaid/;osVer/29;appBuild/1436;psn/ECbc2EqmdSa7mDF1PS1GSrV/Tn7R1LS1|6;psq/8;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/2.67;jdv/0|direct|-|none|-|1613822479379|1613991194;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/oppo;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 10; ONEPLUS A6000 Build/QKQ1.190716.003; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;8.1.0;network/wifi;model/16th Plus;addressid/0;aid/f909e5f2c464c7c6;oaid/;osVer/27;appBuild/1436;psn/c21YWvVr77Hn6 pOZfxXGY4TZrre1 UOL5hcPbCEDMo=|3;psq/10;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 8.1.0;osv/8.1.0;pv/2.15;jdv/;ref/com.jd.jdlite.lib.personal.view.fragment.JDPersonalFragment;partner/jsxdlyqj09;apprpd/MyJD_Main;eufv/1;Mozilla/5.0 (Linux; Android 8.1.0; 16th Plus Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/77.0.3865.120 MQQBrowser/6.2 TBS/045514 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;11;network/wifi;model/Mi 10 Pro;addressid/0;aid/14d7cbd934eb7dc1;oaid/335f198546eb3141;osVer/30;appBuild/1436;psn/ZcQh/Wov sNYfZ6JUjTIUBu28 KT0T3u|1;psq/24;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 11;osv/11;pv/1.24;jdv/;ref/com.jd.jdlite.lib.jdlitemessage.view.activity.MessageCenterMainActivity;partner/xiaomi;apprpd/MessageCenter_MessageMerge;eufv/1;Mozilla/5.0 (Linux; Android 11; Mi 10 Pro Build/RKQ1.200826.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/88.0.4324.181 Mobile Safari/537.36',
|
||||||
|
'jdltapp;android;3.7.0;10;network/wifi;model/MI 8;addressid/1969998059;aid/8566972dfd9a795d;oaid/4a8b773c3e307386;osVer/29;appBuild/1436;psn/PhYbUtCsCJo r 1b8hwxjnY8rEv5S8XC|383;psq/14;adk/;ads/;pap/JA2020_3112531|3.7.0|ANDROID 10;osv/10;pv/374.14;jdv/0|iosapp|t_335139774|liteshare|CopyURL|1609306590175|1609306596;ref/com.jd.jdlite.lib.jdlitemessage.view.activity.MessageCenterMainActivity;partner/jsxdlyqj09;apprpd/MessageCenter_MessageMerge;eufv/1;Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045140 Mobile Safari/537.36',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone8,4;addressid/1477231693;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/21.15;apprpd/MyJD_Main;ref/https%3A%2F%2Fgold.jd.com%2F%3Flng%3D0.000000%26lat%3D0.000000%26sid%3D4584eb84dc00141b0d58e000583a338w%26un_area%3D19_1607_3155_62114;psq/0;ads/;psn/2c822e59db319590266cc83b78c4a943783d0077|46;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,1;addressid/70390480;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.24;apprpd/MyJD_Main;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fafter%2Findex.action%3FcategoryId%3D600%26v%3D6%26entry%3Dm_self_jd;psq/4;ads/;psn/6d343c58764a908d4fa56609da4cb3a5cc1396d3|17;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,1;addressid/70390480;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.24;apprpd/MyJD_Main;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fafter%2Findex.action%3FcategoryId%3D600%26v%3D6%26entry%3Dm_self_jd;psq/4;ads/;psn/6d343c58764a908d4fa56609da4cb3a5cc1396d3|17;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,1;addressid/70390480;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.24;apprpd/MyJD_Main;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fafter%2Findex.action%3FcategoryId%3D600%26v%3D6%26entry%3Dm_self_jd;psq/4;ads/;psn/6d343c58764a908d4fa56609da4cb3a5cc1396d3|17;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone9,1;addressid/70390480;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.24;apprpd/MyJD_Main;ref/https%3A%2F%2Fjdcs.m.jd.com%2Fafter%2Findex.action%3FcategoryId%3D600%26v%3D6%26entry%3Dm_self_jd;psq/4;ads/;psn/6d343c58764a908d4fa56609da4cb3a5cc1396d3|17;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPhone;3.7.0;14.4;network/4g;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPhone12,3;hasOCPay/0;appBuild/1017;supportBestPay/0;addressid/;pv/3.49;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/7;ads/;psn/9e0e0ea9c6801dfd53f2e50ffaa7f84c7b40cd15|6;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
'jdltapp;iPad;3.7.0;14.4;network/wifi;hasUPPay/0;pushNoticeIsOpen/0;lang/zh_CN;model/iPad7,5;addressid/;hasOCPay/0;appBuild/1017;supportBestPay/0;pv/4.14;apprpd/MyJD_Main;ref/MyJdMTAManager;psq/3;ads/;psn/956c074c769cd2eeab2e36fca24ad4c9e469751a|8;jdv/0|;adk/;app_device/IOS;pap/JA2020_3112531|3.7.0|IOS 14.4;Mozilla/5.0 (iPad; CPU OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1',
|
||||||
|
]
|
||||||
|
/**
|
||||||
|
* 生成随机数字
|
||||||
|
* @param {number} min 最小值(包含)
|
||||||
|
* @param {number} max 最大值(不包含)
|
||||||
|
*/
|
||||||
|
function randomNumber(min = 0, max = 100) {
|
||||||
|
return Math.min(Math.floor(min + Math.random() * (max - min)), max);
|
||||||
|
}
|
||||||
|
const USER_AGENT = USER_AGENTS[randomNumber(0, USER_AGENTS.length)];
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
USER_AGENT
|
||||||
|
}
|
|
@ -0,0 +1,122 @@
|
||||||
|
|
||||||
|
## 6dy
|
||||||
|
|
||||||
|
声明: 此库所有内容仅用于个人学习!!!
|
||||||
|
|
||||||
|
### [TG CHANEL](https://t.me/dylan_jdpro)
|
||||||
|
|
||||||
|
|
||||||
|
国内机(带代理):
|
||||||
|
|
||||||
|
```
|
||||||
|
ql repo https://js.jdpro.site/https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils"
|
||||||
|
|
||||||
|
```
|
||||||
|
默认代理拉不了,自行找可用代理
|
||||||
|
|
||||||
|
国外机:
|
||||||
|
|
||||||
|
```
|
||||||
|
ql repo https://github.com/6dylan6/jdpro.git "jd_|jx_|jddj_" "backUp" "^jd[^_]|USER|JD|function|sendNotify|utils"
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
定时随意
|
||||||
|
|
||||||
|
|
||||||
|
线报监控类,[入口](https://github.com/6dylan6/jdm.git)
|
||||||
|
|
||||||
|
带图评价(PC版CK,本库也有简化版可用)[入口](https://github.com/6dylan6/auto_comment.git)
|
||||||
|
|
||||||
|
|
||||||
|
## 简要流程
|
||||||
|
|
||||||
|
1、部署青龙并登陆。
|
||||||
|
|
||||||
|
2、到配置管理config.sh修改,差不多在17行(特别注意,没有修改此配置,sh类型任务拉不下来);
|
||||||
|
|
||||||
|
RepoFileExtensions="js py"修改为 RepoFileExtensions="js py sh" 保存;
|
||||||
|
|
||||||
|
3、到订阅管理创建订阅并运行;正确配置[参考](https://github.com/6dylan6/jdpro/issues/22)
|
||||||
|
|
||||||
|
4、订阅运行完毕,到定时任务搜索依赖安装任务执行;
|
||||||
|
|
||||||
|
4、到环境变量,创建变量,名称: JD_COOKIE,值:抓的CK(要安全就手抓),多个依次创建;
|
||||||
|
|
||||||
|
5、配置通知,通知的key填写到配置管理config.sh文件;
|
||||||
|
|
||||||
|
6、sendnotify.js文件用库里的到青龙deps目录下,否则会被青龙自带覆盖
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>笔记</summary>
|
||||||
|
<pre><code>
|
||||||
|
|
||||||
|
1、任务并发和分组
|
||||||
|
|
||||||
|
并发配置方法:
|
||||||
|
|
||||||
|
在任务后面加conc JD_COOKIE
|
||||||
|
|
||||||
|
如 task XXXXX.js conc JD_COOKIE
|
||||||
|
|
||||||
|
任务分组运行方法:
|
||||||
|
|
||||||
|
在任务后面加desi JD_COOKIE 需要运行的ck序号
|
||||||
|
|
||||||
|
如 task XXXX.js desi JD_COOKIE 1-10 前10个一组运行,2 8 9就是第2/8/9序号的ck执行,以此类推。
|
||||||
|
|
||||||
|
2、通知支持一对一推送和显示备注(需用本库sendnotify文件),还有分组通知等用法参考[notify.md](./notify.md)
|
||||||
|
|
||||||
|
备注显示变量如下
|
||||||
|
|
||||||
|
export NOTIFY_SHOWNAMETYPE="1" 不做任何变动
|
||||||
|
|
||||||
|
export NOTIFY_SHOWNAMETYPE="2" 效果是 : 账号名称:别名(备注)
|
||||||
|
|
||||||
|
export NOTIFY_SHOWNAMETYPE="3" 效果是 : 账号名称:pin(备注)
|
||||||
|
|
||||||
|
export NOTIFY_SHOWNAMETYPE="4" 效果是 : 账号名称:备注
|
||||||
|
|
||||||
|
3、因为青龙有随机延时(可以在配置文件设置为0,默认300秒),所以涉及准点运行的任务,最后加now,如果是desi或conc不用加也会准时跑。
|
||||||
|
|
||||||
|
4、青龙系统通知(新增删除任务、登录等通知),需把通知变量写到config.sh文件,在环境变量里只发脚本运行通知哈。
|
||||||
|
|
||||||
|
5、如果通知文件发现和库里的不一致,那是被青龙自带的覆盖了,手动拷贝一份到deps目录下。
|
||||||
|
|
||||||
|
6、建议调整任务运行超时时间,青龙默认1小时有些跑不完就被强制结束,config.sh里配置。CommandTimeoutTime="3h" 即改为3小时,根据自己ck数量调整。
|
||||||
|
</code></pre>
|
||||||
|
</details>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
如需禁止某些CK参加所有活动或某些活动功能,实现重组CK顺序功能,包括随机、优先、轮换、组队、分段等功能,把[task_before](./docker/task_before.sh)文件内容复制到配置管理task_before.sh保存
|
||||||
|
|
||||||
|
常用变量举例:
|
||||||
|
|
||||||
|
Recombin_CK_Mode="1" 全部顺序随机
|
||||||
|
|
||||||
|
Recombin_CK_Mode="2" Recombin_CK_ARG1="15" 假设有100个CK,前15个CK按正常顺序靠前,其余CK随机乱序
|
||||||
|
|
||||||
|
Recombin_CK_Mode="3" Recombin_CK_ARG1="5" Recombin_CK_ARG2="5" 假设有100个CK,希望前5个账号始终保持在前部,剩余95个账号按照轮换模式每天轮换5个
|
||||||
|
|
||||||
|
其他用法具体参考[文档](https://docs.qq.com/doc/DTXh6QUVjRXJ1TFdN)
|
||||||
|
|
||||||
|
## 通用变量
|
||||||
|
|
||||||
|
自定义sign export SIGN_URL='url'
|
||||||
|
|
||||||
|
代理API export DY_PROXY='url'(部分js支持)
|
||||||
|
|
||||||
|
API白名单模式 export PERMIT_API='fruit'
|
||||||
|
|
||||||
|
代理池 export DP_POOL='url'(全部js支持)
|
||||||
|
|
||||||
|
代理池白名单(js文件名关键字如fruit),如fruit export PERMIT_JS='fruit'
|
||||||
|
|
||||||
|
|
||||||
|
## 支持的通知方式
|
||||||
|
|
||||||
|
server酱,go-cqhttp,pushdeer,Bark App,tg bot,钉钉bot,企业微信bot,企业微信应用消息,飞书,iGot,push plus,WxPusher,gotify
|
||||||
|
|
||||||
|
请在配置管理config文件里填写对应key
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,422 @@
|
||||||
|
/*
|
||||||
|
CK作废,不时之需,希望大家用不到!!!
|
||||||
|
最好改密码!!!
|
||||||
|
*/
|
||||||
|
const $ = new Env('作废CK');
|
||||||
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
|
|
||||||
|
//IOS等用户直接用NobyDa的jd cookie
|
||||||
|
let cookiesArr = [], cookie = '';
|
||||||
|
let flg = process.env.killck?process.env.killck:false;
|
||||||
|
if ($.isNode()) {
|
||||||
|
Object.keys(jdCookieNode).forEach((item) => {
|
||||||
|
cookiesArr.push(jdCookieNode[item])
|
||||||
|
})
|
||||||
|
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
|
||||||
|
} else {
|
||||||
|
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
|
||||||
|
}
|
||||||
|
|
||||||
|
!(async () => {
|
||||||
|
if (!cookiesArr[0]) {
|
||||||
|
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!flg){
|
||||||
|
console.log(`请设置变量killck='true'来运行!!!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < cookiesArr.length; i++) {
|
||||||
|
if (cookiesArr[i]) {
|
||||||
|
cookie = cookiesArr[i];
|
||||||
|
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
|
$.index = i + 1;
|
||||||
|
$.isLogin = true;
|
||||||
|
$.nickName = '';
|
||||||
|
await TotalBean();
|
||||||
|
console.log(`\n开始【京东账号${$.index}】${$.nickName || $.UserName}\n`);
|
||||||
|
if (!$.isLogin) {
|
||||||
|
$.msg('', `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {"open-url": "https://bean.m.jd.com/bean/signIndex.action"});
|
||||||
|
|
||||||
|
//if ($.isNode()) {
|
||||||
|
//await notify.sendNotify(`${$.name}cookie已失效 - ${$.UserName}`, `京东账号${$.index} ${$.UserName}\n请重新登录获取cookie`);
|
||||||
|
//}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
await killck();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})()
|
||||||
|
.catch((e) => {
|
||||||
|
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
$.done();
|
||||||
|
})
|
||||||
|
|
||||||
|
function killck() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
const options = {
|
||||||
|
url: `https://plogin.m.jd.com/cgi-bin/ml/mlogout?appid=300&returnurl=https%3A%2F%2Fm.jd.com%2F`,
|
||||||
|
headers: {
|
||||||
|
'authority': 'plogin.m.jd.com',
|
||||||
|
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"),
|
||||||
|
'cookie': cookie
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
console.log('此CK成功作废,重新获取CK吧!\n')
|
||||||
|
} catch (e) {
|
||||||
|
$.logErr(e, resp);
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function TotalBean () {
|
||||||
|
return new Promise( async resolve => {
|
||||||
|
const options = {
|
||||||
|
url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
|
||||||
|
headers: {
|
||||||
|
Host: "me-api.jd.com",
|
||||||
|
Accept: "*/*",
|
||||||
|
Connection: "keep-alive",
|
||||||
|
Cookie: cookie,
|
||||||
|
"User-Agent": $.isNode() ? ( process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : ( require( './USER_AGENTS' ).USER_AGENT ) ) : ( $.getdata( 'JDUA' ) ? $.getdata( 'JDUA' ) : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1" ),
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get( options, ( err, resp, data ) => {
|
||||||
|
try {
|
||||||
|
if ( err ) {
|
||||||
|
$.logErr( err )
|
||||||
|
} else {
|
||||||
|
if ( data ) {
|
||||||
|
data = JSON.parse( data );
|
||||||
|
if ( data[ 'retcode' ] === "1001" ) {
|
||||||
|
$.isLogin = false; //cookie过期
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( data[ 'retcode' ] === "0" && data.data && data.data.hasOwnProperty( "userInfo" ) ) {
|
||||||
|
$.nickName = data.data.userInfo.baseInfo.nickname;
|
||||||
|
}
|
||||||
|
if ( data[ 'retcode' ] === '0' && data.data && data.data[ 'assetInfo' ] ) {
|
||||||
|
$.beanCount = data.data && data.data[ 'assetInfo' ][ 'beanNum' ];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.log( '京东服务器返回空数据' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch ( e ) {
|
||||||
|
$.logErr( e )
|
||||||
|
} finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
} )
|
||||||
|
} )
|
||||||
|
}
|
||||||
|
|
||||||
|
function jsonParse(str) {
|
||||||
|
if (typeof str == "string") {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// prettier-ignore
|
||||||
|
function Env(t, e) {
|
||||||
|
"undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0);
|
||||||
|
|
||||||
|
class s {
|
||||||
|
constructor(t) {
|
||||||
|
this.env = t
|
||||||
|
}
|
||||||
|
|
||||||
|
send(t, e = "GET") {
|
||||||
|
t = "string" == typeof t ? {url: t} : t;
|
||||||
|
let s = this.get;
|
||||||
|
return "POST" === e && (s = this.post), new Promise((e, i) => {
|
||||||
|
s.call(this, t, (t, s, r) => {
|
||||||
|
t ? i(t) : e(s)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
get(t) {
|
||||||
|
return this.send.call(this.env, t)
|
||||||
|
}
|
||||||
|
|
||||||
|
post(t) {
|
||||||
|
return this.send.call(this.env, t, "POST")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new class {
|
||||||
|
constructor(t, e) {
|
||||||
|
this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`)
|
||||||
|
}
|
||||||
|
|
||||||
|
isNode() {
|
||||||
|
return "undefined" != typeof module && !!module.exports
|
||||||
|
}
|
||||||
|
|
||||||
|
isQuanX() {
|
||||||
|
return "undefined" != typeof $task
|
||||||
|
}
|
||||||
|
|
||||||
|
isSurge() {
|
||||||
|
return "undefined" != typeof $httpClient && "undefined" == typeof $loon
|
||||||
|
}
|
||||||
|
|
||||||
|
isLoon() {
|
||||||
|
return "undefined" != typeof $loon
|
||||||
|
}
|
||||||
|
|
||||||
|
toObj(t, e = null) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(t)
|
||||||
|
} catch {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
toStr(t, e = null) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(t)
|
||||||
|
} catch {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getjson(t, e) {
|
||||||
|
let s = e;
|
||||||
|
const i = this.getdata(t);
|
||||||
|
if (i) try {
|
||||||
|
s = JSON.parse(this.getdata(t))
|
||||||
|
} catch {
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
setjson(t, e) {
|
||||||
|
try {
|
||||||
|
return this.setdata(JSON.stringify(t), e)
|
||||||
|
} catch {
|
||||||
|
return !1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getScript(t) {
|
||||||
|
return new Promise(e => {
|
||||||
|
this.get({url: t}, (t, s, i) => e(i))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
runScript(t, e) {
|
||||||
|
return new Promise(s => {
|
||||||
|
let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
|
||||||
|
i = i ? i.replace(/\n/g, "").trim() : i;
|
||||||
|
let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
|
||||||
|
r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;
|
||||||
|
const [o, h] = i.split("@"), n = {
|
||||||
|
url: `http://${h}/v1/scripting/evaluate`,
|
||||||
|
body: {script_text: t, mock_type: "cron", timeout: r},
|
||||||
|
headers: {"X-Key": o, Accept: "*/*"}
|
||||||
|
};
|
||||||
|
this.post(n, (t, e, i) => s(i))
|
||||||
|
}).catch(t => this.logErr(t))
|
||||||
|
}
|
||||||
|
|
||||||
|
loaddata() {
|
||||||
|
if (!this.isNode()) return {};
|
||||||
|
{
|
||||||
|
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
|
||||||
|
const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile),
|
||||||
|
s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e);
|
||||||
|
if (!s && !i) return {};
|
||||||
|
{
|
||||||
|
const i = s ? t : e;
|
||||||
|
try {
|
||||||
|
return JSON.parse(this.fs.readFileSync(i))
|
||||||
|
} catch (t) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
writedata() {
|
||||||
|
if (this.isNode()) {
|
||||||
|
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
|
||||||
|
const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile),
|
||||||
|
s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data);
|
||||||
|
s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lodash_get(t, e, s) {
|
||||||
|
const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
|
||||||
|
let r = t;
|
||||||
|
for (const t of i) if (r = Object(r)[t], void 0 === r) return s;
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
|
||||||
|
lodash_set(t, e, s) {
|
||||||
|
return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
|
||||||
|
}
|
||||||
|
|
||||||
|
getdata(t) {
|
||||||
|
let e = this.getval(t);
|
||||||
|
if (/^@/.test(t)) {
|
||||||
|
const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";
|
||||||
|
if (r) try {
|
||||||
|
const t = JSON.parse(r);
|
||||||
|
e = t ? this.lodash_get(t, i, "") : e
|
||||||
|
} catch (t) {
|
||||||
|
e = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
|
||||||
|
setdata(t, e) {
|
||||||
|
let s = !1;
|
||||||
|
if (/^@/.test(e)) {
|
||||||
|
const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}";
|
||||||
|
try {
|
||||||
|
const e = JSON.parse(h);
|
||||||
|
this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)
|
||||||
|
} catch (e) {
|
||||||
|
const o = {};
|
||||||
|
this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)
|
||||||
|
}
|
||||||
|
} else s = this.setval(t, e);
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
|
getval(t) {
|
||||||
|
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
|
||||||
|
}
|
||||||
|
|
||||||
|
setval(t, e) {
|
||||||
|
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
|
||||||
|
}
|
||||||
|
|
||||||
|
initGotEnv(t) {
|
||||||
|
this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
|
||||||
|
}
|
||||||
|
|
||||||
|
get(t, e = (() => {
|
||||||
|
})) {
|
||||||
|
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {"X-Surge-Skip-Scripting": !1})), $httpClient.get(t, (t, s, i) => {
|
||||||
|
!t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
|
||||||
|
})) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {hints: !1})), $task.fetch(t).then(t => {
|
||||||
|
const {statusCode: s, statusCode: i, headers: r, body: o} = t;
|
||||||
|
e(null, {status: s, statusCode: i, headers: r, body: o}, o)
|
||||||
|
}, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
|
||||||
|
try {
|
||||||
|
if (t.headers["set-cookie"]) {
|
||||||
|
const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
|
||||||
|
s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
|
||||||
|
}
|
||||||
|
} catch (t) {
|
||||||
|
this.logErr(t)
|
||||||
|
}
|
||||||
|
}).then(t => {
|
||||||
|
const {statusCode: s, statusCode: i, headers: r, body: o} = t;
|
||||||
|
e(null, {status: s, statusCode: i, headers: r, body: o}, o)
|
||||||
|
}, t => {
|
||||||
|
const {message: s, response: i} = t;
|
||||||
|
e(s, i, i && i.body)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
post(t, e = (() => {
|
||||||
|
})) {
|
||||||
|
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {"X-Surge-Skip-Scripting": !1})), $httpClient.post(t, (t, s, i) => {
|
||||||
|
!t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
|
||||||
|
}); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {hints: !1})), $task.fetch(t).then(t => {
|
||||||
|
const {statusCode: s, statusCode: i, headers: r, body: o} = t;
|
||||||
|
e(null, {status: s, statusCode: i, headers: r, body: o}, o)
|
||||||
|
}, t => e(t)); else if (this.isNode()) {
|
||||||
|
this.initGotEnv(t);
|
||||||
|
const {url: s, ...i} = t;
|
||||||
|
this.got.post(s, i).then(t => {
|
||||||
|
const {statusCode: s, statusCode: i, headers: r, body: o} = t;
|
||||||
|
e(null, {status: s, statusCode: i, headers: r, body: o}, o)
|
||||||
|
}, t => {
|
||||||
|
const {message: s, response: i} = t;
|
||||||
|
e(s, i, i && i.body)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
time(t, e = null) {
|
||||||
|
const s = e ? new Date(e) : new Date;
|
||||||
|
let i = {
|
||||||
|
"M+": s.getMonth() + 1,
|
||||||
|
"d+": s.getDate(),
|
||||||
|
"H+": s.getHours(),
|
||||||
|
"m+": s.getMinutes(),
|
||||||
|
"s+": s.getSeconds(),
|
||||||
|
"q+": Math.floor((s.getMonth() + 3) / 3),
|
||||||
|
S: s.getMilliseconds()
|
||||||
|
};
|
||||||
|
/(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length)));
|
||||||
|
for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length)));
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
|
||||||
|
msg(e = t, s = "", i = "", r) {
|
||||||
|
const o = t => {
|
||||||
|
if (!t) return t;
|
||||||
|
if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {"open-url": t} : this.isSurge() ? {url: t} : void 0;
|
||||||
|
if ("object" == typeof t) {
|
||||||
|
if (this.isLoon()) {
|
||||||
|
let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"];
|
||||||
|
return {openUrl: e, mediaUrl: s}
|
||||||
|
}
|
||||||
|
if (this.isQuanX()) {
|
||||||
|
let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl;
|
||||||
|
return {"open-url": e, "media-url": s}
|
||||||
|
}
|
||||||
|
if (this.isSurge()) {
|
||||||
|
let e = t.url || t.openUrl || t["open-url"];
|
||||||
|
return {url: e}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
|
||||||
|
let t = ["", "==============📣系统通知📣=============="];
|
||||||
|
t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log(...t) {
|
||||||
|
t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
|
||||||
|
}
|
||||||
|
|
||||||
|
logErr(t, e) {
|
||||||
|
const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
|
||||||
|
}
|
||||||
|
|
||||||
|
wait(t) {
|
||||||
|
return new Promise(e => setTimeout(e, t))
|
||||||
|
}
|
||||||
|
|
||||||
|
done(t = {}) {
|
||||||
|
const e = (new Date).getTime(), s = (e - this.startTime) / 1e3;
|
||||||
|
this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
|
||||||
|
}
|
||||||
|
}(t, e)
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,18 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"pt_pin": "中文账号名",
|
||||||
|
"Uid": "UID_XXXXXXXXXXXXXXXXXXX"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pt_pin": "XXXXXXX",
|
||||||
|
"Uid": "UID_XXXXXXXXXXXXXXXXXXX"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pt_pin": "XXXXXXX",
|
||||||
|
"Uid": "UID_XXXXXXXXXXXXXXXXXXX"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"pt_pin": "XXXXXXX",
|
||||||
|
"Uid": "UID_XXXXXXXXXXXXXXXXXXX"
|
||||||
|
}
|
||||||
|
]
|
|
@ -0,0 +1,70 @@
|
||||||
|
# Usage
|
||||||
|
|
||||||
|
> 推荐使用`docker-compose`所以这里只介绍`docker-compose`使用方式
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Docker安装
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- 国内一键安装 `sudo curl -sSL https://get.daocloud.io/docker | sh`
|
||||||
|
- 国外一键安装 `sudo curl -sSL get.docker.com | sh`
|
||||||
|
- 北京外国语大学开源软件镜像站 `https://mirrors.bfsu.edu.cn/help/docker-ce/`
|
||||||
|
|
||||||
|
|
||||||
|
docker-compose 安装(群晖`nas docker`自带安装了`docker-compose`)
|
||||||
|
|
||||||
|
```
|
||||||
|
curl -L https://get.daocloud.io/docker/compose/releases/download/v2.1.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
|
||||||
|
chmod +x /usr/local/bin/docker-compose
|
||||||
|
```
|
||||||
|
`Ubuntu`用户快速安装`docker-compose`
|
||||||
|
```
|
||||||
|
sudo apt-get update && sudo apt-get install -y python3-pip curl vim git moreutils
|
||||||
|
pip3 install --upgrade pip
|
||||||
|
pip install docker-compose
|
||||||
|
```
|
||||||
|
|
||||||
|
## win10用户安装[docker desktop](https://www.docker.com/products/docker-desktop)
|
||||||
|
|
||||||
|
通过`docker-compose version`查看`docker-compose`版本,确认是否安装成功。
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 常用命令
|
||||||
|
|
||||||
|
`docker-compose up -d` 启动(修改docker-compose.yml后需要使用此命令使更改生效);
|
||||||
|
`docker-compose logs` 打印日志;
|
||||||
|
`docker-compose logs -f` 打印日志,-f表示跟随日志;
|
||||||
|
`docker logs -f qinglong` 和上面两条相比可以显示汉字;
|
||||||
|
`docker-compose pull` 更新镜像;
|
||||||
|
`docker-compose stop` 停止容器;
|
||||||
|
`docker-compose restart` 重启容器;
|
||||||
|
`docker-compose down` 停止并删除容器;
|
||||||
|
|
||||||
|
## 青龙一键部署(2.11.3版本)
|
||||||
|
|
||||||
|
1. 新建一个文件夹,用于存放相关数据
|
||||||
|
2. 下载本仓库中的`docker-compose.yml`至本地,或是复制文件内容后在本地自行建立并粘贴内容
|
||||||
|
3. 使用docker-compose启动
|
||||||
|
4. 浏览器输入ip:5700即可进入面板
|
||||||
|
|
||||||
|
###新建数据文件夹
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mkdir qinglong
|
||||||
|
cd qinglong
|
||||||
|
```
|
||||||
|
|
||||||
|
###下载或复制docker-compose.yml文件
|
||||||
|
|
||||||
|
```bash
|
||||||
|
wget https://ghproxy.com/https://raw.githubusercontent.com/whyour/qinglong/develop/docker-compose.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
###启动
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
```
|
|
@ -0,0 +1,17 @@
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
ql_web:
|
||||||
|
image: whyour/qinglong:2.11.3
|
||||||
|
container_name: ql
|
||||||
|
volumes:
|
||||||
|
- ./data/config:/ql/config
|
||||||
|
- ./data/log:/ql/log
|
||||||
|
- ./data/db:/ql/db
|
||||||
|
- ./data/scripts:/ql/scripts
|
||||||
|
- ./data/repo:/ql/repo
|
||||||
|
ports:
|
||||||
|
- "0.0.0.0:5700:5700"
|
||||||
|
environment:
|
||||||
|
- ENABLE_HANGUP=true
|
||||||
|
- ENABLE_WEB_PANEL=true
|
||||||
|
restart: always
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
## 添加你需要重启自动执行的任意命令,比如 ql repo
|
||||||
|
## 安装node依赖使用 pnpm install -g xxx xxx
|
||||||
|
## 安装python依赖使用 pip3 install xxx
|
||||||
|
pnpm install -g png-js
|
||||||
|
pnpm install -g date-fns
|
||||||
|
pnpm install -g axios
|
||||||
|
pnpm install -g crypto-js
|
||||||
|
pnpm install -g ts-md5
|
||||||
|
pnpm install -g tslib
|
||||||
|
pnpm install -g @types/node
|
||||||
|
pnpm install -g requests
|
||||||
|
pnpm install -g jsdom
|
|
@ -0,0 +1,162 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#2.11.3版本青龙一键安装并添加拉库任务
|
||||||
|
#端口5500
|
||||||
|
#modify 2022-10-12
|
||||||
|
|
||||||
|
Green="\033[32;1m"
|
||||||
|
Red="\033[31m"
|
||||||
|
Yellow="\033[33;1m"
|
||||||
|
Blue="\033[36;1m"
|
||||||
|
Font="\033[0m"
|
||||||
|
GreenBG="\033[42;37m"
|
||||||
|
RedBG="\033[41;37m"
|
||||||
|
OK="${Green}[OK]${Font}"
|
||||||
|
ERROR="${Red}[ERROR]${Font}"
|
||||||
|
|
||||||
|
ok() {
|
||||||
|
echo
|
||||||
|
echo -e " ${OK} ${Green} $1 ${Font}"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
error() {
|
||||||
|
echo
|
||||||
|
echo -e "${ERROR} ${RedBG} $1 ${Font}"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
ing () {
|
||||||
|
echo
|
||||||
|
echo -e "${Yellow} $1 ${Font}"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if [[ ! "$USER" == "root" ]]; then
|
||||||
|
error "警告:请使用root用户操作!~~"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
datav=/root/ql$(date +%Y%m%d)
|
||||||
|
mkdir -p $datav && ql_path=$datav
|
||||||
|
|
||||||
|
|
||||||
|
ql_run() {
|
||||||
|
if [ -z "$(docker ps -a |awk '{print $NF}'| grep qinglong 2> /dev/null)" ]; then
|
||||||
|
cd $ql_path
|
||||||
|
cat > docker-compose.yml <<EOF
|
||||||
|
version: '2'
|
||||||
|
services:
|
||||||
|
qinglong:
|
||||||
|
image: whyour/qinglong:2.11.3
|
||||||
|
container_name: qinglong
|
||||||
|
volumes:
|
||||||
|
- ./data/config:/ql/config
|
||||||
|
- ./data/log:/ql/log
|
||||||
|
- ./data/db:/ql/db
|
||||||
|
- ./data/scripts:/ql/scripts
|
||||||
|
- ./data/repo:/ql/repo
|
||||||
|
ports:
|
||||||
|
- "0.0.0.0:5500:5700"
|
||||||
|
networks:
|
||||||
|
- net
|
||||||
|
environment:
|
||||||
|
- ENABLE_HANGUP=true
|
||||||
|
- ENABLE_WEB_PANEL=true
|
||||||
|
restart: always
|
||||||
|
networks:
|
||||||
|
net:
|
||||||
|
EOF
|
||||||
|
docker-compose up -d
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
error "** 错误:容器创建失败,请翻译以上英文报错,Google/百度尝试解决问题!"
|
||||||
|
else
|
||||||
|
sleep 30
|
||||||
|
ok "青龙面板已启动,请去浏览器访问http://ip:5500进行初始化并登陆进去,完成后回来继续下一步!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
error "已有qinglong名称的容器在运行,不能重复创建!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
docker_install() {
|
||||||
|
if [ -x "$(command -v docker)" ]; then
|
||||||
|
ok "检测到 Docker 已安装!"
|
||||||
|
else
|
||||||
|
if [ -r /etc/os-release ]; then
|
||||||
|
lsb_dist="$(. /etc/os-release && echo "$ID")"
|
||||||
|
fi
|
||||||
|
if [ $lsb_dist == "openwrt" ]; then
|
||||||
|
error "openwrt 环境请自行安装 docker"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
ing "开始安装 docker 环境..."
|
||||||
|
curl -sSL https://get.daocloud.io/docker | sh
|
||||||
|
sleep 2
|
||||||
|
if [ -x "$(command -v docker)" ]; then
|
||||||
|
mkdir /etc/docker
|
||||||
|
cat > /etc/docker/daemon.json <<EOF
|
||||||
|
{
|
||||||
|
"registry-mirrors": ["https://pee6w651.mirror.aliyuncs.com/","https://registry.docker-cn.com"]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
chmod +x /etc/docker/daemon.json
|
||||||
|
ok "安装 docker 环境...完成!"
|
||||||
|
systemctl enable docker
|
||||||
|
systemctl restart docker
|
||||||
|
else
|
||||||
|
error "docker安装失败,请排查原因或手动完成安装在重新运行"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
docker_compose() {
|
||||||
|
if [ -x "$(command -v docker-compose)" ]; then
|
||||||
|
ok "docker-compose已安装"
|
||||||
|
else
|
||||||
|
ing "开始安装docker-compose..."
|
||||||
|
curl -L curl -L https://ghproxy.com/https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-x86_64 > /usr/local/bin/docker-compose
|
||||||
|
chmod +x /usr/local/bin/docker-compose
|
||||||
|
ok "安装docker-compose...完成"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
add_repo() {
|
||||||
|
if [ "$(grep -c "6dylan6/jdpro" $ql_path/data/config/crontab.list)" != 0 ]; then
|
||||||
|
error "您的任务列表中已存在拉库任务,刷新浏览器去执行拉库任务吧!"
|
||||||
|
else
|
||||||
|
ing "开始添加6dylan6/jdpro拉库任务"
|
||||||
|
sed -i 's/RepoFileExtensions.*/RepoFileExtensions=\"js py sh ts\"/g' $ql_path/data/config/config.sh
|
||||||
|
if [ "$(grep -c "token" $ql_path/data/config/auth.json)" != 0 ]; then
|
||||||
|
docker exec -it qinglong /bin/bash -c "token=\$(cat /ql/config/auth.json | jq --raw-output .token) && curl -s -H 'Accept: application/json' -H \"Authorization: Bearer \$token\" -H 'Content-Type: application/json;charset=UTF-8' -H 'Accept-Language: zh-CN,zh;q=0.9' --data-binary '{\"name\":\"拉库\",\"command\":\"ql repo https://ghproxy.com/https://github.com/6dylan6/jdpro.git \\\"jd_|jx_|jddj_\\\" \\\"backUp\\\" \\\"^jd[^_]|USER|JD|function|sendNotify\\\"\",\"schedule\":\"45 7-23/2 * * *\"}' --compressed 'http://127.0.0.1:5700/api/crons?t=1627380635389'"
|
||||||
|
ok "已添加拉库任务,刷新浏览器后去执行拉库任务吧!"
|
||||||
|
else
|
||||||
|
error "未检测到 token,请访问web完成初始化并登陆进去后,在运行一次脚本"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ql_fix() {
|
||||||
|
docker exec -it qinglong /bin/bash -c "grep -lr 'cdn.jsde' /ql/dist/|xargs sed -i 's#cdn.*.net/npm/#unpkg.com/#g'"
|
||||||
|
docker exec -it qinglong /bin/bash -c "grep -lr 'unpkg.com' /ql/dist/ | xargs -I {} sh -c \"gzip -c {} > {}.gz\""
|
||||||
|
docker exec -it qinglong bash -c "curl -so /ql/deps/sendNotify.js https://js.dayplus.xyz/https://raw.githubusercontent.com/6dylan6/jdpro/main/sendNotify.js"
|
||||||
|
}
|
||||||
|
|
||||||
|
ing "开始部署青龙并创建拉库任务,速度根据您的网速决定,请耐心等待....."
|
||||||
|
read -p "按任意键开始部署。。。"
|
||||||
|
docker_install
|
||||||
|
docker_compose
|
||||||
|
ing "开始创建容器,如果长时间卡住 ctrl+c终止后重试!!!"
|
||||||
|
ql_run
|
||||||
|
ql_fix
|
||||||
|
read -p "已初在浏览器始化并登陆青龙了?,那就按任意键继续!"
|
||||||
|
add_repo
|
||||||
|
sleep 2
|
||||||
|
ok "已部署完成,2.11.3版本青龙,数据保存路径为$datav,容器名qinglong,访问地址http://ip:5500"
|
||||||
|
|
|
@ -0,0 +1,959 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
## Build 20220831-001-test
|
||||||
|
## 6dylan6_0212
|
||||||
|
|
||||||
|
name_js=(
|
||||||
|
jd_farm_help
|
||||||
|
jd_farm_help_new
|
||||||
|
#jd_pet
|
||||||
|
jd_plantBean_help
|
||||||
|
#jd_dreamFactory
|
||||||
|
#jd_jdfactory
|
||||||
|
#jd_crazy_joy
|
||||||
|
#jd_jdzz
|
||||||
|
#jd_jxnc
|
||||||
|
#jd_bookshop
|
||||||
|
#jd_cash
|
||||||
|
#jd_sgmh
|
||||||
|
#jd_cfd
|
||||||
|
jd_health
|
||||||
|
#jd_carnivalcity
|
||||||
|
#jd_city
|
||||||
|
#jd_moneyTree
|
||||||
|
#jd_cfdtx
|
||||||
|
)
|
||||||
|
name_config=(
|
||||||
|
Fruit
|
||||||
|
Fruit_new
|
||||||
|
#Pet
|
||||||
|
Bean
|
||||||
|
#DreamFactory
|
||||||
|
#JdFactory
|
||||||
|
#Joy
|
||||||
|
#Jdzz
|
||||||
|
#Jxnc
|
||||||
|
#BookShop
|
||||||
|
#Cash
|
||||||
|
#Sgmh
|
||||||
|
#Cfd
|
||||||
|
Health
|
||||||
|
#Carni
|
||||||
|
#City
|
||||||
|
#MoneyTree
|
||||||
|
#TokenJxnc
|
||||||
|
)
|
||||||
|
name_chinese=(
|
||||||
|
东东农场
|
||||||
|
新农场助力
|
||||||
|
#东东萌宠
|
||||||
|
种豆得豆助力
|
||||||
|
#京喜工厂
|
||||||
|
#东东工厂
|
||||||
|
#crazyJoy任务
|
||||||
|
#京东赚赚
|
||||||
|
#京喜农场
|
||||||
|
#口袋书店
|
||||||
|
#签到领现金
|
||||||
|
#闪购盲盒
|
||||||
|
#京喜财富岛
|
||||||
|
东东健康社区
|
||||||
|
#京东手机狂欢城
|
||||||
|
#城城领现金
|
||||||
|
#摇钱树
|
||||||
|
#京喜token
|
||||||
|
)
|
||||||
|
env_name=(
|
||||||
|
FRUITSHARECODES ## 1、东东农场互助码
|
||||||
|
NEWFRUITSHARECODES ## 1、新东东农场互助码
|
||||||
|
#PETSHARECODES ## 2、东东萌宠互助码
|
||||||
|
PLANT_BEAN_SHARECODES ## 3、种豆得豆互助码
|
||||||
|
#DREAM_FACTORY_SHARE_CODES ## 4、京喜工厂互助码
|
||||||
|
#DDFACTORY_SHARECODES ## 5、东东工厂互助码
|
||||||
|
#JDJOY_SHARECODES ## 6、疯狂的JOY互助码
|
||||||
|
#JDZZ_SHARECODES ## 7、京东赚赚互助码
|
||||||
|
#JXNC_SHARECODES ## 8、京喜农场助力码
|
||||||
|
#BOOKSHOP_SHARECODES ## 9、口袋书店互助码
|
||||||
|
#JD_CASH_SHARECODES ## 10、签到领现金互助码
|
||||||
|
#JDSGMH_SHARECODES ## 11、闪购盲盒互助码
|
||||||
|
#JDCFD_SHARECODES ## 12、京喜财富岛互助码
|
||||||
|
JDHEALTH_SHARECODES ## 13、东东健康社区互助码
|
||||||
|
#JD818_SHARECODES ## 14、京东手机狂欢城互助码
|
||||||
|
#CITY_SHARECODES ## 15、城城领现金互助码
|
||||||
|
#MONEYTREE_SHARECODES ## 16、摇钱树
|
||||||
|
#JXNCTOKENS ## 17、京喜Token(京喜财富岛提现用)
|
||||||
|
)
|
||||||
|
var_name=(
|
||||||
|
ForOtherFruit ## 1、东东农场互助规则
|
||||||
|
ForOtherFruit_new ## 1、东东农场互助规则
|
||||||
|
#ForOtherPet ## 2、东东萌宠互助规则
|
||||||
|
ForOtherBean ## 3、种豆得豆互助规则
|
||||||
|
#ForOtherDreamFactory ## 4、京喜工厂互助规则
|
||||||
|
#ForOtherJdFactory ## 5、东东工厂互助规则
|
||||||
|
#ForOtherJoy ## 6、疯狂的JOY互助规则
|
||||||
|
#ForOtherJdzz ## 7、京东赚赚互助规则
|
||||||
|
#ForOtherJxnc ## 8、京喜农场助力码
|
||||||
|
#ForOtherBookShop ## 9、口袋书店互助规则
|
||||||
|
#ForOtherCash ## 10、签到领现金互助规则
|
||||||
|
#ForOtherSgmh ## 11、闪购盲盒互助规则
|
||||||
|
#ForOtherCfd ## 12、京喜财富岛互助规则
|
||||||
|
ForOtherHealth ## 13、东东健康社区互助规则
|
||||||
|
#ForOtherCarni ## 14、京东手机狂欢城互助规则
|
||||||
|
#ForOtherCity ## 15、城城领现金互助规则
|
||||||
|
#ForOtherMoneyTree ## 16、摇钱树
|
||||||
|
#TokenJxnc ## 17、京喜Token(京喜财富岛提现用)
|
||||||
|
)
|
||||||
|
|
||||||
|
local_scr=$1
|
||||||
|
relative_path="${local_scr%/*}"
|
||||||
|
repo_dir=""
|
||||||
|
sub_dir_scripts="$(ls -l $dir_scripts |awk '/^d/ {print $NF}')"
|
||||||
|
if [[ ! -z ${relative_path} ]] && [[ ${local_scr} =~ "/" ]]; then
|
||||||
|
local_scr_name="$(echo ${local_scr##*/})"
|
||||||
|
if [[ ${relative_path} =~ "$dir_scripts" ]]; then
|
||||||
|
repo_dir="$(echo ${relative_path#$dir_scripts} | awk -F '/' '{print $(NF)}')"
|
||||||
|
local_scr_dir="${relative_path}"
|
||||||
|
elif [[ ${relative_path} =~ "/ql/" ]]; then
|
||||||
|
local_scr_dir="$dir_scripts"
|
||||||
|
else
|
||||||
|
repo_dir="$(echo $local_scr | awk -F '/' '{print $(NF-1)}')"
|
||||||
|
local_scr_dir="$dir_scripts/${repo_dir}"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
local_scr_name=$local_scr
|
||||||
|
local_scr_dir="$dir_scripts"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## 选择python3还是node
|
||||||
|
define_program() {
|
||||||
|
local first_param=$1
|
||||||
|
if [[ $first_param == *.js ]]; then
|
||||||
|
which_program="node"
|
||||||
|
elif [[ $first_param == *.py ]]; then
|
||||||
|
which_program="python3"
|
||||||
|
elif [[ $first_param == *.sh ]]; then
|
||||||
|
which_program="bash"
|
||||||
|
elif [[ $first_param == *.ts ]]; then
|
||||||
|
which_program="ts-node-transpile-only"
|
||||||
|
else
|
||||||
|
which_program=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 定义 json 数据查询工具
|
||||||
|
def_envs_tool(){
|
||||||
|
local i
|
||||||
|
for i in $@; do
|
||||||
|
local token=$(cat $file_auth_user | jq -r .token)
|
||||||
|
if [[ ! -z ${token} ]]; then
|
||||||
|
curl -s --noproxy "*" "http://0.0.0.0:5600/api/envs?searchValue=$i" -H "Authorization: Bearer $token" | jq .data
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
def_json_total(){
|
||||||
|
def_envs_tool $1 | jq .[].$2 | tr -d '[]," '
|
||||||
|
}
|
||||||
|
|
||||||
|
def_json_grep_match(){
|
||||||
|
def_envs_tool $1 | jq .[] | perl -pe '{s|([^}])\n|\1|g}' | grep "$3" | jq .$2 | tr -d '[]," '
|
||||||
|
}
|
||||||
|
|
||||||
|
def_json(){
|
||||||
|
def_envs_tool $1 | jq .[$2].$3 | perl -pe '{s|^"\|"$||g}' | grep -v "null"
|
||||||
|
}
|
||||||
|
|
||||||
|
def_json_match(){
|
||||||
|
if [[ -f $1 ]]; then
|
||||||
|
if [[ $3 && $(cat "$1" | grep "$3") ]]; then
|
||||||
|
cat "$1" | perl -pe '{s|^\[\|\]$||g; s|\n||g; s|\},$|\}\n|g}' | grep "$2" | jq -r .$3 | grep -v "null"
|
||||||
|
else
|
||||||
|
cat "$1" | perl -pe '{s|^\[\|\]$||g; s|\n||g; s|\},$|\}\n|g}' | grep "$2" | grep -v "null"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
def_json_value(){
|
||||||
|
if [[ -f $1 ]]; then
|
||||||
|
if [[ $(cat "$1" | grep "$2") ]]; then
|
||||||
|
cat "$1" | perl -pe "{s|^\[\|\]$||g; s|\n||g; s|\},$|\}\n|g}" | grep "$3" | jq -r .$2 | grep -v "null"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
def_sub(){
|
||||||
|
local i j
|
||||||
|
for i in $(def_json_total $1 $2 | awk '/'$3'/{print NR}'); do
|
||||||
|
j=$((i - 1));
|
||||||
|
echo $j
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
def_sub_value(){
|
||||||
|
local line=$(($3 + 1))
|
||||||
|
def_json_total $1 $2 | awk 'NR=='$line''
|
||||||
|
}
|
||||||
|
|
||||||
|
def_urldecode(){
|
||||||
|
local i
|
||||||
|
for i in $@; do
|
||||||
|
echo $i | awk 'BEGIN{for(i=0;i<10;i++)hex[i]=i;hex["A"]=hex["a"]=10;hex["B"]=hex["b"]=11;hex["C"]=hex["c"]=12;hex["D"]=hex["d"]=13;hex["E"]=hex["e"]=14;hex["F"]=hex["f"]=15;}{gsub(/\+/," ");i=$0;while(match(i,/%../)){;if(RSTART>1);printf"%s",substr(i,1,RSTART-1);printf"%c",hex[substr(i,RSTART+1,1)]*16+hex[substr(i,RSTART+2,1)];i=substr(i,RSTART+RLENGTH);}print i;}'
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
def_pin_sub(){
|
||||||
|
if [[ $@ ]]; then
|
||||||
|
local i j k
|
||||||
|
for i in $@; do
|
||||||
|
for j in $(def_urldecode $(def_json_total JD_COOKIE value | perl -pe "{s|.*pt_pin=([^; ]+)(?=;?).*|\1|}") | awk '/'$i'/{print NR}'); do
|
||||||
|
k=$((j - 1));
|
||||||
|
echo $k
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 字符串 def_urldecode 解密
|
||||||
|
def_urldecode(){
|
||||||
|
for i in $@; do
|
||||||
|
echo $i | awk 'BEGIN{for(i=0;i<10;i++)hex[i]=i;hex["A"]=hex["a"]=10;hex["B"]=hex["b"]=11;hex["C"]=hex["c"]=12;hex["D"]=hex["d"]=13;hex["E"]=hex["e"]=14;hex["F"]=hex["f"]=15;}{gsub(/\+/," ");i=$0;while(match(i,/%../)){;if(RSTART>1);printf"%s",substr(i,1,RSTART-1);printf"%c",hex[substr(i,RSTART+1,1)]*16+hex[substr(i,RSTART+2,1)];i=substr(i,RSTART+RLENGTH);}print i;}'
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# 字符串 urldecode 解密
|
||||||
|
urldecode() {
|
||||||
|
local url_encoded="${1//+/ }"
|
||||||
|
printf '%b' "${url_encoded//%/\\x}"
|
||||||
|
}
|
||||||
|
|
||||||
|
## 生成pt_pin清单
|
||||||
|
gen_pt_pin_array() {
|
||||||
|
## 生成 json 值清单
|
||||||
|
gen_basic_value(){
|
||||||
|
for i in $@; do
|
||||||
|
eval $i='($(def_json_total JD_COOKIE $i | perl -pe "{s| ||g}"))'
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
gen_basic_value value status
|
||||||
|
# 生成JD_COOKIE下标数组
|
||||||
|
ori_sub=(${!value[@]})
|
||||||
|
# 生成序号数组
|
||||||
|
sn=($(def_json_total JD_COOKIE value | awk '{print NR}'))
|
||||||
|
# 生成pin值数组
|
||||||
|
pin=($(def_json_total JD_COOKIE value | perl -pe "{s|.*pt_pin=([^; ]+)(?=;?).*|\1|}"))
|
||||||
|
# 生成非转码pin值数组
|
||||||
|
pt_pin=($(urldecode "${pin[*]}"))
|
||||||
|
#面板 JD_COOKIE 数组
|
||||||
|
ori_array=(${value[@]})
|
||||||
|
#面板 JD_COOKIE 总数
|
||||||
|
ori_user_sum=${#ori_array[@]}
|
||||||
|
|
||||||
|
#剔除已禁用 JD_COOKIE 数组元素
|
||||||
|
for j in $(def_sub JD_COOKIE status 1); do unset ori_array[j]; done
|
||||||
|
|
||||||
|
#本次导出的 JD_COOKIE 数组
|
||||||
|
array=(${ori_array[@]})
|
||||||
|
#本次导出的 JD_COOKIE 总数
|
||||||
|
user_sum=${#array[@]}
|
||||||
|
}
|
||||||
|
|
||||||
|
## 获取用户昵称 API
|
||||||
|
Get_NickName() {
|
||||||
|
local currentTimeStamp=$(date +%s)
|
||||||
|
local cookie=$1
|
||||||
|
local url_1="https://me-api.jd.com/user_new/info/GetJDUserInfoUnion"
|
||||||
|
local url_2="https://wxapp.m.jd.com/kwxhome/myJd/home.json?&useGuideModule=0&bizId=&brandId=&fromType=wxapp×tamp=$currentTimeStamp"
|
||||||
|
local UA_1="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36 Edg/96.0.1054.62"
|
||||||
|
local UA_2="Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.10(0x18000a2a) NetType/WIFI Language/zh_CN"
|
||||||
|
|
||||||
|
local api_1=$(
|
||||||
|
curl -s --connect-timeout 20 --retry 3 --noproxy "*" "$url_1" \
|
||||||
|
-H "Host: me-api.jd.com" \
|
||||||
|
-H "Accept: */*" \
|
||||||
|
-H "Connection: keep-alive" \
|
||||||
|
-H "Cookie: $cookie" \
|
||||||
|
-H "User-Agent: $UA_1" \
|
||||||
|
-H "Accept-Language: zh-cn" \
|
||||||
|
-H "Referer: https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&" \
|
||||||
|
-H "Accept-Encoding: deflate, br"
|
||||||
|
)
|
||||||
|
|
||||||
|
local api_2=$(
|
||||||
|
curl -s --connect-timeout 20 --retry 3 --noproxy "*" "$url_2" \
|
||||||
|
-H "Content-Type: application/x-www-form-urlencoded" \
|
||||||
|
-H "Host: wxapp.m.jd.com" \
|
||||||
|
-H "Connection: keep-alive" \
|
||||||
|
-H "Cookie: $cookie" \
|
||||||
|
-H "User-Agent: $UA_2" \
|
||||||
|
-H "Referer: https://servicewechat.com/wxa5bf5ee667d91626/161/page-frame.html" \
|
||||||
|
-H "Accept-Encoding: compress,deflate, br"
|
||||||
|
)
|
||||||
|
|
||||||
|
retcode=$(echo $api_1 | jq -r .retcode)
|
||||||
|
if [[ $retcode == 0 ]]; then
|
||||||
|
nickname=$(echo $api_1 | jq -r .data | jq -r .userInfo | jq -r .baseInfo | jq -r .nickname)
|
||||||
|
echo -e "$nickname"
|
||||||
|
else
|
||||||
|
code=$(echo $api_2 | jq -r .code)
|
||||||
|
if [[ $code != 999 ]]; then
|
||||||
|
nickname=$(echo $api_2 | jq -r .user | jq -r .petName)
|
||||||
|
echo -e "$nickname"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## 生成用户信息清单
|
||||||
|
gen_uesr_info(){
|
||||||
|
remarks[$1]="$(def_json JD_COOKIE remarks "pin=${pin[$1]};" | head -1)"
|
||||||
|
if [[ ${remarks[$1]} == *@@* ]]; then
|
||||||
|
remarks_name[$1]="($(echo ${remarks[$1]} | awk -F '@@' '{print $1}'))"
|
||||||
|
elif [[ ${remarks[$1]} && ${remarks[$1]} != null ]]; then
|
||||||
|
remarks_name[$1]="(${remarks[$1]})"
|
||||||
|
else
|
||||||
|
remarks_name[$1]="(未备注)"
|
||||||
|
fi
|
||||||
|
tmp_NickName_1=$(Get_NickName "${value[$1]}")
|
||||||
|
[[ -f $CK_WxPusherUid_dir/$CK_WxPusherUid_file ]] && tmp_NickName_2="$(def_json_value "$CK_WxPusherUid_dir/$CK_WxPusherUid_file" NickName "pin=${pin[$1]};")"
|
||||||
|
if [[ $tmp_NickName_1 ]]; then
|
||||||
|
NickName[$1]="$tmp_NickName_1"
|
||||||
|
elif [[ $tmp_NickName_2 ]]; then
|
||||||
|
NickName[$1]="$tmp_NickName_2"
|
||||||
|
else
|
||||||
|
NickName[$1]=""
|
||||||
|
fi
|
||||||
|
[[ ! ${NickName[$1]} || ${NickName[$1]} = null ]] && UserName[$1]=${pin[$1]} || UserName[$1]=${NickName[$1]}
|
||||||
|
ori_full_name[$1]="【${sn[$1]}】${UserName[$1]}${remarks_name[$1]}"
|
||||||
|
full_name[$1]="${ori_full_name[$1]}"
|
||||||
|
[[ $status[$1] = 1 ]] && unset ori_array[$1]
|
||||||
|
}
|
||||||
|
|
||||||
|
redefine_JD_COOKIE(){
|
||||||
|
array=(${ori_array[@]})
|
||||||
|
user_sum=${#array[@]}
|
||||||
|
jd_Cookie="$(echo ${array[@]} | sed 's# #\&#g')"
|
||||||
|
[[ $jd_Cookie ]] && export JD_COOKIE="$jd_Cookie"
|
||||||
|
}
|
||||||
|
|
||||||
|
## 临时禁止账号运行活动脚本
|
||||||
|
TempBlock_CK(){
|
||||||
|
## 按 Cookie 序号禁止账号
|
||||||
|
TempBlock_JD_COOKIE(){
|
||||||
|
## 导入基础 JD_COOKIE 变量
|
||||||
|
local TempBlockCookie TempBlockPin TempDesiPin i j m n p q
|
||||||
|
if [[ $3 ]]; then
|
||||||
|
TempDesiPin="$(def_urldecode $3 | perl -pe "{s|,| |g;}")"
|
||||||
|
i=0
|
||||||
|
for j in $(def_pin_sub $TempDesiPin); do
|
||||||
|
[[ ${status[j]} = 1 ]] && continue
|
||||||
|
TempDesiCKArray[i]=${ori_array[j]}
|
||||||
|
let i++
|
||||||
|
done
|
||||||
|
[[ ${TempDesiCKArray[@]} ]] && ori_array=(${TempDesiCKArray[@]})
|
||||||
|
else
|
||||||
|
[[ $(echo $1 | perl -pe "{s|\D||g;}") ]] && TempBlockCookie="$(eval echo $(echo $1 | perl -pe "{s|~\|-|_|g; s|\W+\|[A-Za-z]+| |g; s|(\d+)_(\d+)|{\1..\2}|g;}"))" || TempBlockCookie=""
|
||||||
|
TempBlockPin="$(def_urldecode $2 | perl -pe "{s|,| |g;}")"
|
||||||
|
for m in $TempBlockCookie; do
|
||||||
|
n=$((m - 1))
|
||||||
|
unset ori_array[n]
|
||||||
|
done
|
||||||
|
for k in $(def_pin_sub $TempBlockPin); do
|
||||||
|
unset ori_array[k]
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
redefine_JD_COOKIE
|
||||||
|
}
|
||||||
|
|
||||||
|
local i j k
|
||||||
|
local initial_user_sum=$user_sum
|
||||||
|
if [[ -n "$(echo $tempblock_ck_envs_num|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
for ((i = 1; i <= $tempblock_ck_envs_num; i++)); do
|
||||||
|
if [ tempblock_ck_envs$i ]; then
|
||||||
|
local tempblock_ck_array=($(eval echo "\$tempblock_ck_envs$i" | perl -pe "{s|&| |g}"))
|
||||||
|
for j in "${tempblock_ck_array[@]}"; do
|
||||||
|
local tmp_task_array=($(echo $j | perl -pe "{s|@| |g}"))
|
||||||
|
local tmp_script_array=($(echo ${tmp_task_array[0]} | perl -pe "{s/\|/ /g}"))
|
||||||
|
for k in ${tmp_script_array[@]}; do
|
||||||
|
if [[ $local_scr == *$k* ]]; then
|
||||||
|
TempBlockCookie="${tmp_task_array[1]}"
|
||||||
|
TempBlockPin=${tmp_task_array[2]}
|
||||||
|
TempDesiPin=${tmp_task_array[3]}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [[ $TempBlockCookie ]] || [[ $TempBlockPin ]] || [[ $TempDesiPin ]]; then
|
||||||
|
TempBlock_JD_COOKIE $TempBlockCookie $TempBlockPin $TempDesiPin
|
||||||
|
fi
|
||||||
|
|
||||||
|
#echo -n "# 当前总共 $ori_user_sum 个 JD_COOKIE"
|
||||||
|
if [[ $ori_user_sum -gt $initial_user_sum ]] && [[ $initial_user_sum -gt $user_sum ]]; then
|
||||||
|
echo -e "已通过环境变量禁用了 $((ori_user_sum - initial_user_sum)) 个 JD_COOKIE,已临时禁止了 $((initial_user_sum - user_sum)) 个 JD_COOKIE。"
|
||||||
|
elif [[ $ori_user_sum -eq $initial_user_sum ]] && [[ $initial_user_sum -gt $user_sum ]]; then
|
||||||
|
echo -e "已临时禁止了 $((initial_user_sum - user_sum)) 个 JD_COOKIE。"
|
||||||
|
elif [[ $ori_user_sum -gt $initial_user_sum ]] && [[ $initial_user_sum -eq $user_sum ]]; then
|
||||||
|
echo -e "已通过环境变量禁用了 $((ori_user_sum - initial_user_sum)) 个 JD_COOKIE。"
|
||||||
|
fi
|
||||||
|
#echo -e ""
|
||||||
|
}
|
||||||
|
|
||||||
|
## 获取用户状态 API
|
||||||
|
Get_CK_Status() {
|
||||||
|
local cookie=$1
|
||||||
|
local url="https://me-api.jd.com/user_new/info/GetJDUserInfoUnion"
|
||||||
|
|
||||||
|
local api=$(
|
||||||
|
curl -s --connect-timeout 30 --retry 3 --noproxy "*" "$url" \
|
||||||
|
-H "Cookie: $cookie" \
|
||||||
|
-H "Referer: https://home.m.jd.com/myJd/home.action"
|
||||||
|
)
|
||||||
|
|
||||||
|
retcode=$(echo $api | jq -r .retcode)
|
||||||
|
if [[ ! $retcode || $retcode = null ]]; then
|
||||||
|
return 2
|
||||||
|
elif [[ $retcode == 0 ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 移除失效的 Cookie
|
||||||
|
remove_void_ck(){
|
||||||
|
if [[ $Remove_Void_CK = 1 ]]; then
|
||||||
|
local i j void_ck_num
|
||||||
|
local initial_user_sum=$user_sum
|
||||||
|
local test_connect="$(curl -I -s --connect-timeout 20 --retry 3 --noproxy "*" https://bean.m.jd.com/bean/signIndex.action -w %{http_code} | tail -n1)"
|
||||||
|
echo -e "# 开始检测 Cookie 的有效性,可能花费一定时间,请耐心等待 ..."
|
||||||
|
echo -e "# 本次一共导入 $user_sum 个 Cookie ,其中:"
|
||||||
|
for ((i=0; i < $ori_user_sum; i ++)); do
|
||||||
|
gen_uesr_info $i
|
||||||
|
Get_CK_Status ${value[i]}
|
||||||
|
[[ $? = 0 ]] && echo -e "# ${full_name[i]} 状态正常"
|
||||||
|
[[ $? = 1 ]] && echo -e "# ${full_name[i]} 已失效" && unset ori_array[i]
|
||||||
|
[[ $? = 2 ]] && echo -e "# ${full_name[i]} 因 API 连接失败跳过检测"
|
||||||
|
done
|
||||||
|
redefine_JD_COOKIE
|
||||||
|
void_ck_num=$((initial_user_sum - user_sum))
|
||||||
|
[[ $void_ck_num = 0 ]] && echo -e "# 未检测到失效 Cookie 。" || echo -e "# 已剔除以上 $void_ck_num 个失效的 Cookie 。"
|
||||||
|
echo -e ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## 重组 CK
|
||||||
|
Recombin_CK(){
|
||||||
|
local i j k m n
|
||||||
|
if [[ -n "$(echo $recombin_ck_envs_num|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
for ((i = 1; i <= $recombin_ck_envs_num; i++)); do
|
||||||
|
if [ recombin_ck_envs$i ]; then
|
||||||
|
local recombin_ck_array=($(eval echo "\$recombin_ck_envs$i" | perl -pe "{s|&| |g}"))
|
||||||
|
#[[ $DEBUG_MODE = 2 ]] &&]]&& echo ${recombin_ck_array[@]}
|
||||||
|
for j in "${recombin_ck_array[@]}"; do
|
||||||
|
local tmp_task_array=($(echo $j | perl -pe "{s|@| |g}"))
|
||||||
|
local tmp_script_array=($(echo ${tmp_task_array[0]} | perl -pe "{s/\|/ /g}"))
|
||||||
|
#[[ $DEBUG_MODE = 1 ]] && echo ${tmp_script_array[@]}
|
||||||
|
for k in "${tmp_script_array[@]}"; do
|
||||||
|
if [[ $local_scr == *$k* ]]; then
|
||||||
|
[[ $DEBUG_MODE = 1 ]] && echo -n "${tmp_script_array[@]}" && echo -e "\n"
|
||||||
|
Recombin_CK_Mode="${tmp_task_array[1]}"
|
||||||
|
[[ $DEBUG_MODE = 1 ]] && eval echo "Recombin_CK_Mode$m : \$Recombin_CK_Mode$m"
|
||||||
|
for ((m = 1; m <= 5; m++)); do
|
||||||
|
n=$((m + 1))
|
||||||
|
eval Recombin_CK_ARG$m="${tmp_task_array[n]}"
|
||||||
|
[[ $DEBUG_MODE = 1 ]] && eval echo "Recombin_CK_ARG$m : \$Recombin_CK_ARG$m"
|
||||||
|
done
|
||||||
|
local temp_status=1
|
||||||
|
[[ $Recombin_CK_Mode = 4 || $Recombin_CK_Mode = 5 ]] && Recombin_CK_cal && break 4 || Recombin_CK_cal
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ ! $temp_status ]] && Recombin_CK_cal
|
||||||
|
}
|
||||||
|
|
||||||
|
## 重组 CK 计算
|
||||||
|
Recombin_CK_cal(){
|
||||||
|
## 随机模式算法
|
||||||
|
combine_random(){
|
||||||
|
local combined_all ran_sub tmp i
|
||||||
|
echo "# 正在应用 随机Cookie 模式..."
|
||||||
|
[[ -n "$(echo $1|sed -n "/^[0-9]\+$/p")" && $1 -le $user_sum ]] && ran_num=$1 || ran_num=$user_sum
|
||||||
|
echo -e "# 当前总共 $user_sum 个有效账号,本次随机抽取 $ran_num 个账号按随机顺序参加活动。"
|
||||||
|
ran_sub="$(seq $user_sum | sort -R | head -$ran_num)"
|
||||||
|
for i in $ran_sub; do
|
||||||
|
j=$((i -1))
|
||||||
|
[[ ! ${array[j]} ]] && continue
|
||||||
|
tmp="${array[j]}"
|
||||||
|
combined_all="$combined_all&$tmp"
|
||||||
|
done
|
||||||
|
jdCookie_4=$(echo $combined_all | sed 's/^&//g')
|
||||||
|
[[ $jdCookie_4 ]] && export JD_COOKIE="$jdCookie_4"
|
||||||
|
#[[ $DEBUG_MODE = 1 ]] && echo $jdCookie_4
|
||||||
|
}
|
||||||
|
|
||||||
|
## 优先模式算法
|
||||||
|
combine_priority(){
|
||||||
|
local combined_all ran_sub jdCookie_priority jdCookie_random m n
|
||||||
|
if [ $1 ]; then
|
||||||
|
# 固定区账号数量
|
||||||
|
[[ -n "$(echo $1|sed -n "/^[0-9]\+$/p")" ]] && fixed_num=$1 || fixed_num="0"
|
||||||
|
if [[ $fixed_num -ge $user_sum ]]; then
|
||||||
|
echo "# 优先固定账号数量不得大于或等于有效账号总量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
elif [[ $fixed_num -eq 0 ]]; then
|
||||||
|
echo "# 未设定优先固定数量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
else
|
||||||
|
echo "# 正在应用 优先Cookie 模式..."
|
||||||
|
echo -e "# 当前总共 $user_sum 个有效账号,其中前 $fixed_num 个账号为固定顺序。\n# 本次从第 $((fixed_num + 1)) 个账号开始按随机顺序参加活动。"
|
||||||
|
ran_sub=$(seq $fixed_num $((ori_user_sum-1)) | sort -R)
|
||||||
|
for ((m = 0; m < $fixed_num; m++)); do
|
||||||
|
[[ ! ${ori_array[m]} ]] && continue
|
||||||
|
tmp="${ori_array[m]}"
|
||||||
|
jdCookie_priority="$jdCookie_priority&$tmp"
|
||||||
|
done
|
||||||
|
for n in $ran_sub; do
|
||||||
|
[[ ! ${ori_array[n]} ]] && continue
|
||||||
|
tmp="${ori_array[n]}"
|
||||||
|
jdCookie_random="$jdCookie_random&$tmp"
|
||||||
|
done
|
||||||
|
combined_all="$jdCookie_priority$jdCookie_random"
|
||||||
|
jdCookie_4=$(echo $combined_all | perl -pe "{s|^&||}")
|
||||||
|
[[ $jdCookie_4 ]] && export JD_COOKIE="$jdCookie_4"
|
||||||
|
#[[ $DEBUG_MODE = 1 ]] && echo $jdCookie_4
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# 由于参数缺失,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## 轮换模式算法
|
||||||
|
combine_rotation(){
|
||||||
|
# 当月总天数
|
||||||
|
local total_days=$(cal | grep ^[0-9] | tail -1 | awk -F " " '{print $NF}')
|
||||||
|
# 今天几号
|
||||||
|
local today_day=$(date +%-d)
|
||||||
|
local combined_all rot_num rot_start_num jdCookie_priority jdCookie_rot_head jdCookie_rot_mid tmp_1 tmp_2 tmp_3 a b c
|
||||||
|
# 固定区账号数量
|
||||||
|
[[ -n "$(echo $1|sed -n "/^[0-9]\+$/p")" ]] && fixed_num=$1 || fixed_num="0"
|
||||||
|
if [[ $fixed_num -ge $ori_user_sum ]]; then
|
||||||
|
echo "# 优先固定账号数量不得大于或等于有效账号总量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
elif [[ $today_day -gt 1 ]]; then
|
||||||
|
echo "# 正在应用 轮换Cookie 模式..."
|
||||||
|
# 轮换区的账号数量
|
||||||
|
local rot_total_num=$((ori_user_sum - fixed_num))
|
||||||
|
if [[ $rot_total_num -gt 2 ]]; then
|
||||||
|
combine_bottom
|
||||||
|
# 每日轮换的账号数量
|
||||||
|
rot_num=$2
|
||||||
|
[[ -z "$(echo $rot_num|sed -n "/^[0-9]\+$/p")" || ! $rot_num || $rot_num -lt 1 || $rot_total_num -lt $rot_num ]] && rot_num=$(((rot_total_num + total_days -1)/total_days)) && [[ $rot_num -lt 1 ]] && rot_num="1"
|
||||||
|
rot_start_num=$((fixed_num + rot_num * ((today_day - 1))))
|
||||||
|
while [[ $ori_user_sum -lt $((rot_start_num + 1)) ]]; do rot_start_num=$((rot_start_num - rot_total_num)); done
|
||||||
|
echo -n "# 当前总共 $user_sum 个有效账号"
|
||||||
|
[[ $fixed_num -gt 0 ]] && echo -n ",其中前 $fixed_num 个账号为固定顺序" || echo -n ",所有账号参与轮换"
|
||||||
|
[[ $user_bottom_sum -gt 0 ]] && echo -e ",有 $user_bottom_sum 个账号固定在末尾。" || echo -e "。"
|
||||||
|
echo -e "# 今天从第 $((rot_start_num + 1)) 位账号开始轮换,轮换频次为:$rot_num 个账号/天。"
|
||||||
|
for ((a = 0; a < fixed_num; a++)); do
|
||||||
|
[[ ! ${ori_array[a]} ]] && continue
|
||||||
|
tmp_1="${ori_array[a]}"
|
||||||
|
jdCookie_priority="$jdCookie_priority&$tmp_1"
|
||||||
|
done
|
||||||
|
for ((b = $rot_start_num; b < $ori_user_sum; b++)); do
|
||||||
|
[[ ! ${ori_array[b]} ]] && continue
|
||||||
|
tmp_2="${ori_array[b]}"
|
||||||
|
jdCookie_rot_head="$jdCookie_rot_head&$tmp_2"
|
||||||
|
done
|
||||||
|
for ((c = $fixed_num; c < $((rot_start_num)); c++)); do
|
||||||
|
[[ ! ${ori_array[c]} ]] && continue
|
||||||
|
tmp_3="${ori_array[c]}"
|
||||||
|
jdCookie_rot_mid="$jdCookie_rot_mid&$tmp_3"
|
||||||
|
done
|
||||||
|
combined_all="$jdCookie_priority$jdCookie_rot_head$jdCookie_rot_mid$jdCookie_bottom"
|
||||||
|
jdCookie_4=$(echo $combined_all | perl -pe "{s|^&||; s|&$||}")
|
||||||
|
[[ $jdCookie_4 ]] && export JD_COOKIE="$jdCookie_4"
|
||||||
|
#[[ $DEBUG_MODE = 1 ]] && echo $jdCookie_4 | sed 's/&/\n/g' > /ql/config/2.txt
|
||||||
|
else
|
||||||
|
echo "# 由于参加轮换的账号数量不足 2 个,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
fi
|
||||||
|
elif [[ $today_day -eq 1 ]]; then
|
||||||
|
echo "# 今天是 1 号,不应用轮换模式,全部 Cookie 按正常顺序参加活动..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## 组队模式算法
|
||||||
|
combine_team(){
|
||||||
|
team_ck(){
|
||||||
|
local tmp combined_tmp combined_all i j k m n
|
||||||
|
for ((i = 0; i < $team_num_total; i++)); do
|
||||||
|
#当前队伍是第几组
|
||||||
|
j=$((i + 1))
|
||||||
|
#发起组队的账号在Cookie数组中的序号
|
||||||
|
k=$((i/team_num))
|
||||||
|
tmp=""
|
||||||
|
combined_tmp=""
|
||||||
|
combined_all=""
|
||||||
|
if [ $i -ne $team_num ]; then
|
||||||
|
for ((m = 1; m < $teamer_num; m++)); do
|
||||||
|
#当前组队的第二账号所在Cookie数组的序号
|
||||||
|
n=$(((teamer_num -1)*i + m)) && [[ $n -ge $ori_user_sum ]] && continue
|
||||||
|
tmp="${array[n]}"
|
||||||
|
combined_tmp="$combined_tmp&$tmp"
|
||||||
|
done
|
||||||
|
combined_all="${array[k]}$combined_tmp"
|
||||||
|
elif [ $i -eq $team_num ]; then
|
||||||
|
for ((m = 1; m < $((teamer_num - 1)); m++)); do
|
||||||
|
#第二账号发起的第一支组队,该队伍中的第三账号所在Cookie数组的序号
|
||||||
|
n=$(((teamer_num -1)*i + m)) && [[ $n -ge $ori_user_sum ]] && continue
|
||||||
|
tmp="${array[n]}"
|
||||||
|
combined_tmp="$combined_tmp&$tmp"
|
||||||
|
done
|
||||||
|
combined_all="${array[k]}&${array[0]}$combined_tmp"
|
||||||
|
fi
|
||||||
|
jdCookie_4=$combined_all
|
||||||
|
if [[ $jdCookie_4 ]]; then
|
||||||
|
export JD_COOKIE="$jdCookie_4"
|
||||||
|
#[[ $DEBUG_MODE = 1 ]] && echo $jdCookie_4
|
||||||
|
echo -e "\n# 本次提交的是第 $j 组账号。"
|
||||||
|
define_program "$local_scr"
|
||||||
|
if [ $temp_status = 3 ]; then
|
||||||
|
$which_program $local_scr_dir/$local_scr_name
|
||||||
|
[[ $interval_time != "0" ]] && echo -e "# 等待 $interval_time 秒后开始进行下一组队任务 ..."
|
||||||
|
sleep $interval_time
|
||||||
|
else
|
||||||
|
$which_program $local_scr_dir/$local_scr_name
|
||||||
|
sleep $delay_time
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
run_js_in_team(){
|
||||||
|
if [[ $teamer_num -ge $user_sum ]]; then
|
||||||
|
echo "# 每组队伍的成员数量不得大于或等于有效账号总数量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
elif [[ $((teamer_num * team_num)) -ge $user_sum ]]; then
|
||||||
|
echo "# 参与组队的总成员数量不得大于或等于有效账号总数量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
else
|
||||||
|
echo "# 正在应用 组队Cookie 模式..."
|
||||||
|
#总组队数量
|
||||||
|
team_num_total=$(((user_sum + teamer_num - 2)/(teamer_num - 1)))
|
||||||
|
#前几个账号发起组队
|
||||||
|
team_num_launch=$(((team_num_total + team_num - 1)/team_num))
|
||||||
|
[[ $team_num -ge $team_num_total ]] && team_num=$team_num_total && [[ $team_num -lt 1 ]] && team_num=1
|
||||||
|
echo -n "# 当前总共 $user_sum 个有效账号,其中前 $team_num_launch 个账号发起组队,每个账号最多可以发起 $team_num 次组队,一共组 $team_num_total 队,每支队伍最多包含 $teamer_num 个账号。"
|
||||||
|
if [[ -n "$(echo $1|perl -pe "{s|\.\|s\|m\|h\|d||g}"|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
temp_status="1"
|
||||||
|
delay_time="$(echo $1|perl -pe "{s|([a-z])(\d)+|\1 \2|g;}")"
|
||||||
|
echo -e "各支队伍启动脚本的延隔时间为`format_time $1`。"
|
||||||
|
elif [[ $1 = 0 ]]; then
|
||||||
|
temp_status="2"
|
||||||
|
delay_time="0"
|
||||||
|
echo -e "所有队伍并发启动脚本,可能会占用较高的系统资源导致卡顿。"
|
||||||
|
elif [[ $1 = "-" ]] && [[ -n "$(echo $2|perl -pe "{s|\.\|s\|m\|h\|d||g}"|sed -n "/^[0-9]\+$/p")" ]] ; then
|
||||||
|
temp_status="3"
|
||||||
|
interval_time="$(echo $2|perl -pe "{s|([a-z])(\d)|\1 \2|g;}")"
|
||||||
|
echo -e "各支队伍启动脚本的间隔时间为`format_time $2`。"
|
||||||
|
else
|
||||||
|
temp_status="3"
|
||||||
|
delay_time="0"
|
||||||
|
interval_time="0"
|
||||||
|
echo -e ""
|
||||||
|
fi
|
||||||
|
team_ck
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
local p q
|
||||||
|
if [[ $1 ]] && [[ $2 ]]; then
|
||||||
|
if [[ $1 = "-" ]] && [[ $2 = "-" ]] && [[ -n "$(echo $5|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
if [[ $5 = 0 ]]; then
|
||||||
|
for p in ${activity_env[@]}; do
|
||||||
|
activity_array=($(echo $p | perl -pe "{s|@| |g}"))
|
||||||
|
teamer_num=${activity_array[0]}
|
||||||
|
team_num=${activity_array[1]}
|
||||||
|
export jd_zdjr_activityId=${activity_array[2]}
|
||||||
|
export jd_zdjr_activityUrl=${activity_array[3]}
|
||||||
|
echo -e "活动 ID (activityId) : $jd_zdjr_activityId"
|
||||||
|
echo -e "活动链接(activityUrl): $jd_zdjr_activityUrl"
|
||||||
|
run_js_in_team $3 $4
|
||||||
|
done
|
||||||
|
elif [[ $5 -gt 0 ]]; then
|
||||||
|
q=$(($5 - 1))
|
||||||
|
activity_array=($(echo ${activity_env[q]} | perl -pe "{s|@| |g}"))
|
||||||
|
teamer_num=${activity_array[0]}
|
||||||
|
team_num=${activity_array[1]}
|
||||||
|
export jd_zdjr_activityId=${activity_array[2]}
|
||||||
|
export jd_zdjr_activityUrl=${activity_array[3]}
|
||||||
|
echo -e "活动 ID (activityId) : $jd_zdjr_activityId"
|
||||||
|
echo -e "活动链接(activityUrl): $jd_zdjr_activityUrl"
|
||||||
|
run_js_in_team $3 $4
|
||||||
|
fi
|
||||||
|
elif [[ -n "$(echo $1|sed -n "/^[0-9]\+$/p")" ]] && [[ -n "$(echo $2|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
# 每组队伍的成员数量
|
||||||
|
teamer_num=$1
|
||||||
|
# 单个账号最多发起的组队数量
|
||||||
|
team_num=$2
|
||||||
|
else
|
||||||
|
# 每组队伍的成员数量
|
||||||
|
teamer_num=$user_sum
|
||||||
|
# 单个账号最多发起的组队数量
|
||||||
|
team_num=1
|
||||||
|
fi
|
||||||
|
run_js_in_team $3 $4
|
||||||
|
else
|
||||||
|
echo "# 由于参数缺失,切换回 正常 Cookie 模式..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## 分段模式算法
|
||||||
|
combine_segmentation(){
|
||||||
|
local delay_time="$3"
|
||||||
|
local interval_time="$4"
|
||||||
|
local jdCookie_priority jdCookie_team_part i j k m n
|
||||||
|
if [[ $1 ]] && [[ $2 ]]; then
|
||||||
|
# 固定区账号数量
|
||||||
|
[[ -n "$(echo $1|sed -n "/^[0-9]\+$/p")" ]] && fixed_num=$1 || fixed_num="0"
|
||||||
|
# 每段账号总数量
|
||||||
|
[[ -n "$(echo $2|sed -n "/^[0-9]\+$/p")" ]] && teamer_total_num=$2 || teamer_total_num=$ori_user_sum
|
||||||
|
if [[ $fixed_num -ge $teamer_total_num ]]; then
|
||||||
|
echo "# 固定账号数量不得大于或等于每段账号总数量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
elif [[ $teamer_total_num -ge $ori_user_sum ]]; then
|
||||||
|
echo "# 分段账号数量不得大于或等于有效账号总数量,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
elif [[ $fixed_num -lt $teamer_total_num ]]; then
|
||||||
|
echo "# 正在应用 分段Cookie 模式..."
|
||||||
|
local teamer_num="$((teamer_total_num - fixed_num))"
|
||||||
|
local team_total_num=$(((ori_user_sum - fixed_num + teamer_num -1)/teamer_num)) && [[ $team_total_num -lt 1 ]] && team_total_num=1
|
||||||
|
echo -n "# 当前总共 $user_sum 个有效账号"
|
||||||
|
[[ $fixed_num -ne 0 ]] && echo -n ",其中前 $fixed_num 个账号为固定顺序"
|
||||||
|
echo -n "。每 $teamer_total_num 个账号分一段,一共分 $team_total_num 段。"
|
||||||
|
if [[ -n "$(echo $3|perl -pe "{s|\.\|s\|m\|h\|d||g}"|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
temp_status="1"
|
||||||
|
delay_time="$(echo $3|perl -pe "{s|([a-z])(\d)+|\1 \2|g;}")"
|
||||||
|
echo -e "各分段启动脚本的延隔时间为`format_time $3`。"
|
||||||
|
echo -e "# 注意:如果每段的运行时间较长且延隔时间设定较短,运行日志可能会显示混乱,此为正常现象。"
|
||||||
|
elif [[ $3 = 0 ]]; then
|
||||||
|
temp_status="2"
|
||||||
|
delay_time="0"
|
||||||
|
echo -e "所有分段并发启动脚本,可能会占用较高的系统资源导致卡顿。"
|
||||||
|
echo -e "# 注意:运行日志会显示混乱,此为正常现象。"
|
||||||
|
elif [[ $3 = "-" ]] && [[ -n "$(echo $4|perl -pe "{s|\.\|s\|m\|h\|d||g}"|sed -n "/^[0-9]\+$/p")" ]] ; then
|
||||||
|
temp_status="3"
|
||||||
|
interval_time="$(echo $4|perl -pe "{s|([a-z])(\d)|\1 \2|g;}")"
|
||||||
|
echo -e ""
|
||||||
|
else
|
||||||
|
temp_status="3"
|
||||||
|
delay_time="0"
|
||||||
|
interval_time="0"
|
||||||
|
echo -e ""
|
||||||
|
fi
|
||||||
|
for ((m = 0; m < $fixed_num; m++)); do
|
||||||
|
[[ ! ${ori_array[m]} ]] && continue
|
||||||
|
tmp="${ori_array[m]}"
|
||||||
|
jdCookie_priority="$jdCookie_priority&$tmp"
|
||||||
|
done
|
||||||
|
for ((i = 0; i < $team_total_num; i++)); do
|
||||||
|
j=$((i + 1))
|
||||||
|
m=$((teamer_num * i + fixed_num))
|
||||||
|
n=$((teamer_num * j + fixed_num))
|
||||||
|
[[ $n -gt $ori_user_sum ]] && n=$ori_user_sum
|
||||||
|
t=$n && [[ $user_sum -lt $t ]] && t=$user_sum
|
||||||
|
jdCookie_team_part=""
|
||||||
|
for ((k = m; k < $t; k++)); do
|
||||||
|
[[ ! ${ori_array[k]} ]] && continue
|
||||||
|
tmp="${ori_array[k]}"
|
||||||
|
jdCookie_team_part="$jdCookie_team_part&$tmp"
|
||||||
|
done
|
||||||
|
jdCookie_4=$(echo $jdCookie_priority$jdCookie_team_part | perl -pe "{s|^&+\|&+$||g}")
|
||||||
|
if [[ $jdCookie_4 ]]; then
|
||||||
|
export JD_COOKIE="$jdCookie_4"
|
||||||
|
#[[ $DEBUG_MODE = 1 ]] && echo $jdCookie_4
|
||||||
|
if [ $fixed_num -ne 0 ]; then
|
||||||
|
if [ $teamer_num -gt 1 ]; then
|
||||||
|
echo -e "\n# 本次提交的是前 $fixed_num 位账号及第 $((m + 1)) - $n 位账号。"
|
||||||
|
elif [ $teamer_num -eq 1 ]; then
|
||||||
|
echo -e "\n# 本次提交的是前 $fixed_num 位账号及第 $((m + 1)) 位账号。"
|
||||||
|
fi
|
||||||
|
elif [ $fixed_num -eq 0 ]; then
|
||||||
|
if [ $teamer_num -gt 1 ]; then
|
||||||
|
echo -e "\n# 本次提交的是第 $((m + 1)) - $n 位账号。"
|
||||||
|
elif [ $teamer_num -eq 1 ]; then
|
||||||
|
echo -e "\n# 本次提交的是第 $((m + 1)) 位账号。"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
define_program "$local_scr"
|
||||||
|
if [ $temp_status = 3 ]; then
|
||||||
|
$which_program $local_scr_dir/$local_scr_name
|
||||||
|
[[ $interval_time != "0" ]] && echo -e "# 等待`format_time $interval_time`后开始进行下一段任务 ..."
|
||||||
|
sleep $interval_time
|
||||||
|
else
|
||||||
|
$which_program $local_scr_dir/$local_scr_name
|
||||||
|
sleep $delay_time
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "# 由于参数缺失,本次暂不重组 Cookie ..."
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## 末尾Cookie
|
||||||
|
combine_bottom(){
|
||||||
|
local array_bottom i
|
||||||
|
if [[ $Bottom_CK && ! $jdCookie_bottom ]]; then
|
||||||
|
bottom_ck="$(def_urldecode $Bottom_CK | perl -pe "{s|,| |g;}")"
|
||||||
|
i=0
|
||||||
|
for j in $(def_pin_sub $bottom_ck); do
|
||||||
|
[[ ! ${ori_array[j]} ]] && continue
|
||||||
|
array_bottom[i]=${ori_array[j]}
|
||||||
|
unset ori_array[j]
|
||||||
|
let i++
|
||||||
|
done
|
||||||
|
jdCookie_bottom="&$(echo ${array_bottom[@]} | sed 's# #\&#g')"
|
||||||
|
user_bottom_sum=${#array_bottom[*]}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 格式化时间
|
||||||
|
format_time(){
|
||||||
|
for i in $@; do
|
||||||
|
if [[ -n "$(echo $i|perl -pe "{s|\.||g}"|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
time_text=" $i 秒"
|
||||||
|
elif [[ -n "$(echo $i|perl -pe "{s|\.\|s\|m\|h\|d||g}"|sed -n "/^[0-9]\+$/p")" ]]; then
|
||||||
|
time_text="$(echo $i|perl -pe "{s|([a-z])(\d)+|\1 \2|g; s|s| 秒|g; s|m| 分|g; s|h| 小时|g; s|d| 天|g; s|^| |g; s|(\d+)$|\1 秒|g;}")"
|
||||||
|
fi
|
||||||
|
echo -n "$time_text"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Cookie 环境变量迭代导入
|
||||||
|
[[ $jdCookie_4 ]] && array=($(echo $jdCookie_4 | sed 's/&/ /g')) && user_sum=${#array[*]}
|
||||||
|
|
||||||
|
case $Recombin_CK_Mode in
|
||||||
|
1)
|
||||||
|
combine_random $Recombin_CK_ARG1
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
combine_priority $Recombin_CK_ARG1
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
combine_rotation $Recombin_CK_ARG1 $Recombin_CK_ARG2
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
combine_team $Recombin_CK_ARG1 $Recombin_CK_ARG2 $Recombin_CK_ARG3 $Recombin_CK_ARG4 $Recombin_CK_ARG5
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
combine_segmentation $Recombin_CK_ARG1 $Recombin_CK_ARG2 $Recombin_CK_ARG3 $Recombin_CK_ARG4
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export JD_COOKIE="$JD_COOKIE"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
## 组合互助码格式化为全局变量的函数
|
||||||
|
combine_sub() {
|
||||||
|
#source $file_env
|
||||||
|
local what_combine=$1
|
||||||
|
local combined_all=""
|
||||||
|
local tmp1 tmp2
|
||||||
|
local TempBlockCookieInterval="$(echo $TempBlockCookie | perl -pe "{s|~|-|; s|_|-|}" | sed 's/\(\d\+\)-\(\d\+\)/{\1..\2}/g')"
|
||||||
|
local TempBlockCookieArray=($(eval echo $TempBlockCookieInterval))
|
||||||
|
local envs=$(eval echo "\$JD_COOKIE")
|
||||||
|
local array=($(echo $envs | sed 's/&/ /g'))
|
||||||
|
local user_sum=${#array[*]}
|
||||||
|
local a b i j t sum combined_all
|
||||||
|
for ((i=1; i <= $user_sum; i++)); do
|
||||||
|
local tmp1=$what_combine$i
|
||||||
|
local tmp2=${!tmp1}
|
||||||
|
[[ ${tmp2} ]] && sum=$i || break
|
||||||
|
done
|
||||||
|
[[ ! $sum ]] && sum=$user_sum
|
||||||
|
for ((j = 1; j <= $sum; j++)); do
|
||||||
|
a=$temp_user_sum
|
||||||
|
b=$sum
|
||||||
|
if [[ $a -ne $b ]]; then
|
||||||
|
for ((t = 0; t < ${#TempBlockCookieArray[*]}; t++)); do
|
||||||
|
[[ "${TempBlockCookieArray[t]}" = "$j" ]] && continue 2
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
local tmp1=$what_combine$j
|
||||||
|
local tmp2=${!tmp1}
|
||||||
|
combined_all="$combined_all&$tmp2"
|
||||||
|
done
|
||||||
|
echo $combined_all | perl -pe "{s|^&||; s|^@+||; s|&@|&|g; s|@+&|&|g; s|@+|@|g; s|@+$||}"
|
||||||
|
}
|
||||||
|
|
||||||
|
## 正常依次运行时,组合互助码格式化为全局变量
|
||||||
|
combine_all() {
|
||||||
|
for ((i = 0; i < ${#env_name[*]}; i++)); do
|
||||||
|
result=$(combine_sub ${var_name[i]})
|
||||||
|
if [[ $result ]]; then
|
||||||
|
export ${env_name[i]}="$result"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
## 正常依次运行时,组合互助码格式化为全局变量
|
||||||
|
combine_only() {
|
||||||
|
for ((i = 0; i < ${#env_name[*]}; i++)); do
|
||||||
|
case $local_scr in
|
||||||
|
*${name_js[i]}*.js | *${name_js[i]}*.ts)
|
||||||
|
if [[ -f $dir_log/.ShareCode/${name_config[i]}.log ]]; then
|
||||||
|
. $dir_log/.ShareCode/${name_config[i]}.log
|
||||||
|
result=$(combine_sub ${var_name[i]})
|
||||||
|
if [[ $result ]]; then
|
||||||
|
export ShareCodeConfigChineseName=${name_chinese[i]}
|
||||||
|
export ShareCodeConfigName=${name_config[i]}
|
||||||
|
export ShareCodeEnvName=${env_name[i]}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export ${env_name[i]}=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
## 提前替换js基础依赖
|
||||||
|
JS_Deps_Replace() {
|
||||||
|
if [ $js_deps_replace_envs ]; then
|
||||||
|
local js_deps_replace_array=($(echo $js_deps_replace_envs | perl -pe "{s|&| |g}"))
|
||||||
|
for i in "${js_deps_replace_array[@]}"; do
|
||||||
|
local tmp_task_array=($(echo $i | perl -pe "{s|@| |g}"))
|
||||||
|
local tmp_script_array=($(echo ${tmp_task_array[0]} | perl -pe "{s/\|/ /g}"))
|
||||||
|
local tmp_skip_repo=($(echo ${tmp_task_array[1]} | perl -pe "{s/\|/ /g}"))
|
||||||
|
for j in "${tmp_script_array[@]}"; do
|
||||||
|
[[ ! $repo_dir ]] || [[ $repo_dir && ! ${tmp_skip_repo[@]} =~ $repo_dir ]] && [[ -f $dir_config/$j.js && $local_scr_dir ]] && cp -rf $dir_config/$j.js $local_scr_dir/$j.js
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
[[ -f $dir_scripts/CK_WxPusherUid.json && $local_scr_dir && $local_scr_dir != $dir_scripts ]] && cp -rf $dir_scripts/CK_WxPusherUid.json $local_scr_dir/CK_WxPusherUid.json
|
||||||
|
#source $file_env
|
||||||
|
gen_pt_pin_array
|
||||||
|
#JS_Deps_Replace
|
||||||
|
TempBlock_CK
|
||||||
|
#remove_void_ck
|
||||||
|
if [[ $* != *desi* && $* != *conc* ]];then
|
||||||
|
Recombin_CK
|
||||||
|
fi
|
||||||
|
combine_only
|
|
@ -0,0 +1,539 @@
|
||||||
|
const https = require('https');
|
||||||
|
const http = require('http');
|
||||||
|
const stream = require('stream');
|
||||||
|
const zlib = require('zlib');
|
||||||
|
const vm = require('vm');
|
||||||
|
const PNG = require('png-js');
|
||||||
|
let UA = `jdapp;iPhone;10.1.0;14.3;${randomString(40)};network/wifi;model/iPhone12,1;addressid/4199175193;appBuild/167774;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1`;
|
||||||
|
const validatorCount = process.env.JDJR_validator_Count ? process.env.JDJR_validator_Count : 100
|
||||||
|
|
||||||
|
function randomString(e) {
|
||||||
|
e = e || 32;
|
||||||
|
let t = "abcdef0123456789", a = t.length, n = "";
|
||||||
|
for (i = 0; i < e; i++)
|
||||||
|
n += t.charAt(Math.floor(Math.random() * a));
|
||||||
|
return n
|
||||||
|
}
|
||||||
|
|
||||||
|
Math.avg = function average() {
|
||||||
|
var sum = 0;
|
||||||
|
var len = this.length;
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
sum += this[i];
|
||||||
|
}
|
||||||
|
return sum / len;
|
||||||
|
};
|
||||||
|
|
||||||
|
function sleep(timeout) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, timeout));
|
||||||
|
}
|
||||||
|
|
||||||
|
class PNGDecoder extends PNG {
|
||||||
|
constructor(args) {
|
||||||
|
super(args);
|
||||||
|
this.pixels = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
decodeToPixels() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.decode((pixels) => {
|
||||||
|
this.pixels = pixels;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getImageData(x, y, w, h) {
|
||||||
|
const {pixels} = this;
|
||||||
|
const len = w * h * 4;
|
||||||
|
const startIndex = x * 4 + y * (w * 4);
|
||||||
|
|
||||||
|
return {data: pixels.slice(startIndex, startIndex + len)};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const PUZZLE_GAP = 8;
|
||||||
|
const PUZZLE_PAD = 10;
|
||||||
|
|
||||||
|
class PuzzleRecognizer {
|
||||||
|
constructor(bg, patch, y) {
|
||||||
|
// console.log(bg);
|
||||||
|
const imgBg = new PNGDecoder(Buffer.from(bg, 'base64'));
|
||||||
|
const imgPatch = new PNGDecoder(Buffer.from(patch, 'base64'));
|
||||||
|
|
||||||
|
// console.log(imgBg);
|
||||||
|
|
||||||
|
this.bg = imgBg;
|
||||||
|
this.patch = imgPatch;
|
||||||
|
this.rawBg = bg;
|
||||||
|
this.rawPatch = patch;
|
||||||
|
this.y = y;
|
||||||
|
this.w = imgBg.width;
|
||||||
|
this.h = imgBg.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
async run() {
|
||||||
|
await this.bg.decodeToPixels();
|
||||||
|
await this.patch.decodeToPixels();
|
||||||
|
|
||||||
|
return this.recognize();
|
||||||
|
}
|
||||||
|
|
||||||
|
recognize() {
|
||||||
|
const {ctx, w: width, bg} = this;
|
||||||
|
const {width: patchWidth, height: patchHeight} = this.patch;
|
||||||
|
const posY = this.y + PUZZLE_PAD + ((patchHeight - PUZZLE_PAD) / 2) - (PUZZLE_GAP / 2);
|
||||||
|
// const cData = ctx.getImageData(0, a.y + 10 + 20 - 4, 360, 8).data;
|
||||||
|
const cData = bg.getImageData(0, posY, width, PUZZLE_GAP).data;
|
||||||
|
const lumas = [];
|
||||||
|
|
||||||
|
for (let x = 0; x < width; x++) {
|
||||||
|
var sum = 0;
|
||||||
|
|
||||||
|
// y xais
|
||||||
|
for (let y = 0; y < PUZZLE_GAP; y++) {
|
||||||
|
var idx = x * 4 + y * (width * 4);
|
||||||
|
var r = cData[idx];
|
||||||
|
var g = cData[idx + 1];
|
||||||
|
var b = cData[idx + 2];
|
||||||
|
var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
|
||||||
|
sum += luma;
|
||||||
|
}
|
||||||
|
|
||||||
|
lumas.push(sum / PUZZLE_GAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = 2; // minium macroscopic image width (px)
|
||||||
|
const margin = patchWidth - PUZZLE_PAD;
|
||||||
|
const diff = 20; // macroscopic brightness difference
|
||||||
|
const radius = PUZZLE_PAD;
|
||||||
|
for (let i = 0, len = lumas.length - 2 * 4; i < len; i++) {
|
||||||
|
const left = (lumas[i] + lumas[i + 1]) / n;
|
||||||
|
const right = (lumas[i + 2] + lumas[i + 3]) / n;
|
||||||
|
const mi = margin + i;
|
||||||
|
const mLeft = (lumas[mi] + lumas[mi + 1]) / n;
|
||||||
|
const mRigth = (lumas[mi + 2] + lumas[mi + 3]) / n;
|
||||||
|
|
||||||
|
if (left - right > diff && mLeft - mRigth < -diff) {
|
||||||
|
const pieces = lumas.slice(i + 2, margin + i + 2);
|
||||||
|
const median = pieces.sort((x1, x2) => x1 - x2)[20];
|
||||||
|
const avg = Math.avg(pieces);
|
||||||
|
|
||||||
|
// noise reducation
|
||||||
|
if (median > left || median > mRigth) return;
|
||||||
|
if (avg > 100) return;
|
||||||
|
// console.table({left,right,mLeft,mRigth,median});
|
||||||
|
// ctx.fillRect(i+n-radius, 0, 1, 360);
|
||||||
|
// console.log(i+n-radius);
|
||||||
|
return i + n - radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
runWithCanvas() {
|
||||||
|
const {createCanvas, Image} = require('canvas');
|
||||||
|
const canvas = createCanvas();
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
const imgBg = new Image();
|
||||||
|
const imgPatch = new Image();
|
||||||
|
const prefix = 'data:image/png;base64,';
|
||||||
|
|
||||||
|
imgBg.src = prefix + this.rawBg;
|
||||||
|
imgPatch.src = prefix + this.rawPatch;
|
||||||
|
const {naturalWidth: w, naturalHeight: h} = imgBg;
|
||||||
|
canvas.width = w;
|
||||||
|
canvas.height = h;
|
||||||
|
ctx.clearRect(0, 0, w, h);
|
||||||
|
ctx.drawImage(imgBg, 0, 0, w, h);
|
||||||
|
|
||||||
|
const width = w;
|
||||||
|
const {naturalWidth, naturalHeight} = imgPatch;
|
||||||
|
const posY = this.y + PUZZLE_PAD + ((naturalHeight - PUZZLE_PAD) / 2) - (PUZZLE_GAP / 2);
|
||||||
|
// const cData = ctx.getImageData(0, a.y + 10 + 20 - 4, 360, 8).data;
|
||||||
|
const cData = ctx.getImageData(0, posY, width, PUZZLE_GAP).data;
|
||||||
|
const lumas = [];
|
||||||
|
|
||||||
|
for (let x = 0; x < width; x++) {
|
||||||
|
var sum = 0;
|
||||||
|
|
||||||
|
// y xais
|
||||||
|
for (let y = 0; y < PUZZLE_GAP; y++) {
|
||||||
|
var idx = x * 4 + y * (width * 4);
|
||||||
|
var r = cData[idx];
|
||||||
|
var g = cData[idx + 1];
|
||||||
|
var b = cData[idx + 2];
|
||||||
|
var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
|
||||||
|
sum += luma;
|
||||||
|
}
|
||||||
|
|
||||||
|
lumas.push(sum / PUZZLE_GAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
const n = 2; // minium macroscopic image width (px)
|
||||||
|
const margin = naturalWidth - PUZZLE_PAD;
|
||||||
|
const diff = 20; // macroscopic brightness difference
|
||||||
|
const radius = PUZZLE_PAD;
|
||||||
|
for (let i = 0, len = lumas.length - 2 * 4; i < len; i++) {
|
||||||
|
const left = (lumas[i] + lumas[i + 1]) / n;
|
||||||
|
const right = (lumas[i + 2] + lumas[i + 3]) / n;
|
||||||
|
const mi = margin + i;
|
||||||
|
const mLeft = (lumas[mi] + lumas[mi + 1]) / n;
|
||||||
|
const mRigth = (lumas[mi + 2] + lumas[mi + 3]) / n;
|
||||||
|
|
||||||
|
if (left - right > diff && mLeft - mRigth < -diff) {
|
||||||
|
const pieces = lumas.slice(i + 2, margin + i + 2);
|
||||||
|
const median = pieces.sort((x1, x2) => x1 - x2)[20];
|
||||||
|
const avg = Math.avg(pieces);
|
||||||
|
|
||||||
|
// noise reducation
|
||||||
|
if (median > left || median > mRigth) return;
|
||||||
|
if (avg > 100) return;
|
||||||
|
// console.table({left,right,mLeft,mRigth,median});
|
||||||
|
// ctx.fillRect(i+n-radius, 0, 1, 360);
|
||||||
|
// console.log(i+n-radius);
|
||||||
|
return i + n - radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const DATA = {
|
||||||
|
"appId": "17839d5db83",
|
||||||
|
"product": "embed",
|
||||||
|
"lang": "zh_CN",
|
||||||
|
};
|
||||||
|
const SERVER = 'iv.jd.com';
|
||||||
|
|
||||||
|
class JDJRValidator {
|
||||||
|
constructor() {
|
||||||
|
this.data = {};
|
||||||
|
this.x = 0;
|
||||||
|
this.t = Date.now();
|
||||||
|
this.count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(scene = 'cww', eid='') {
|
||||||
|
const tryRecognize = async () => {
|
||||||
|
const x = await this.recognize(scene, eid);
|
||||||
|
|
||||||
|
if (x > 0) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
// retry
|
||||||
|
return await tryRecognize();
|
||||||
|
};
|
||||||
|
const puzzleX = await tryRecognize();
|
||||||
|
// console.log(puzzleX);
|
||||||
|
const pos = new MousePosFaker(puzzleX).run();
|
||||||
|
const d = getCoordinate(pos);
|
||||||
|
|
||||||
|
// console.log(pos[pos.length-1][2] -Date.now());
|
||||||
|
// await sleep(4500);
|
||||||
|
await sleep(pos[pos.length - 1][2] - Date.now());
|
||||||
|
this.count++;
|
||||||
|
const result = await JDJRValidator.jsonp('/slide/s.html', {d, ...this.data}, scene);
|
||||||
|
|
||||||
|
if (result.message === 'success') {
|
||||||
|
// console.log(result);
|
||||||
|
console.log('JDJR验证用时: %fs', (Date.now() - this.t) / 1000);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
console.log(`验证失败: ${this.count}/${validatorCount}`);
|
||||||
|
// console.log(JSON.stringify(result));
|
||||||
|
if(this.count >= validatorCount){
|
||||||
|
console.log("JDJR验证次数已达上限,退出验证");
|
||||||
|
return result;
|
||||||
|
}else{
|
||||||
|
await sleep(300);
|
||||||
|
return await this.run(scene, eid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async recognize(scene, eid) {
|
||||||
|
const data = await JDJRValidator.jsonp('/slide/g.html', {e: eid}, scene);
|
||||||
|
const {bg, patch, y} = data;
|
||||||
|
// const uri = 'data:image/png;base64,';
|
||||||
|
// const re = new PuzzleRecognizer(uri+bg, uri+patch, y);
|
||||||
|
const re = new PuzzleRecognizer(bg, patch, y);
|
||||||
|
// console.log(JSON.stringify(re))
|
||||||
|
const puzzleX = await re.run();
|
||||||
|
|
||||||
|
if (puzzleX > 0) {
|
||||||
|
this.data = {
|
||||||
|
c: data.challenge,
|
||||||
|
w: re.w,
|
||||||
|
e: eid,
|
||||||
|
s: '',
|
||||||
|
o: '',
|
||||||
|
};
|
||||||
|
this.x = puzzleX;
|
||||||
|
}
|
||||||
|
return puzzleX;
|
||||||
|
}
|
||||||
|
|
||||||
|
async report(n) {
|
||||||
|
console.time('PuzzleRecognizer');
|
||||||
|
let count = 0;
|
||||||
|
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const x = await this.recognize();
|
||||||
|
|
||||||
|
if (x > 0) count++;
|
||||||
|
if (i % 50 === 0) {
|
||||||
|
// console.log('%f\%', (i / n) * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('验证成功: %f\%', (count / n) * 100);
|
||||||
|
console.clear()
|
||||||
|
console.timeEnd('PuzzleRecognizer');
|
||||||
|
}
|
||||||
|
|
||||||
|
static jsonp(api, data = {}, scene) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const fnId = `jsonp_${String(Math.random()).replace('.', '')}`;
|
||||||
|
const extraData = {callback: fnId};
|
||||||
|
const query = new URLSearchParams({...DATA,...{"scene": scene}, ...extraData, ...data}).toString();
|
||||||
|
const url = `https://${SERVER}${api}?${query}`;
|
||||||
|
const headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Encoding': 'gzip,deflate,br',
|
||||||
|
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Host': "iv.jd.com",
|
||||||
|
'Proxy-Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://h5.m.jd.com/',
|
||||||
|
'User-Agent': UA,
|
||||||
|
};
|
||||||
|
|
||||||
|
const req = https.get(url, {headers}, (response) => {
|
||||||
|
let res = response;
|
||||||
|
if (res.headers['content-encoding'] === 'gzip') {
|
||||||
|
const unzipStream = new stream.PassThrough();
|
||||||
|
stream.pipeline(
|
||||||
|
response,
|
||||||
|
zlib.createGunzip(),
|
||||||
|
unzipStream,
|
||||||
|
reject,
|
||||||
|
);
|
||||||
|
res = unzipStream;
|
||||||
|
}
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
|
||||||
|
let rawData = '';
|
||||||
|
|
||||||
|
res.on('data', (chunk) => rawData += chunk);
|
||||||
|
res.on('end', () => {
|
||||||
|
try {
|
||||||
|
const ctx = {
|
||||||
|
[fnId]: (data) => ctx.data = data,
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.createContext(ctx);
|
||||||
|
vm.runInContext(rawData, ctx);
|
||||||
|
|
||||||
|
// console.log(ctx.data);
|
||||||
|
res.resume();
|
||||||
|
resolve(ctx.data);
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', reject);
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCoordinate(c) {
|
||||||
|
function string10to64(d) {
|
||||||
|
var c = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~".split("")
|
||||||
|
, b = c.length
|
||||||
|
, e = +d
|
||||||
|
, a = [];
|
||||||
|
do {
|
||||||
|
mod = e % b;
|
||||||
|
e = (e - mod) / b;
|
||||||
|
a.unshift(c[mod])
|
||||||
|
} while (e);
|
||||||
|
return a.join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
function prefixInteger(a, b) {
|
||||||
|
return (Array(b).join(0) + a).slice(-b)
|
||||||
|
}
|
||||||
|
|
||||||
|
function pretreatment(d, c, b) {
|
||||||
|
var e = string10to64(Math.abs(d));
|
||||||
|
var a = "";
|
||||||
|
if (!b) {
|
||||||
|
a += (d > 0 ? "1" : "0")
|
||||||
|
}
|
||||||
|
a += prefixInteger(e, c);
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
|
||||||
|
var b = new Array();
|
||||||
|
for (var e = 0; e < c.length; e++) {
|
||||||
|
if (e == 0) {
|
||||||
|
b.push(pretreatment(c[e][0] < 262143 ? c[e][0] : 262143, 3, true));
|
||||||
|
b.push(pretreatment(c[e][1] < 16777215 ? c[e][1] : 16777215, 4, true));
|
||||||
|
b.push(pretreatment(c[e][2] < 4398046511103 ? c[e][2] : 4398046511103, 7, true))
|
||||||
|
} else {
|
||||||
|
var a = c[e][0] - c[e - 1][0];
|
||||||
|
var f = c[e][1] - c[e - 1][1];
|
||||||
|
var d = c[e][2] - c[e - 1][2];
|
||||||
|
b.push(pretreatment(a < 4095 ? a : 4095, 2, false));
|
||||||
|
b.push(pretreatment(f < 4095 ? f : 4095, 2, false));
|
||||||
|
b.push(pretreatment(d < 16777215 ? d : 16777215, 4, true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
const HZ = 20;
|
||||||
|
|
||||||
|
class MousePosFaker {
|
||||||
|
constructor(puzzleX) {
|
||||||
|
this.x = parseInt(Math.random() * 20 + 20, 10);
|
||||||
|
this.y = parseInt(Math.random() * 80 + 80, 10);
|
||||||
|
this.t = Date.now();
|
||||||
|
this.pos = [[this.x, this.y, this.t]];
|
||||||
|
this.minDuration = parseInt(1000 / HZ, 10);
|
||||||
|
// this.puzzleX = puzzleX;
|
||||||
|
this.puzzleX = puzzleX + parseInt(Math.random() * 2 - 1, 10);
|
||||||
|
|
||||||
|
this.STEP = parseInt(Math.random() * 6 + 5, 10);
|
||||||
|
this.DURATION = parseInt(Math.random() * 7 + 14, 10) * 100;
|
||||||
|
// [9,1600] [10,1400]
|
||||||
|
this.STEP = 9;
|
||||||
|
// this.DURATION = 2000;
|
||||||
|
// console.log(this.STEP, this.DURATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
run() {
|
||||||
|
const perX = this.puzzleX / this.STEP;
|
||||||
|
const perDuration = this.DURATION / this.STEP;
|
||||||
|
const firstPos = [this.x - parseInt(Math.random() * 6, 10), this.y + parseInt(Math.random() * 11, 10), this.t];
|
||||||
|
|
||||||
|
this.pos.unshift(firstPos);
|
||||||
|
this.stepPos(perX, perDuration);
|
||||||
|
this.fixPos();
|
||||||
|
|
||||||
|
const reactTime = parseInt(60 + Math.random() * 100, 10);
|
||||||
|
const lastIdx = this.pos.length - 1;
|
||||||
|
const lastPos = [this.pos[lastIdx][0], this.pos[lastIdx][1], this.pos[lastIdx][2] + reactTime];
|
||||||
|
|
||||||
|
this.pos.push(lastPos);
|
||||||
|
return this.pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
stepPos(x, duration) {
|
||||||
|
let n = 0;
|
||||||
|
const sqrt2 = Math.sqrt(2);
|
||||||
|
for (let i = 1; i <= this.STEP; i++) {
|
||||||
|
n += 1 / i;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < this.STEP; i++) {
|
||||||
|
x = this.puzzleX / (n * (i + 1));
|
||||||
|
const currX = parseInt((Math.random() * 30 - 15) + x, 10);
|
||||||
|
const currY = parseInt(Math.random() * 7 - 3, 10);
|
||||||
|
const currDuration = parseInt((Math.random() * 0.4 + 0.8) * duration, 10);
|
||||||
|
|
||||||
|
this.moveToAndCollect({
|
||||||
|
x: currX,
|
||||||
|
y: currY,
|
||||||
|
duration: currDuration,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fixPos() {
|
||||||
|
const actualX = this.pos[this.pos.length - 1][0] - this.pos[1][0];
|
||||||
|
const deviation = this.puzzleX - actualX;
|
||||||
|
|
||||||
|
if (Math.abs(deviation) > 4) {
|
||||||
|
this.moveToAndCollect({
|
||||||
|
x: deviation,
|
||||||
|
y: parseInt(Math.random() * 8 - 3, 10),
|
||||||
|
duration: 250,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
moveToAndCollect({x, y, duration}) {
|
||||||
|
let movedX = 0;
|
||||||
|
let movedY = 0;
|
||||||
|
let movedT = 0;
|
||||||
|
const times = duration / this.minDuration;
|
||||||
|
let perX = x / times;
|
||||||
|
let perY = y / times;
|
||||||
|
let padDuration = 0;
|
||||||
|
|
||||||
|
if (Math.abs(perX) < 1) {
|
||||||
|
padDuration = duration / Math.abs(x) - this.minDuration;
|
||||||
|
perX = 1;
|
||||||
|
perY = y / Math.abs(x);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (Math.abs(movedX) < Math.abs(x)) {
|
||||||
|
const rDuration = parseInt(padDuration + Math.random() * 16 - 4, 10);
|
||||||
|
|
||||||
|
movedX += perX + Math.random() * 2 - 1;
|
||||||
|
movedY += perY;
|
||||||
|
movedT += this.minDuration + rDuration;
|
||||||
|
|
||||||
|
const currX = parseInt(this.x + movedX, 10);
|
||||||
|
const currY = parseInt(this.y + movedY, 10);
|
||||||
|
const currT = this.t + movedT;
|
||||||
|
|
||||||
|
this.pos.push([currX, currY, currT]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.x += x;
|
||||||
|
this.y += y;
|
||||||
|
this.t += Math.max(duration, movedT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function injectToRequest(fn,scene = 'cww', ua = '') {
|
||||||
|
if(ua) UA = ua
|
||||||
|
return (opts, cb) => {
|
||||||
|
fn(opts, async (err, resp, data) => {
|
||||||
|
if (err) {
|
||||||
|
console.error(JSON.stringify(err));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data.search('验证') > -1) {
|
||||||
|
console.log('JDJR验证中......');
|
||||||
|
let arr = opts.url.split("&")
|
||||||
|
let eid = ''
|
||||||
|
for(let i of arr){
|
||||||
|
if(i.indexOf("eid=")>-1){
|
||||||
|
eid = i.split("=") && i.split("=")[1] || ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const res = await new JDJRValidator().run(scene, eid);
|
||||||
|
|
||||||
|
opts.url += `&validate=${res.validate}`;
|
||||||
|
fn(opts, cb);
|
||||||
|
} else {
|
||||||
|
cb(err, resp, data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.injectToRequest = injectToRequest;
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,270 @@
|
||||||
|
let request = require('request');
|
||||||
|
let CryptoJS = require('crypto-js');
|
||||||
|
let qs = require('querystring');
|
||||||
|
let urls = require('url');
|
||||||
|
let path = require('path');
|
||||||
|
let notify = require('./sendNotify');
|
||||||
|
let mainEval = require("./eval");
|
||||||
|
let assert = require('assert');
|
||||||
|
let jxAlgo = require("./jxAlgo");
|
||||||
|
let config = require("./config");
|
||||||
|
let user = {}
|
||||||
|
try {
|
||||||
|
user = require("./user")
|
||||||
|
} catch (e) {}
|
||||||
|
class env {
|
||||||
|
constructor(name) {
|
||||||
|
this.config = { ...config,
|
||||||
|
...process.env,
|
||||||
|
...user,
|
||||||
|
};
|
||||||
|
this.name = name;
|
||||||
|
this.message = [];
|
||||||
|
this.sharecode = [];
|
||||||
|
this.code = [];
|
||||||
|
this.timestamp = new Date().getTime();
|
||||||
|
this.time = this.start = parseInt(this.timestamp / 1000);
|
||||||
|
this.options = {
|
||||||
|
'headers': {}
|
||||||
|
};
|
||||||
|
console.log(`\n🔔${this.name}, 开始!\n`)
|
||||||
|
console.log(`=========== 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString()} ===========\n`)
|
||||||
|
}
|
||||||
|
done() {
|
||||||
|
let timestamp = new Date().getTime();
|
||||||
|
let work = ((timestamp - this.timestamp) / 1000).toFixed(2)
|
||||||
|
console.log(`=========================脚本执行完成,耗时${work}s============================\n`)
|
||||||
|
console.log(`🔔${this.name}, 结束!\n`)
|
||||||
|
}
|
||||||
|
notify(array) {
|
||||||
|
let text = '';
|
||||||
|
for (let i of array) {
|
||||||
|
text += `${i.user} -- ${i.msg}\n`
|
||||||
|
}
|
||||||
|
console.log(`\n=============================开始发送提醒消息=============================`)
|
||||||
|
notify.sendNotify(this.name + "消息提醒", text)
|
||||||
|
}
|
||||||
|
wait(t) {
|
||||||
|
return new Promise(e => setTimeout(e, t))
|
||||||
|
}
|
||||||
|
setOptions(params) {
|
||||||
|
this.options = params;
|
||||||
|
}
|
||||||
|
setCookie(cookie) {
|
||||||
|
this.options.headers.cookie = cookie
|
||||||
|
}
|
||||||
|
jsonParse(str) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str);
|
||||||
|
} catch (e) {
|
||||||
|
try {
|
||||||
|
let data = this.match([/try\s*\{\w+\s*\(([^\)]+)/, /\w+\s*\(([^\)]+)/], str)
|
||||||
|
return JSON.parse(data);
|
||||||
|
} catch (ee) {
|
||||||
|
try {
|
||||||
|
let cb = this.match(/try\s*\{\s*(\w+)/, str)
|
||||||
|
if (cb) {
|
||||||
|
let func = "";
|
||||||
|
let data = str.replace(cb, `func=`)
|
||||||
|
eval(data);
|
||||||
|
return func
|
||||||
|
}
|
||||||
|
} catch (eee) {
|
||||||
|
return str
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
curl(params, extra = '') {
|
||||||
|
if (typeof(params) != 'object') {
|
||||||
|
params = {
|
||||||
|
'url': params
|
||||||
|
}
|
||||||
|
}
|
||||||
|
params = Object.assign({ ...this.options
|
||||||
|
}, params);
|
||||||
|
params.method = params.body ? 'POST' : 'GET';
|
||||||
|
if (params.hasOwnProperty('cookie')) {
|
||||||
|
params.headers.cookie = params.cookie
|
||||||
|
}
|
||||||
|
if (params.hasOwnProperty('ua') || params.hasOwnProperty('useragent')) {
|
||||||
|
params.headers['user-agent'] = params.ua
|
||||||
|
}
|
||||||
|
if (params.hasOwnProperty('referer')) {
|
||||||
|
params.headers.referer = params.referer
|
||||||
|
}
|
||||||
|
if (params.hasOwnProperty('params')) {
|
||||||
|
params.url += '?' + qs.stringify(params.params)
|
||||||
|
}
|
||||||
|
if (params.hasOwnProperty('form')) {
|
||||||
|
params.method = 'POST'
|
||||||
|
}
|
||||||
|
return new Promise(resolve => {
|
||||||
|
request(params, async (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (params.console) {
|
||||||
|
console.log(data)
|
||||||
|
}
|
||||||
|
this.source = this.jsonParse(data);
|
||||||
|
if (extra) {
|
||||||
|
this[extra] = this.source
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e, resp)
|
||||||
|
} finally {
|
||||||
|
resolve(data);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
dumps(dict) {
|
||||||
|
return JSON.stringify(dict)
|
||||||
|
}
|
||||||
|
loads(str) {
|
||||||
|
return JSON.parse(str)
|
||||||
|
}
|
||||||
|
notice(msg) {
|
||||||
|
this.message.push({
|
||||||
|
'index': this.index,
|
||||||
|
'user': this.user,
|
||||||
|
'msg': msg
|
||||||
|
})
|
||||||
|
}
|
||||||
|
notices(msg, user, index = '') {
|
||||||
|
this.message.push({
|
||||||
|
'user': user,
|
||||||
|
'msg': msg,
|
||||||
|
'index': index
|
||||||
|
})
|
||||||
|
}
|
||||||
|
urlparse(url) {
|
||||||
|
return urls.parse(url, true, true)
|
||||||
|
}
|
||||||
|
md5(encryptString) {
|
||||||
|
return CryptoJS.MD5(encryptString).toString()
|
||||||
|
}
|
||||||
|
haskey(data, key, value) {
|
||||||
|
value = typeof value !== 'undefined' ? value : '';
|
||||||
|
var spl = key.split('.');
|
||||||
|
for (var i of spl) {
|
||||||
|
i = !isNaN(i) ? parseInt(i) : i;
|
||||||
|
try {
|
||||||
|
data = data[i];
|
||||||
|
} catch (error) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (data == undefined) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
if (value !== '') {
|
||||||
|
return data === value ? true : false;
|
||||||
|
} else {
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
match(pattern, string) {
|
||||||
|
pattern = (pattern instanceof Array) ? pattern : [pattern];
|
||||||
|
for (let pat of pattern) {
|
||||||
|
// var match = string.match(pat);
|
||||||
|
var match = pat.exec(string)
|
||||||
|
if (match) {
|
||||||
|
var len = match.length;
|
||||||
|
if (len == 1) {
|
||||||
|
return match;
|
||||||
|
} else if (len == 2) {
|
||||||
|
return match[1];
|
||||||
|
} else {
|
||||||
|
var r = [];
|
||||||
|
for (let i = 1; i < len; i++) {
|
||||||
|
r.push(match[i])
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// console.log(pat.exec(string))
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
matchall(pattern, string) {
|
||||||
|
pattern = (pattern instanceof Array) ? pattern : [pattern];
|
||||||
|
var match;
|
||||||
|
var result = [];
|
||||||
|
for (var pat of pattern) {
|
||||||
|
while ((match = pat.exec(string)) != null) {
|
||||||
|
var len = match.length;
|
||||||
|
if (len == 1) {
|
||||||
|
result.push(match);
|
||||||
|
} else if (len == 2) {
|
||||||
|
result.push(match[1]);
|
||||||
|
} else {
|
||||||
|
var r = [];
|
||||||
|
for (let i = 1; i < len; i++) {
|
||||||
|
r.push(match[i])
|
||||||
|
}
|
||||||
|
result.push(r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
compare(property) {
|
||||||
|
return function(a, b) {
|
||||||
|
var value1 = a[property];
|
||||||
|
var value2 = b[property];
|
||||||
|
return value1 - value2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filename(file, rename = '') {
|
||||||
|
if (!this.runfile) {
|
||||||
|
this.runfile = path.basename(file).replace(".js", '').replace(/-/g, '_')
|
||||||
|
}
|
||||||
|
if (rename) {
|
||||||
|
rename = `_${rename}`;
|
||||||
|
}
|
||||||
|
return path.basename(file).replace(".js", rename).replace(/-/g, '_');
|
||||||
|
}
|
||||||
|
rand(n, m) {
|
||||||
|
var random = Math.floor(Math.random() * (m - n + 1) + n);
|
||||||
|
return random;
|
||||||
|
}
|
||||||
|
random(arr, num) {
|
||||||
|
var temp_array = new Array();
|
||||||
|
for (var index in arr) {
|
||||||
|
temp_array.push(arr[index]);
|
||||||
|
}
|
||||||
|
var return_array = new Array();
|
||||||
|
for (var i = 0; i < num; i++) {
|
||||||
|
if (temp_array.length > 0) {
|
||||||
|
var arrIndex = Math.floor(Math.random() * temp_array.length);
|
||||||
|
return_array[i] = temp_array[arrIndex];
|
||||||
|
temp_array.splice(arrIndex, 1);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return return_array;
|
||||||
|
}
|
||||||
|
compact(lists, keys) {
|
||||||
|
let array = {};
|
||||||
|
for (let i of keys) {
|
||||||
|
if (lists[i]) {
|
||||||
|
array[i] = lists[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
unique(arr) {
|
||||||
|
return Array.from(new Set(arr));
|
||||||
|
}
|
||||||
|
end(args) {
|
||||||
|
return args[args.length - 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
env,
|
||||||
|
eval: mainEval,
|
||||||
|
assert,
|
||||||
|
jxAlgo,
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
module.exports = {"ThreadJs":[],"invokeKey":"RtKLB8euDo7KwsO0"}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,83 @@
|
||||||
|
function mainEval($) {
|
||||||
|
return `
|
||||||
|
!(async () => {
|
||||||
|
jdcookie = process.env.JD_COOKIE ? process.env.JD_COOKIE.split("&") : require("./function/jdcookie").cookie;
|
||||||
|
cookies={
|
||||||
|
'all':jdcookie,
|
||||||
|
'help': typeof(help) != 'undefined' ? [...jdcookie].splice(0,parseInt(help)):[]
|
||||||
|
}
|
||||||
|
$.sleep=cookies['all'].length * 500
|
||||||
|
taskCookie=cookies['all']
|
||||||
|
jxAlgo = new common.jxAlgo();
|
||||||
|
if ($.readme) {
|
||||||
|
console.log(\`使用说明:\\n\${$.readme}\\n以上内容仅供参考,有需求自行添加\\n\`,)
|
||||||
|
}
|
||||||
|
console.log(\`======================本次任务共\${taskCookie.length}个京东账户Cookie======================\\n\`)
|
||||||
|
try{
|
||||||
|
await prepare();
|
||||||
|
|
||||||
|
if ($.sharecode.length > 0) {
|
||||||
|
$.sharecode = $.sharecode.filter(d=>d && JSON.stringify(d)!='{}')
|
||||||
|
console.log('助力码', $.sharecode )
|
||||||
|
}
|
||||||
|
}catch(e1){console.log("初始函数不存在,将继续执行主函数Main\\n")}
|
||||||
|
if (typeof(main) != 'undefined') {
|
||||||
|
try{
|
||||||
|
for (let i = 0; i < taskCookie.filter(d => d).length; i++) {
|
||||||
|
$.cookie = taskCookie[i];
|
||||||
|
$.user = decodeURIComponent($.cookie.match(/pt_pin=([^;]+)/)[1])
|
||||||
|
$.index = parseInt(i) + 1;
|
||||||
|
let info = {
|
||||||
|
'index': $.index,
|
||||||
|
'user': $.user,
|
||||||
|
'cookie': $.cookie
|
||||||
|
}
|
||||||
|
if (!$.thread) {
|
||||||
|
console.log(\`\n******开始【京东账号\${$.index}】\${$.user} 任务*********\n\`);
|
||||||
|
}
|
||||||
|
if ($.config[\`\${$.runfile}_except\`] && $.config[\`\${$.runfile}_except\`].includes(\$.user)) {
|
||||||
|
console.log(\`全局变量\${$.runfile}_except中配置了该账号pt_pin,跳过此次任务\`)
|
||||||
|
}else{
|
||||||
|
$.setCookie($.cookie)
|
||||||
|
try{
|
||||||
|
if ($.sharecode.length > 0) {
|
||||||
|
for (let smp of $.sharecode) {
|
||||||
|
smp = Object.assign({ ...info}, smp);
|
||||||
|
$.thread ? main(smp) : await main(smp);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
$.thread ? main(info) : await main(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(em){
|
||||||
|
console.log(em.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch(em){console.log(em.message)}
|
||||||
|
if ($.thread) {
|
||||||
|
await $.wait($.sleep)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (typeof(extra) != 'undefined') {
|
||||||
|
console.log(\`============================开始运行额外任务============================\`)
|
||||||
|
try{
|
||||||
|
await extra();
|
||||||
|
}catch(e4){console.log(e4.message)}
|
||||||
|
}
|
||||||
|
})().catch((e) => {
|
||||||
|
console.log(e.message)
|
||||||
|
}).finally(() => {
|
||||||
|
if ($.message.length > 0) {
|
||||||
|
$.notify($.message)
|
||||||
|
}
|
||||||
|
$.done();
|
||||||
|
});
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
module.exports = {
|
||||||
|
mainEval
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
var iil='jsjiami.com.v7';const lIIl11l1=IIii1IlI;(function(IiilIlil,llIi1iii,lIIiiIil,ll1IiiII,illIli1l,l1liIliI,iI1li1I){return IiilIlil=IiilIlil>>0x8,l1liIliI='hs',iI1li1I='hs',function(lliii1I,liIIillI,lIl1i1li,iI1i1iIl,I1IIIlll){const i1lIll1i=IIii1IlI;iI1i1iIl='tfi',l1liIliI=iI1i1iIl+l1liIliI,I1IIIlll='up',iI1li1I+=I1IIIlll,l1liIliI=lIl1i1li(l1liIliI),iI1li1I=lIl1i1li(iI1li1I),lIl1i1li=0x0;const ii1iII1l=lliii1I();while(!![]&&--ll1IiiII+liIIillI){try{iI1i1iIl=parseInt(i1lIll1i(0xb2,'5C4['))/0x1+parseInt(i1lIll1i(0xb4,'UgCK'))/0x2+-parseInt(i1lIll1i(0xa0,'Mtzj'))/0x3*(parseInt(i1lIll1i(0xa6,'Kx83'))/0x4)+parseInt(i1lIll1i(0xb0,'MU[H'))/0x5*(parseInt(i1lIll1i(0xae,'rJx$'))/0x6)+parseInt(i1lIll1i(0xa1,'A#cN'))/0x7*(parseInt(i1lIll1i(0xac,'Elur'))/0x8)+parseInt(i1lIll1i(0xad,'Ud90'))/0x9+-parseInt(i1lIll1i(0xa9,')SXP'))/0xa;}catch(II1liIl1){iI1i1iIl=lIl1i1li;}finally{I1IIIlll=ii1iII1l[l1liIliI]();if(IiilIlil<=ll1IiiII)lIl1i1li?illIli1l?iI1i1iIl=I1IIIlll:illIli1l=I1IIIlll:lIl1i1li=I1IIIlll;else{if(lIl1i1li==illIli1l['replace'](/[UKJAISyMDurRdTQqCEWV=]/g,'')){if(iI1i1iIl===liIIillI){ii1iII1l['un'+l1liIliI](I1IIIlll);break;}ii1iII1l[iI1li1I](I1IIIlll);}}}}}(lIIiiIil,llIi1iii,function(IiIli1lI,ilII1l,IIIIil1,IIIi111i,l1III1Il,l1iiIII,IiiliIl){return ilII1l='\x73\x70\x6c\x69\x74',IiIli1lI=arguments[0x0],IiIli1lI=IiIli1lI[ilII1l](''),IIIIil1=`\x72\x65\x76\x65\x72\x73\x65`,IiIli1lI=IiIli1lI[IIIIil1]('\x76'),IIIi111i=`\x6a\x6f\x69\x6e`,(0x15b906,IiIli1lI[IIIi111i](''));});}(0xbe00,0x4f0f2,iIIIlil1,0xc0),iIIIlil1)&&(iil=0x230e);function IIii1IlI(_0x1ec280,_0x300e6e){const _0x5c54c9=iIIIlil1();return IIii1IlI=function(_0x725f54,_0x41e333){_0x725f54=_0x725f54-0x9c;let _0x1fc311=_0x5c54c9[_0x725f54];if(IIii1IlI['YUFSvd']===undefined){var _0x5a0984=function(_0x50c1b0){const _0x19ff44='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x2f2a33='',_0x3542ef='';for(let _0x12300f=0x0,_0x51fe7d,_0x5b7af0,_0x4ee540=0x0;_0x5b7af0=_0x50c1b0['charAt'](_0x4ee540++);~_0x5b7af0&&(_0x51fe7d=_0x12300f%0x4?_0x51fe7d*0x40+_0x5b7af0:_0x5b7af0,_0x12300f++%0x4)?_0x2f2a33+=String['fromCharCode'](0xff&_0x51fe7d>>(-0x2*_0x12300f&0x6)):0x0){_0x5b7af0=_0x19ff44['indexOf'](_0x5b7af0);}for(let _0x15def8=0x0,_0x7998fd=_0x2f2a33['length'];_0x15def8<_0x7998fd;_0x15def8++){_0x3542ef+='%'+('00'+_0x2f2a33['charCodeAt'](_0x15def8)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3542ef);};const _0x2907f7=function(_0xda0c54,_0x28f503){let _0x14a5ba=[],_0x17b980=0x0,_0x43a8c6,_0x4d4762='';_0xda0c54=_0x5a0984(_0xda0c54);let _0x23c696;for(_0x23c696=0x0;_0x23c696<0x100;_0x23c696++){_0x14a5ba[_0x23c696]=_0x23c696;}for(_0x23c696=0x0;_0x23c696<0x100;_0x23c696++){_0x17b980=(_0x17b980+_0x14a5ba[_0x23c696]+_0x28f503['charCodeAt'](_0x23c696%_0x28f503['length']))%0x100,_0x43a8c6=_0x14a5ba[_0x23c696],_0x14a5ba[_0x23c696]=_0x14a5ba[_0x17b980],_0x14a5ba[_0x17b980]=_0x43a8c6;}_0x23c696=0x0,_0x17b980=0x0;for(let _0x3711a3=0x0;_0x3711a3<_0xda0c54['length'];_0x3711a3++){_0x23c696=(_0x23c696+0x1)%0x100,_0x17b980=(_0x17b980+_0x14a5ba[_0x23c696])%0x100,_0x43a8c6=_0x14a5ba[_0x23c696],_0x14a5ba[_0x23c696]=_0x14a5ba[_0x17b980],_0x14a5ba[_0x17b980]=_0x43a8c6,_0x4d4762+=String['fromCharCode'](_0xda0c54['charCodeAt'](_0x3711a3)^_0x14a5ba[(_0x14a5ba[_0x23c696]+_0x14a5ba[_0x17b980])%0x100]);}return _0x4d4762;};IIii1IlI['vnCAfj']=_0x2907f7,_0x1ec280=arguments,IIii1IlI['YUFSvd']=!![];}const _0x3baa53=_0x5c54c9[0x0],_0x17bc77=_0x725f54+_0x3baa53,_0x490163=_0x1ec280[_0x17bc77];return!_0x490163?(IIii1IlI['bnDExB']===undefined&&(IIii1IlI['bnDExB']=!![]),_0x1fc311=IIii1IlI['vnCAfj'](_0x1fc311,_0x41e333),_0x1ec280[_0x17bc77]=_0x1fc311):_0x1fc311=_0x490163,_0x1fc311;},IIii1IlI(_0x1ec280,_0x300e6e);}function iIIIlil1(){const iIilli11=(function(){return[...[iil,'RUKjrsjViDaCdmSiAd.qcQMouCumIqD.TvJ7WJEy==','FmopWRZcKSkxsde','WPi9qve8jCoazLxdPq','WPNdN8kjW4lcJ8kHW4etWQhcN8kfcGy','WPhcQaNcJ1RcQGe','rxldIG','WPNdMmkmW4tcISkLWPajWQNcP8kxaG','gq7cNtFdTSk8WRS+WQekmmoYW7u','qq0+W6W'],...(function(){return[...['WPNdNmkjW4FcISolWOWjWPpcS8kO','mG7cLXOGeqm','W58ZWPXVo8oonv8gW7f7W7RcOG','WQeTW6hdOSozWPxdJ39UWPdcLa','eSk7W4hcMbVcGaG','AmkkW7GowSozWR0yW5a','xez/W4yhnG','W75GWPpdM2ZcS8oGmNxdMMX2','xafwbeRcUJ1RWRxdO8oBWOlcKa','W7m9W77dHSo3zZZcQmk8pXPW'],...(function(){return['dam8WP1sBxT9pSkbfmk8wG','WP3cS8kuwCkmpCkx','FSk/W7ddSSkhWRdcMG','W43dJCorW5dcNCohW4D1na','WPBdTNBcICowBCkvWRxcUfm2xq','bWVdRZZcQh9PFtaYnmkctW','oSkmvMBcRCktWQP9fxCudW'];}())];}())];}());iIIIlil1=function(){return iIilli11;};return iIIIlil1();};const {H5st}=require(lIIl11l1(0xa4,'wwG^'));async function getH5st(iIiIl1i1,iIIIi111,Il1l1ili=lIIl11l1(0xa7,'J*Zq')){const iIIi1i11=lIIl11l1,l11lilI=Object[iIIi1i11(0xb1,'edxX')]({'appId':iIiIl1i1,'version':Il1l1ili},iIIIi111),l1lllil1=await H5st[iIIi1i11(0x9e,'Nkmp')](l11lilI);return l1lllil1?.[iIIi1i11(0xaa,'FHZ3')];}module[lIIl11l1(0xaf,'8byO')]=getH5st;var version_ = 'jsjiami.com.v7';
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,72 @@
|
||||||
|
import axios from "axios"
|
||||||
|
import {format} from "date-fns"
|
||||||
|
import * as CryptoJS from 'crypto-js'
|
||||||
|
|
||||||
|
class H5ST {
|
||||||
|
tk: string;
|
||||||
|
timestamp: string;
|
||||||
|
rd: string;
|
||||||
|
appId: string;
|
||||||
|
fp: string;
|
||||||
|
time: number;
|
||||||
|
ua: string
|
||||||
|
enc: string;
|
||||||
|
|
||||||
|
constructor(appId: string, ua: string, fp: string) {
|
||||||
|
this.appId = appId
|
||||||
|
this.ua = ua
|
||||||
|
this.fp = fp || this.__genFp()
|
||||||
|
}
|
||||||
|
|
||||||
|
__genFp() {
|
||||||
|
let e = "0123456789";
|
||||||
|
let a = 13;
|
||||||
|
let i = '';
|
||||||
|
for (; a--;)
|
||||||
|
i += e[Math.random() * e.length | 0];
|
||||||
|
return (i + Date.now()).slice(0, 16)
|
||||||
|
}
|
||||||
|
|
||||||
|
async __genAlgo() {
|
||||||
|
this.time = Date.now()
|
||||||
|
this.timestamp = format(this.time, "yyyyMMddHHmmssSSS")
|
||||||
|
let {data} = await axios.post(`https://cactus.jd.com/request_algo?g_ty=ajax`, {
|
||||||
|
'version': '3.0',
|
||||||
|
'fp': this.fp,
|
||||||
|
'appId': this.appId.toString(),
|
||||||
|
'timestamp': this.time,
|
||||||
|
'platform': 'web',
|
||||||
|
'expandParams': ''
|
||||||
|
}, {
|
||||||
|
headers: {
|
||||||
|
'Host': 'cactus.jd.com',
|
||||||
|
'accept': 'application/json',
|
||||||
|
'content-type': 'application/json',
|
||||||
|
'user-agent': this.ua,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.tk = data.data.result.tk
|
||||||
|
this.rd = data.data.result.algo.match(/rd='(.*)'/)[1]
|
||||||
|
this.enc = data.data.result.algo.match(/algo\.(.*)\(/)[1]
|
||||||
|
}
|
||||||
|
|
||||||
|
__genKey(tk: string, fp: string, ts: string, ai: string, algo: object) {
|
||||||
|
let str = `${tk}${fp}${ts}${ai}${this.rd}`;
|
||||||
|
return algo[this.enc](str, tk)
|
||||||
|
}
|
||||||
|
|
||||||
|
__genH5st(body: object) {
|
||||||
|
let y = this.__genKey(this.tk, this.fp, this.timestamp, this.appId, CryptoJS).toString(CryptoJS.enc.Hex)
|
||||||
|
let s = ''
|
||||||
|
for (let key of Object.keys(body)) {
|
||||||
|
key === 'body' ? s += `${key}:${CryptoJS.SHA256(body[key]).toString(CryptoJS.enc.Hex)}&` : s += `${key}:${body[key]}&`
|
||||||
|
}
|
||||||
|
s = s.slice(0, -1)
|
||||||
|
s = CryptoJS.HmacSHA256(s, y).toString(CryptoJS.enc.Hex)
|
||||||
|
return encodeURIComponent(`${this.timestamp};${this.fp};${this.appId.toString()};${this.tk};${s};3.0;${this.time.toString()}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
H5ST
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,466 @@
|
||||||
|
const https = require('https');
|
||||||
|
const http = require('http');
|
||||||
|
const stream = require('stream');
|
||||||
|
const zlib = require('zlib');
|
||||||
|
const vm = require('vm');
|
||||||
|
const PNG = require('png-js');
|
||||||
|
const UA = 'jdapp;iPhone;9.4.6;14.2;965af808880443e4c1306a54afdd5d5ae771de46;network/wifi;supportApplePay/0;hasUPPay/0;hasOCPay/0;model/iPhone8,4;addressid/;supportBestPay/0;appBuild/167618;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1';
|
||||||
|
Math.avg = function average() {
|
||||||
|
var sum = 0;
|
||||||
|
var len = this.length;
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
sum += this[i];
|
||||||
|
}
|
||||||
|
return sum / len;
|
||||||
|
};
|
||||||
|
|
||||||
|
function sleep(timeout) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, timeout));
|
||||||
|
}
|
||||||
|
class PNGDecoder extends PNG {
|
||||||
|
constructor(args) {
|
||||||
|
super(args);
|
||||||
|
this.pixels = [];
|
||||||
|
}
|
||||||
|
decodeToPixels() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
this.decode((pixels) => {
|
||||||
|
this.pixels = pixels;
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
getImageData(x, y, w, h) {
|
||||||
|
const {
|
||||||
|
pixels
|
||||||
|
} = this;
|
||||||
|
const len = w * h * 4;
|
||||||
|
const startIndex = x * 4 + y * (w * 4);
|
||||||
|
return {
|
||||||
|
data: pixels.slice(startIndex, startIndex + len)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const PUZZLE_GAP = 8;
|
||||||
|
const PUZZLE_PAD = 10;
|
||||||
|
class PuzzleRecognizer {
|
||||||
|
constructor(bg, patch, y) {
|
||||||
|
// console.log(bg);
|
||||||
|
const imgBg = new PNGDecoder(Buffer.from(bg, 'base64'));
|
||||||
|
const imgPatch = new PNGDecoder(Buffer.from(patch, 'base64'));
|
||||||
|
// console.log(imgBg);
|
||||||
|
this.bg = imgBg;
|
||||||
|
this.patch = imgPatch;
|
||||||
|
this.rawBg = bg;
|
||||||
|
this.rawPatch = patch;
|
||||||
|
this.y = y;
|
||||||
|
this.w = imgBg.width;
|
||||||
|
this.h = imgBg.height;
|
||||||
|
}
|
||||||
|
async run() {
|
||||||
|
await this.bg.decodeToPixels();
|
||||||
|
await this.patch.decodeToPixels();
|
||||||
|
return this.recognize();
|
||||||
|
}
|
||||||
|
recognize() {
|
||||||
|
const {
|
||||||
|
ctx,
|
||||||
|
w: width,
|
||||||
|
bg
|
||||||
|
} = this;
|
||||||
|
const {
|
||||||
|
width: patchWidth,
|
||||||
|
height: patchHeight
|
||||||
|
} = this.patch;
|
||||||
|
const posY = this.y + PUZZLE_PAD + ((patchHeight - PUZZLE_PAD) / 2) - (PUZZLE_GAP / 2);
|
||||||
|
// const cData = ctx.getImageData(0, a.y + 10 + 20 - 4, 360, 8).data;
|
||||||
|
const cData = bg.getImageData(0, posY, width, PUZZLE_GAP).data;
|
||||||
|
const lumas = [];
|
||||||
|
for (let x = 0; x < width; x++) {
|
||||||
|
var sum = 0;
|
||||||
|
// y xais
|
||||||
|
for (let y = 0; y < PUZZLE_GAP; y++) {
|
||||||
|
var idx = x * 4 + y * (width * 4);
|
||||||
|
var r = cData[idx];
|
||||||
|
var g = cData[idx + 1];
|
||||||
|
var b = cData[idx + 2];
|
||||||
|
var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
sum += luma;
|
||||||
|
}
|
||||||
|
lumas.push(sum / PUZZLE_GAP);
|
||||||
|
}
|
||||||
|
const n = 2; // minium macroscopic image width (px)
|
||||||
|
const margin = patchWidth - PUZZLE_PAD;
|
||||||
|
const diff = 20; // macroscopic brightness difference
|
||||||
|
const radius = PUZZLE_PAD;
|
||||||
|
for (let i = 0, len = lumas.length - 2 * 4; i < len; i++) {
|
||||||
|
const left = (lumas[i] + lumas[i + 1]) / n;
|
||||||
|
const right = (lumas[i + 2] + lumas[i + 3]) / n;
|
||||||
|
const mi = margin + i;
|
||||||
|
const mLeft = (lumas[mi] + lumas[mi + 1]) / n;
|
||||||
|
const mRigth = (lumas[mi + 2] + lumas[mi + 3]) / n;
|
||||||
|
if (left - right > diff && mLeft - mRigth < -diff) {
|
||||||
|
const pieces = lumas.slice(i + 2, margin + i + 2);
|
||||||
|
const median = pieces.sort((x1, x2) => x1 - x2)[20];
|
||||||
|
const avg = Math.avg(pieces);
|
||||||
|
// noise reducation
|
||||||
|
if (median > left || median > mRigth) return;
|
||||||
|
if (avg > 100) return;
|
||||||
|
// console.table({left,right,mLeft,mRigth,median});
|
||||||
|
// ctx.fillRect(i+n-radius, 0, 1, 360);
|
||||||
|
// console.log(i+n-radius);
|
||||||
|
return i + n - radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
runWithCanvas() {
|
||||||
|
const {
|
||||||
|
createCanvas,
|
||||||
|
Image
|
||||||
|
} = require('canvas');
|
||||||
|
const canvas = createCanvas();
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
const imgBg = new Image();
|
||||||
|
const imgPatch = new Image();
|
||||||
|
const prefix = 'data:image/png;base64,';
|
||||||
|
imgBg.src = prefix + this.rawBg;
|
||||||
|
imgPatch.src = prefix + this.rawPatch;
|
||||||
|
const {
|
||||||
|
naturalWidth: w,
|
||||||
|
naturalHeight: h
|
||||||
|
} = imgBg;
|
||||||
|
canvas.width = w;
|
||||||
|
canvas.height = h;
|
||||||
|
ctx.clearRect(0, 0, w, h);
|
||||||
|
ctx.drawImage(imgBg, 0, 0, w, h);
|
||||||
|
const width = w;
|
||||||
|
const {
|
||||||
|
naturalWidth,
|
||||||
|
naturalHeight
|
||||||
|
} = imgPatch;
|
||||||
|
const posY = this.y + PUZZLE_PAD + ((naturalHeight - PUZZLE_PAD) / 2) - (PUZZLE_GAP / 2);
|
||||||
|
// const cData = ctx.getImageData(0, a.y + 10 + 20 - 4, 360, 8).data;
|
||||||
|
const cData = ctx.getImageData(0, posY, width, PUZZLE_GAP).data;
|
||||||
|
const lumas = [];
|
||||||
|
for (let x = 0; x < width; x++) {
|
||||||
|
var sum = 0;
|
||||||
|
// y xais
|
||||||
|
for (let y = 0; y < PUZZLE_GAP; y++) {
|
||||||
|
var idx = x * 4 + y * (width * 4);
|
||||||
|
var r = cData[idx];
|
||||||
|
var g = cData[idx + 1];
|
||||||
|
var b = cData[idx + 2];
|
||||||
|
var luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
||||||
|
sum += luma;
|
||||||
|
}
|
||||||
|
lumas.push(sum / PUZZLE_GAP);
|
||||||
|
}
|
||||||
|
const n = 2; // minium macroscopic image width (px)
|
||||||
|
const margin = naturalWidth - PUZZLE_PAD;
|
||||||
|
const diff = 20; // macroscopic brightness difference
|
||||||
|
const radius = PUZZLE_PAD;
|
||||||
|
for (let i = 0, len = lumas.length - 2 * 4; i < len; i++) {
|
||||||
|
const left = (lumas[i] + lumas[i + 1]) / n;
|
||||||
|
const right = (lumas[i + 2] + lumas[i + 3]) / n;
|
||||||
|
const mi = margin + i;
|
||||||
|
const mLeft = (lumas[mi] + lumas[mi + 1]) / n;
|
||||||
|
const mRigth = (lumas[mi + 2] + lumas[mi + 3]) / n;
|
||||||
|
if (left - right > diff && mLeft - mRigth < -diff) {
|
||||||
|
const pieces = lumas.slice(i + 2, margin + i + 2);
|
||||||
|
const median = pieces.sort((x1, x2) => x1 - x2)[20];
|
||||||
|
const avg = Math.avg(pieces);
|
||||||
|
// noise reducation
|
||||||
|
if (median > left || median > mRigth) return;
|
||||||
|
if (avg > 100) return;
|
||||||
|
// console.table({left,right,mLeft,mRigth,median});
|
||||||
|
// ctx.fillRect(i+n-radius, 0, 1, 360);
|
||||||
|
// console.log(i+n-radius);
|
||||||
|
return i + n - radius;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not found
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const DATA = {
|
||||||
|
"appId": "17839d5db83",
|
||||||
|
"scene": "cww",
|
||||||
|
"product": "embed",
|
||||||
|
"lang": "zh_CN",
|
||||||
|
};
|
||||||
|
let SERVER = 'iv.jd.com';
|
||||||
|
if (process.env.JDJR_SERVER) {
|
||||||
|
SERVER = process.env.JDJR_SERVER
|
||||||
|
}
|
||||||
|
class JDJRValidator {
|
||||||
|
constructor() {
|
||||||
|
this.data = {};
|
||||||
|
this.x = 0;
|
||||||
|
this.t = Date.now();
|
||||||
|
this.n = 0;
|
||||||
|
}
|
||||||
|
async run() {
|
||||||
|
const tryRecognize = async () => {
|
||||||
|
const x = await this.recognize();
|
||||||
|
if (x > 0) {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
// retry
|
||||||
|
return await tryRecognize();
|
||||||
|
};
|
||||||
|
const puzzleX = await tryRecognize();
|
||||||
|
console.log(puzzleX);
|
||||||
|
const pos = new MousePosFaker(puzzleX).run();
|
||||||
|
const d = getCoordinate(pos);
|
||||||
|
// console.log(pos[pos.length-1][2] -Date.now());
|
||||||
|
await sleep(3000);
|
||||||
|
//await sleep(pos[pos.length - 1][2] - Date.now());
|
||||||
|
const result = await JDJRValidator.jsonp('/slide/s.html', {
|
||||||
|
d,
|
||||||
|
...this.data
|
||||||
|
});
|
||||||
|
if (result.message === 'success') {
|
||||||
|
// console.log(result);
|
||||||
|
// console.log('JDJRValidator: %fs', (Date.now() - this.t) / 1000);
|
||||||
|
return result;
|
||||||
|
} else {
|
||||||
|
if (this.n > 60) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.n++;
|
||||||
|
return await this.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async recognize() {
|
||||||
|
const data = await JDJRValidator.jsonp('/slide/g.html', {
|
||||||
|
e: ''
|
||||||
|
});
|
||||||
|
const {
|
||||||
|
bg,
|
||||||
|
patch,
|
||||||
|
y
|
||||||
|
} = data;
|
||||||
|
// const uri = 'data:image/png;base64,';
|
||||||
|
// const re = new PuzzleRecognizer(uri+bg, uri+patch, y);
|
||||||
|
const re = new PuzzleRecognizer(bg, patch, y);
|
||||||
|
const puzzleX = await re.run();
|
||||||
|
if (puzzleX > 0) {
|
||||||
|
this.data = {
|
||||||
|
c: data.challenge,
|
||||||
|
w: re.w,
|
||||||
|
e: '',
|
||||||
|
s: '',
|
||||||
|
o: '',
|
||||||
|
};
|
||||||
|
this.x = puzzleX;
|
||||||
|
}
|
||||||
|
return puzzleX;
|
||||||
|
}
|
||||||
|
async report(n) {
|
||||||
|
console.time('PuzzleRecognizer');
|
||||||
|
let count = 0;
|
||||||
|
for (let i = 0; i < n; i++) {
|
||||||
|
const x = await this.recognize();
|
||||||
|
if (x > 0) count++;
|
||||||
|
if (i % 50 === 0) {
|
||||||
|
console.log('%f\%', (i / n) * 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log('successful: %f\%', (count / n) * 100);
|
||||||
|
console.timeEnd('PuzzleRecognizer');
|
||||||
|
}
|
||||||
|
static jsonp(api, data = {}) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const fnId = `jsonp_${String(Math.random()).replace('.', '')}`;
|
||||||
|
const extraData = {
|
||||||
|
callback: fnId
|
||||||
|
};
|
||||||
|
const query = new URLSearchParams({ ...DATA,
|
||||||
|
...extraData,
|
||||||
|
...data
|
||||||
|
}).toString();
|
||||||
|
const url = `http://${SERVER}${api}?${query}`;
|
||||||
|
const headers = {
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Accept-Encoding': 'gzip,deflate,br',
|
||||||
|
'Accept-Language': 'zh-CN,en-US',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'Host': SERVER,
|
||||||
|
'Proxy-Connection': 'keep-alive',
|
||||||
|
'Referer': 'https://h5.m.jd.com/babelDiy/Zeus/2wuqXrZrhygTQzYA7VufBEpj4amH/index.html',
|
||||||
|
'User-Agent': UA,
|
||||||
|
};
|
||||||
|
const req = http.get(url, {
|
||||||
|
headers
|
||||||
|
}, (response) => {
|
||||||
|
let res = response;
|
||||||
|
if (res.headers['content-encoding'] === 'gzip') {
|
||||||
|
const unzipStream = new stream.PassThrough();
|
||||||
|
stream.pipeline(response, zlib.createGunzip(), unzipStream, reject, );
|
||||||
|
res = unzipStream;
|
||||||
|
}
|
||||||
|
res.setEncoding('utf8');
|
||||||
|
let rawData = '';
|
||||||
|
res.on('data', (chunk) => rawData += chunk);
|
||||||
|
res.on('end', () => {
|
||||||
|
try {
|
||||||
|
const ctx = {
|
||||||
|
[fnId]: (data) => ctx.data = data,
|
||||||
|
data: {},
|
||||||
|
};
|
||||||
|
vm.createContext(ctx);
|
||||||
|
vm.runInContext(rawData, ctx);
|
||||||
|
// console.log(ctx.data);
|
||||||
|
res.resume();
|
||||||
|
resolve(ctx.data);
|
||||||
|
} catch (e) {
|
||||||
|
reject(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
req.on('error', reject);
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCoordinate(c) {
|
||||||
|
function string10to64(d) {
|
||||||
|
var c = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-~".split(""),
|
||||||
|
b = c.length,
|
||||||
|
e = +d,
|
||||||
|
a = [];
|
||||||
|
do {
|
||||||
|
mod = e % b;
|
||||||
|
e = (e - mod) / b;
|
||||||
|
a.unshift(c[mod])
|
||||||
|
} while (e);
|
||||||
|
return a.join("")
|
||||||
|
}
|
||||||
|
|
||||||
|
function prefixInteger(a, b) {
|
||||||
|
return (Array(b).join(0) + a).slice(-b)
|
||||||
|
}
|
||||||
|
|
||||||
|
function pretreatment(d, c, b) {
|
||||||
|
var e = string10to64(Math.abs(d));
|
||||||
|
var a = "";
|
||||||
|
if (!b) {
|
||||||
|
a += (d > 0 ? "1" : "0")
|
||||||
|
}
|
||||||
|
a += prefixInteger(e, c);
|
||||||
|
return a
|
||||||
|
}
|
||||||
|
var b = new Array();
|
||||||
|
for (var e = 0; e < c.length; e++) {
|
||||||
|
if (e == 0) {
|
||||||
|
b.push(pretreatment(c[e][0] < 262143 ? c[e][0] : 262143, 3, true));
|
||||||
|
b.push(pretreatment(c[e][1] < 16777215 ? c[e][1] : 16777215, 4, true));
|
||||||
|
b.push(pretreatment(c[e][2] < 4398046511103 ? c[e][2] : 4398046511103, 7, true))
|
||||||
|
} else {
|
||||||
|
var a = c[e][0] - c[e - 1][0];
|
||||||
|
var f = c[e][1] - c[e - 1][1];
|
||||||
|
var d = c[e][2] - c[e - 1][2];
|
||||||
|
b.push(pretreatment(a < 4095 ? a : 4095, 2, false));
|
||||||
|
b.push(pretreatment(f < 4095 ? f : 4095, 2, false));
|
||||||
|
b.push(pretreatment(d < 16777215 ? d : 16777215, 4, true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.join("")
|
||||||
|
}
|
||||||
|
const HZ = 32;
|
||||||
|
class MousePosFaker {
|
||||||
|
constructor(puzzleX) {
|
||||||
|
this.x = parseInt(Math.random() * 20 + 20, 10);
|
||||||
|
this.y = parseInt(Math.random() * 80 + 80, 10);
|
||||||
|
this.t = Date.now();
|
||||||
|
this.pos = [
|
||||||
|
[this.x, this.y, this.t]
|
||||||
|
];
|
||||||
|
this.minDuration = parseInt(1000 / HZ, 10);
|
||||||
|
// this.puzzleX = puzzleX;
|
||||||
|
this.puzzleX = puzzleX + parseInt(Math.random() * 2 - 1, 10);
|
||||||
|
this.STEP = parseInt(Math.random() * 6 + 5, 10);
|
||||||
|
this.DURATION = parseInt(Math.random() * 7 + 12, 10) * 100;
|
||||||
|
// [9,1600] [10,1400]
|
||||||
|
this.STEP = 9;
|
||||||
|
// this.DURATION = 2000;
|
||||||
|
console.log(this.STEP, this.DURATION);
|
||||||
|
}
|
||||||
|
run() {
|
||||||
|
const perX = this.puzzleX / this.STEP;
|
||||||
|
const perDuration = this.DURATION / this.STEP;
|
||||||
|
const firstPos = [this.x - parseInt(Math.random() * 6, 10), this.y + parseInt(Math.random() * 11, 10), this.t];
|
||||||
|
this.pos.unshift(firstPos);
|
||||||
|
this.stepPos(perX, perDuration);
|
||||||
|
this.fixPos();
|
||||||
|
const reactTime = parseInt(60 + Math.random() * 100, 10);
|
||||||
|
const lastIdx = this.pos.length - 1;
|
||||||
|
const lastPos = [this.pos[lastIdx][0], this.pos[lastIdx][1], this.pos[lastIdx][2] + reactTime];
|
||||||
|
this.pos.push(lastPos);
|
||||||
|
return this.pos;
|
||||||
|
}
|
||||||
|
stepPos(x, duration) {
|
||||||
|
let n = 0;
|
||||||
|
const sqrt2 = Math.sqrt(2);
|
||||||
|
for (let i = 1; i <= this.STEP; i++) {
|
||||||
|
n += 1 / i;
|
||||||
|
}
|
||||||
|
for (let i = 0; i < this.STEP; i++) {
|
||||||
|
x = this.puzzleX / (n * (i + 1));
|
||||||
|
const currX = parseInt((Math.random() * 30 - 15) + x, 10);
|
||||||
|
const currY = parseInt(Math.random() * 7 - 3, 10);
|
||||||
|
const currDuration = parseInt((Math.random() * 0.4 + 0.8) * duration, 10);
|
||||||
|
this.moveToAndCollect({
|
||||||
|
x: currX,
|
||||||
|
y: currY,
|
||||||
|
duration: currDuration,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fixPos() {
|
||||||
|
const actualX = this.pos[this.pos.length - 1][0] - this.pos[1][0];
|
||||||
|
const deviation = this.puzzleX - actualX;
|
||||||
|
if (Math.abs(deviation) > 4) {
|
||||||
|
this.moveToAndCollect({
|
||||||
|
x: deviation,
|
||||||
|
y: parseInt(Math.random() * 8 - 3, 10),
|
||||||
|
duration: 100,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
moveToAndCollect({
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
duration
|
||||||
|
}) {
|
||||||
|
let movedX = 0;
|
||||||
|
let movedY = 0;
|
||||||
|
let movedT = 0;
|
||||||
|
const times = duration / this.minDuration;
|
||||||
|
let perX = x / times;
|
||||||
|
let perY = y / times;
|
||||||
|
let padDuration = 0;
|
||||||
|
if (Math.abs(perX) < 1) {
|
||||||
|
padDuration = duration / Math.abs(x) - this.minDuration;
|
||||||
|
perX = 1;
|
||||||
|
perY = y / Math.abs(x);
|
||||||
|
}
|
||||||
|
while (Math.abs(movedX) < Math.abs(x)) {
|
||||||
|
const rDuration = parseInt(padDuration + Math.random() * 16 - 4, 10);
|
||||||
|
movedX += perX + Math.random() * 2 - 1;
|
||||||
|
movedY += perY;
|
||||||
|
movedT += this.minDuration + rDuration;
|
||||||
|
const currX = parseInt(this.x + 20, 10);
|
||||||
|
const currY = parseInt(this.y + 20, 10);
|
||||||
|
const currT = this.t + movedT;
|
||||||
|
this.pos.push([currX, currY, currT]);
|
||||||
|
}
|
||||||
|
this.x += x;
|
||||||
|
this.y += y;
|
||||||
|
this.t += Math.max(duration, movedT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.JDJRValidator = JDJRValidator
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
此文件为Node.js专用。其他用户请忽略
|
||||||
|
*/
|
||||||
|
//此处填写京东账号cookie。
|
||||||
|
let CookieJDs = [
|
||||||
|
'',//账号一ck,例:pt_key=XXX;pt_pin=XXX;
|
||||||
|
'',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推
|
||||||
|
]
|
||||||
|
// 判断环境变量里面是否有京东ck
|
||||||
|
if (process.env.JD_COOKIE) {
|
||||||
|
if (process.env.JD_COOKIE.indexOf('&') > -1) {
|
||||||
|
CookieJDs = process.env.JD_COOKIE.split('&');
|
||||||
|
} else if (process.env.JD_COOKIE.indexOf('\n') > -1) {
|
||||||
|
CookieJDs = process.env.JD_COOKIE.split('\n');
|
||||||
|
} else {
|
||||||
|
CookieJDs = [process.env.JD_COOKIE];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (JSON.stringify(process.env).indexOf('GITHUB')>-1) {
|
||||||
|
console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
|
||||||
|
!(async () => {
|
||||||
|
await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
|
||||||
|
await process.exit(0);
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
CookieJDs = [...new Set(CookieJDs.filter(item => !!item))]
|
||||||
|
console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=================\n`);
|
||||||
|
console.log(`============脚本执行时间:${new Date(new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000).toLocaleString('chinese',{hour12:false})}=============\n`)
|
||||||
|
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
|
||||||
|
for (let i = 0; i < CookieJDs.length; i++) {
|
||||||
|
if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`);
|
||||||
|
const index = (i + 1 === 1) ? '' : (i + 1);
|
||||||
|
exports['CookieJD' + index] = CookieJDs[i].trim();
|
||||||
|
}
|
||||||
|
console.log('>>>>>>>>>>>>>>6Dylan6 提示:任务正常运行中>>>>>>>>>>>>>>>\n')
|
|
@ -0,0 +1,204 @@
|
||||||
|
let request = require("request");
|
||||||
|
let CryptoJS = require('crypto-js');
|
||||||
|
let qs = require("querystring");
|
||||||
|
Date.prototype.Format = function(fmt) {
|
||||||
|
var e,
|
||||||
|
n = this,
|
||||||
|
d = fmt,
|
||||||
|
l = {
|
||||||
|
"M+": n.getMonth() + 1,
|
||||||
|
"d+": n.getDate(),
|
||||||
|
"D+": n.getDate(),
|
||||||
|
"h+": n.getHours(),
|
||||||
|
"H+": n.getHours(),
|
||||||
|
"m+": n.getMinutes(),
|
||||||
|
"s+": n.getSeconds(),
|
||||||
|
"w+": n.getDay(),
|
||||||
|
"q+": Math.floor((n.getMonth() + 3) / 3),
|
||||||
|
"S+": n.getMilliseconds()
|
||||||
|
};
|
||||||
|
/(y+)/i.test(d) && (d = d.replace(RegExp.$1, "".concat(n.getFullYear()).substr(4 - RegExp.$1.length)));
|
||||||
|
for (var k in l) {
|
||||||
|
if (new RegExp("(".concat(k, ")")).test(d)) {
|
||||||
|
var t, a = "S+" === k ? "000" : "00";
|
||||||
|
d = d.replace(RegExp.$1, 1 == RegExp.$1.length ? l[k] : ("".concat(a) + l[k]).substr("".concat(l[k]).length))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateFp() {
|
||||||
|
let e = "0123456789";
|
||||||
|
let a = 13;
|
||||||
|
let i = '';
|
||||||
|
for (; a--;) i += e[Math.random() * e.length | 0];
|
||||||
|
return (i + Date.now()).slice(0, 16)
|
||||||
|
}
|
||||||
|
|
||||||
|
function getUrlData(url, name) {
|
||||||
|
if (typeof URL !== "undefined") {
|
||||||
|
let urls = new URL(url);
|
||||||
|
let data = urls.searchParams.get(name);
|
||||||
|
return data ? data : '';
|
||||||
|
} else {
|
||||||
|
const query = url.match(/\?.*/)[0].substring(1)
|
||||||
|
const vars = query.split('&')
|
||||||
|
for (let i = 0; i < vars.length; i++) {
|
||||||
|
const pair = vars[i].split('=')
|
||||||
|
if (pair[0] === name) {
|
||||||
|
return vars[i].substr(vars[i].indexOf('=') + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class jxAlgo {
|
||||||
|
constructor(params = {}) {
|
||||||
|
this.appId = 10001
|
||||||
|
this.result = {}
|
||||||
|
this.timestamp = Date.now();
|
||||||
|
for (let i in params) {
|
||||||
|
this[i] = params[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set(params = {}) {
|
||||||
|
for (let i in params) {
|
||||||
|
this[i] = params[i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
get(key) {
|
||||||
|
return this[key]
|
||||||
|
}
|
||||||
|
async dec(url) {
|
||||||
|
if (!this.tk) {
|
||||||
|
this.fingerprint = generateFp();
|
||||||
|
await this.requestAlgo()
|
||||||
|
}
|
||||||
|
let obj = qs.parse(url.split("?")[1]);
|
||||||
|
let stk = obj['_stk'];
|
||||||
|
return this.h5st(this.timestamp, stk, url)
|
||||||
|
}
|
||||||
|
h5st(time, stk, url) {
|
||||||
|
stk = stk || (url ? getUrlData(url, '_stk') : '')
|
||||||
|
const timestamp = new Date(time).Format("yyyyMMddhhmmssSSS");
|
||||||
|
let hash1 = this.enCryptMethodJD(this.tk, this.fingerprint.toString(), timestamp.toString(), this.appId.toString(), CryptoJS).toString(CryptoJS.enc.Hex);
|
||||||
|
let st = '';
|
||||||
|
stk.split(',').map((item, index) => {
|
||||||
|
st += `${item}:${getUrlData(url, item)}${index === stk.split(',').length - 1 ? '' : '&'}`;
|
||||||
|
})
|
||||||
|
const hash2 = CryptoJS.HmacSHA256(st, hash1.toString()).toString(CryptoJS.enc.Hex);
|
||||||
|
const enc = (["".concat(timestamp.toString()), "".concat(this.fingerprint.toString()), "".concat(this.appId.toString()), "".concat(this.tk), "".concat(hash2)].join(";"))
|
||||||
|
this.result['fingerprint'] = this.fingerprint;
|
||||||
|
this.result['timestamp'] = this.timestamp
|
||||||
|
this.result['stk'] = stk;
|
||||||
|
this.result['h5st'] = enc
|
||||||
|
let sp = url.split("?");
|
||||||
|
let obj = qs.parse(sp[1])
|
||||||
|
if (obj.callback) {
|
||||||
|
delete obj.callback
|
||||||
|
}
|
||||||
|
let params = Object.assign(obj, {
|
||||||
|
'_time': this.timestamp,
|
||||||
|
'_': this.timestamp,
|
||||||
|
'timestamp': this.timestamp,
|
||||||
|
'sceneval': 2,
|
||||||
|
'g_login_type': 1,
|
||||||
|
'h5st': enc,
|
||||||
|
})
|
||||||
|
this.result['url'] = `${sp[0]}?${qs.stringify(params)}`
|
||||||
|
return this.result
|
||||||
|
}
|
||||||
|
token(user) {
|
||||||
|
let nickname = user.includes('pt_pin') ? user.match(/pt_pin=([^;]+)/)[1] : user;
|
||||||
|
let phoneId = this.createuuid(40, 'lc');
|
||||||
|
|
||||||
|
let token = this.md5(decodeURIComponent(nickname) + this.timestamp + phoneId + 'tPOamqCuk9NLgVPAljUyIHcPRmKlVxDy');
|
||||||
|
return {
|
||||||
|
'strPgtimestamp': this.timestamp,
|
||||||
|
'strPhoneID': phoneId,
|
||||||
|
'strPgUUNum': token
|
||||||
|
}
|
||||||
|
}
|
||||||
|
md5(encryptString) {
|
||||||
|
return CryptoJS.MD5(encryptString).toString()
|
||||||
|
}
|
||||||
|
createuuid(a, c) {
|
||||||
|
switch (c) {
|
||||||
|
case "a":
|
||||||
|
c = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
break;
|
||||||
|
case "n":
|
||||||
|
c = "0123456789";
|
||||||
|
break;
|
||||||
|
case "c":
|
||||||
|
c = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
break;
|
||||||
|
case "l":
|
||||||
|
c = "abcdefghijklmnopqrstuvwxyz";
|
||||||
|
break;
|
||||||
|
case 'cn':
|
||||||
|
case 'nc':
|
||||||
|
c = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
|
||||||
|
break;
|
||||||
|
case "lc":
|
||||||
|
case "cl":
|
||||||
|
c = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
c = "0123456789abcdef"
|
||||||
|
}
|
||||||
|
var e = "";
|
||||||
|
for (var g = 0; g < a; g++) e += c[Math.ceil(1E8 * Math.random()) % c.length];
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
async requestAlgo() {
|
||||||
|
const options = {
|
||||||
|
"url": `https://cactus.jd.com/request_algo?g_ty=ajax`,
|
||||||
|
"headers": {
|
||||||
|
'Authority': 'cactus.jd.com',
|
||||||
|
'Pragma': 'no-cache',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'User-Agent': 'jdpingou;iPhone;4.9.4;12.4;ae49fae72d0a8976f5155267f56ec3a5b0da75c3;network/wifi;model/iPhone8,4;appBuild/100579;ADID/00000000-0000-0000-0000-000000000000;supportApplePay/1;hasUPPay/0;pushNoticeIsOpen/0;hasOCPay/0;supportBestPay/0;session/1;pap/JA2019_3111789;brand/apple;supportJDSHWK/1;Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Origin': 'https://st.jingxi.com',
|
||||||
|
'Sec-Fetch-Site': 'cross-site',
|
||||||
|
'Sec-Fetch-Mode': 'cors',
|
||||||
|
'Sec-Fetch-Dest': 'empty',
|
||||||
|
'Referer': 'https://st.jingxi.com/pingou/dream_factory/index.html?ptag=7155.9.4',
|
||||||
|
'Accept-Language': 'zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7'
|
||||||
|
},
|
||||||
|
'body': JSON.stringify({
|
||||||
|
"version": "1.0",
|
||||||
|
"fp": this.fingerprint,
|
||||||
|
"appId": this.appId.toString(),
|
||||||
|
"timestamp": this.timestamp,
|
||||||
|
"platform": "web",
|
||||||
|
"expandParams": ""
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
request.post(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['status'] === 200) {
|
||||||
|
let result = data.data.result
|
||||||
|
this.tk = result.tk;
|
||||||
|
let enCryptMethodJDString = result.algo;
|
||||||
|
if (enCryptMethodJDString) {
|
||||||
|
this.enCryptMethodJD = new Function(`return ${enCryptMethodJDString}`)();
|
||||||
|
}
|
||||||
|
this.result = result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e)
|
||||||
|
} finally {
|
||||||
|
resolve(this.result);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
module.exports = jxAlgo
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,204 @@
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const got = require('got');
|
||||||
|
require('dotenv').config();
|
||||||
|
const { readFile } = require('fs/promises');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const qlDir = '/ql';
|
||||||
|
const fs = require('fs');
|
||||||
|
let Fileexists = fs.existsSync('/ql/data/config/auth.json');
|
||||||
|
let authFile="";
|
||||||
|
if (Fileexists)
|
||||||
|
authFile="/ql/data/config/auth.json"
|
||||||
|
else
|
||||||
|
authFile="/ql/config/auth.json"
|
||||||
|
//const authFile = path.join(qlDir, 'config/auth.json');
|
||||||
|
|
||||||
|
const api = got.extend({
|
||||||
|
prefixUrl: 'http://127.0.0.1:5600',
|
||||||
|
retry: { limit: 0 },
|
||||||
|
});
|
||||||
|
|
||||||
|
async function getToken() {
|
||||||
|
const authConfig = JSON.parse(await readFile(authFile));
|
||||||
|
return authConfig.token;
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.getEnvs = async () => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
url: 'api/envs',
|
||||||
|
searchParams: {
|
||||||
|
searchValue: 'JD_COOKIE',
|
||||||
|
t: Date.now(),
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body.data;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.getEnvsCount = async () => {
|
||||||
|
const data = await this.getEnvs();
|
||||||
|
return data.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.addEnv = async (cookie, remarks) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'post',
|
||||||
|
url: 'api/envs',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
json: [{
|
||||||
|
name: 'JD_COOKIE',
|
||||||
|
value: cookie,
|
||||||
|
remarks,
|
||||||
|
}],
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.updateEnv = async (cookie, eid, remarks) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'put',
|
||||||
|
url: 'api/envs',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
json: {
|
||||||
|
name: 'JD_COOKIE',
|
||||||
|
value: cookie,
|
||||||
|
_id: eid,
|
||||||
|
remarks,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.updateEnv11 = async (cookie, eid, remarks) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'put',
|
||||||
|
url: 'api/envs',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
json: {
|
||||||
|
name: 'JD_COOKIE',
|
||||||
|
value: cookie,
|
||||||
|
id: eid,
|
||||||
|
remarks,
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.DisableCk = async (eid) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'put',
|
||||||
|
url: 'api/envs/disable',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
body: JSON.stringify([eid]),
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.EnableCk = async (eid) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'put',
|
||||||
|
url: 'api/envs/enable',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
body: JSON.stringify([eid]),
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.getstatus = async(eid) => {
|
||||||
|
const envs = await this.getEnvs();
|
||||||
|
var tempid = 0;
|
||||||
|
for (let i = 0; i < envs.length; i++) {
|
||||||
|
tempid = 0;
|
||||||
|
if (envs[i]._id) {
|
||||||
|
tempid = envs[i]._id;
|
||||||
|
}
|
||||||
|
if (envs[i].id) {
|
||||||
|
tempid = envs[i].id;
|
||||||
|
}
|
||||||
|
if (tempid == eid) {
|
||||||
|
return envs[i].status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 99;
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.getEnvById = async(eid) => {
|
||||||
|
const envs = await this.getEnvs();
|
||||||
|
var tempid = 0;
|
||||||
|
for (let i = 0; i < envs.length; i++) {
|
||||||
|
tempid = 0;
|
||||||
|
if (envs[i]._id) {
|
||||||
|
tempid = envs[i]._id;
|
||||||
|
}
|
||||||
|
if (envs[i].id) {
|
||||||
|
tempid = envs[i].id;
|
||||||
|
}
|
||||||
|
if (tempid == eid) {
|
||||||
|
return envs[i].value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.getEnvByPtPin = async (Ptpin) => {
|
||||||
|
const envs = await this.getEnvs();
|
||||||
|
for (let i = 0; i < envs.length; i++) {
|
||||||
|
var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||||
|
if(tempptpin==Ptpin){
|
||||||
|
return envs[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports.delEnv = async (eid) => {
|
||||||
|
const token = await getToken();
|
||||||
|
const body = await api({
|
||||||
|
method: 'delete',
|
||||||
|
url: 'api/envs',
|
||||||
|
params: { t: Date.now() },
|
||||||
|
body: JSON.stringify([eid]),
|
||||||
|
headers: {
|
||||||
|
Accept: 'application/json',
|
||||||
|
authorization: `Bearer ${token}`,
|
||||||
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
},
|
||||||
|
}).json();
|
||||||
|
return body;
|
||||||
|
};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,192 @@
|
||||||
|
/*
|
||||||
|
此文件为Node.js专用。其他用户请忽略
|
||||||
|
*/
|
||||||
|
//此处填写京东账号cookie。
|
||||||
|
let CookieJDs = [
|
||||||
|
'',//账号一ck,例:pt_key=XXX;pt_pin=XXX;
|
||||||
|
'',//账号二ck,例:pt_key=XXX;pt_pin=XXX;如有更多,依次类推
|
||||||
|
]
|
||||||
|
let IP = '';
|
||||||
|
// 判断环境变量里面是否有京东ck
|
||||||
|
if (process.env.JD_COOKIE) {
|
||||||
|
if (process.env.JD_COOKIE.indexOf('&') > -1) {
|
||||||
|
CookieJDs = process.env.JD_COOKIE.split('&');
|
||||||
|
} else if (process.env.JD_COOKIE.indexOf('\n') > -1) {
|
||||||
|
CookieJDs = process.env.JD_COOKIE.split('\n');
|
||||||
|
} else {
|
||||||
|
CookieJDs = [process.env.JD_COOKIE];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (JSON.stringify(process.env).indexOf('GITHUB') > -1) {
|
||||||
|
console.log(`请勿使用github action运行此脚本,无论你是从你自己的私库还是其他哪里拉取的源代码,都会导致我被封号\n`);
|
||||||
|
!(async () => {
|
||||||
|
await require('./sendNotify').sendNotify('提醒', `请勿使用github action、滥用github资源会封我仓库以及账号`)
|
||||||
|
await process.exit(0);
|
||||||
|
})()
|
||||||
|
}
|
||||||
|
//!(async () => {
|
||||||
|
// IP = await getIP();
|
||||||
|
// try {
|
||||||
|
// IP = IP.match(/((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})){3}/)[0];
|
||||||
|
// console.log(`\n当前公网IP: ${IP}`);
|
||||||
|
// } catch (e) { }
|
||||||
|
//})()
|
||||||
|
CookieJDs = [...new Set(CookieJDs.filter(item => !!item))]
|
||||||
|
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
|
||||||
|
console.log(`\n====================共${CookieJDs.length}个京东账号Cookie=================`);
|
||||||
|
console.log(`===========脚本执行时间:${formatdate(new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000))}============`);
|
||||||
|
console.log('>>>>>>>>>>>>6Dy提醒您:有问题先更新不行在反馈>>>>>>>>>>>>>\n');
|
||||||
|
for (let i = 0; i < CookieJDs.length; i++) {
|
||||||
|
if (!CookieJDs[i].match(/pt_pin=(.+?);/) || !CookieJDs[i].match(/pt_key=(.+?);/)) console.log(`\n提示:京东cookie 【${CookieJDs[i]}】填写不规范,可能会影响部分脚本正常使用。正确格式为: pt_key=xxx;pt_pin=xxx;(分号;不可少)\n`);
|
||||||
|
CookieJDs[i] = CookieJDs[i].replace(/[\u4e00-\u9fa5]/g, (str) => encodeURI(str));
|
||||||
|
const index = (i + 1 === 1) ? '' : (i + 1);
|
||||||
|
exports['CookieJD' + index] = CookieJDs[i].trim();
|
||||||
|
}
|
||||||
|
let permit = process.env.PERMIT_JS ? process.env.PERMIT_JS.split('&') : '';
|
||||||
|
|
||||||
|
if (process.env.DP_POOL) {
|
||||||
|
if (permit && permit.filter(x => process.mainModule.filename.includes(x)).length != 0) {
|
||||||
|
try {
|
||||||
|
require("global-agent/bootstrap");
|
||||||
|
global.GLOBAL_AGENT.HTTP_PROXY = process.env.DP_POOL;
|
||||||
|
console.log(`\n---------------使用代理池模式---------------\n`);
|
||||||
|
} catch {
|
||||||
|
throw new Error(`请安装global-agent依赖,才能启用代理!`);
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function getIP() {
|
||||||
|
const https = require('https');
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
let opt = {
|
||||||
|
hostname: "www.cip.cc",
|
||||||
|
port: 443,
|
||||||
|
path: "/",
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36',
|
||||||
|
},
|
||||||
|
timeout: 5000
|
||||||
|
}
|
||||||
|
const req = https.request(opt, (res) => {
|
||||||
|
res.setEncoding('utf-8');
|
||||||
|
let tmp = '';
|
||||||
|
res.on('error', reject);
|
||||||
|
res.on('data', d => tmp += d);
|
||||||
|
res.on('end', () => resolve(tmp));
|
||||||
|
});
|
||||||
|
|
||||||
|
req.on('error', reject);
|
||||||
|
req.end();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 以下为注入互助码环境变量(仅nodejs内起效)的代码
|
||||||
|
function SetShareCodesEnv(nameChinese = "", nameConfig = "", envName = "") {
|
||||||
|
let rawCodeConfig = {}
|
||||||
|
let fs = require('fs')
|
||||||
|
// 读取互助码
|
||||||
|
let shareCodeLogPath = fs.existsSync(`${process.env.QL_DIR}/data`) ? `${process.env.QL_DIR}/data/log/.ShareCode/${nameConfig}.log` : `${process.env.QL_DIR}/log/.ShareCode/${nameConfig}.log`;
|
||||||
|
if (fs.existsSync(shareCodeLogPath)) {
|
||||||
|
// 因为faker2目前没有自带ini,改用已有的dotenv来解析
|
||||||
|
// // 利用ini模块读取原始互助码和互助组信息
|
||||||
|
// let ini = require('ini')
|
||||||
|
// rawCodeConfig = ini.parse(fs.readFileSync(shareCodeLogPath, 'utf-8'))
|
||||||
|
|
||||||
|
// 使用env模块
|
||||||
|
require('dotenv').config({ path: shareCodeLogPath })
|
||||||
|
rawCodeConfig = process.env
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析每个用户的互助码
|
||||||
|
let codes = {}
|
||||||
|
Object.keys(rawCodeConfig).forEach(function (key) {
|
||||||
|
if (key.startsWith(`My${nameConfig}`)) {
|
||||||
|
codes[key] = rawCodeConfig[key]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 解析每个用户要帮助的互助码组,将用户实际的互助码填充进去
|
||||||
|
let helpOtherCodes = {}
|
||||||
|
Object.keys(rawCodeConfig).forEach(function (key) {
|
||||||
|
if (key.startsWith(`ForOther${nameConfig}`)) {
|
||||||
|
let helpCode = rawCodeConfig[key]
|
||||||
|
for (const [codeEnv, codeVal] of Object.entries(codes)) {
|
||||||
|
helpCode = helpCode.replace("${" + codeEnv + "}", codeVal)
|
||||||
|
}
|
||||||
|
|
||||||
|
helpOtherCodes[key] = helpCode
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 按顺序用&拼凑到一起,并放入环境变量,供目标脚本使用
|
||||||
|
let shareCodes = []
|
||||||
|
let leftIndex = 1, rightIndex = Object.keys(helpOtherCodes).length
|
||||||
|
|
||||||
|
// 判断是否是ptask并行触发,若是,则修改实际需要设置的互助码范围
|
||||||
|
let ptaskLeft = process.env.PTASK_LEFT
|
||||||
|
let ptaskRight = process.env.PTASK_RIGHT
|
||||||
|
if (ptaskLeft && ptaskRight) {
|
||||||
|
leftIndex = Number(ptaskLeft)
|
||||||
|
rightIndex = Number(ptaskRight)
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let idx = leftIndex; idx <= rightIndex; idx++) {
|
||||||
|
shareCodes.push(helpOtherCodes[`ForOther${nameConfig}${idx}`])
|
||||||
|
}
|
||||||
|
let shareCodesStr = shareCodes.join('&')
|
||||||
|
process.env[envName] = shareCodesStr
|
||||||
|
|
||||||
|
let totalCodeCount = rightIndex - leftIndex + 1
|
||||||
|
//console.info(`${nameChinese}的 互助码环境变量 ${envName},共计 ${totalCodeCount} 组互助码,总大小为 ${shareCodesStr.length} 字节`)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断当前活动脚本是否在互助脚本列表中
|
||||||
|
function IsShareJsFile() {
|
||||||
|
// 尝试获取在task_before.sh中设置的 互助活动的脚本文件名的关键部分 列表
|
||||||
|
let rawJsNameList = process.env.ShareCodeJSNameList
|
||||||
|
if (!rawJsNameList) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// 转换为list
|
||||||
|
let jsNameList = process.env.ShareCodeJSNameList.split(" ")
|
||||||
|
|
||||||
|
// 判断当前
|
||||||
|
let currentActivityScriptFileName = GetCurrentActivityScriptFileName()
|
||||||
|
|
||||||
|
let isShareJsFile = false
|
||||||
|
for (let idx = 0; idx < jsNameList.length; idx++) {
|
||||||
|
if (currentActivityScriptFileName.includes(jsNameList[idx])) {
|
||||||
|
isShareJsFile = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isShareJsFile
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前活动脚本的文件名
|
||||||
|
function GetCurrentActivityScriptFileName() {
|
||||||
|
const path = require('path')
|
||||||
|
return path.basename(process.argv[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
// 若在task_before.sh 中设置了要设置互助码环境变量的活动名称和环境变量名称信息,则在nodejs中处理,供活动使用
|
||||||
|
let nameChinese = process.env.ShareCodeConfigChineseName
|
||||||
|
let nameConfig = process.env.ShareCodeConfigName
|
||||||
|
let envName = process.env.ShareCodeEnvName
|
||||||
|
if (nameChinese && nameConfig && envName) {
|
||||||
|
SetShareCodesEnv(nameChinese, nameConfig, envName)
|
||||||
|
}
|
||||||
|
function formatdate(date) {
|
||||||
|
const year = date.getFullYear();
|
||||||
|
const month = ('0' + (date.getMonth() + 1)).slice(-2);
|
||||||
|
const day = ('0' + date.getDate()).slice(-2);
|
||||||
|
const hours = ('0' + date.getHours()).slice(-2);
|
||||||
|
const minutes = ('0' + date.getMinutes()).slice(-2);
|
||||||
|
const seconds = ('0' + date.getSeconds()).slice(-2);
|
||||||
|
return `${year}/${month}/${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,975 @@
|
||||||
|
/*
|
||||||
|
cron "6 6 6 6 *" jd_CheckCK.js, tag:京东CK检测by-ccwav
|
||||||
|
*/
|
||||||
|
//详细说明参考 https://github.com/ccwav/QLScript2.
|
||||||
|
const $ = new Env('CK检测');
|
||||||
|
const notify = $.isNode() ? require('./sendNotify') : '';
|
||||||
|
//Node.js用户请在jdCookie.js处填写京东ck;
|
||||||
|
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
|
||||||
|
const got = require('got');
|
||||||
|
const {
|
||||||
|
getEnvs,
|
||||||
|
getEnvById,
|
||||||
|
DisableCk,
|
||||||
|
EnableCk,
|
||||||
|
getstatus
|
||||||
|
} = require('./function/ql');
|
||||||
|
const api = got.extend({
|
||||||
|
retry: {
|
||||||
|
limit: 0
|
||||||
|
},
|
||||||
|
responseType: 'json',
|
||||||
|
});
|
||||||
|
|
||||||
|
let ShowSuccess = "false",
|
||||||
|
CKAlwaysNotify = "false",
|
||||||
|
CKAutoEnable = "false",
|
||||||
|
NoWarnError = "false";
|
||||||
|
|
||||||
|
let MessageUserGp2 = "";
|
||||||
|
let MessageUserGp3 = "";
|
||||||
|
let MessageUserGp4 = "";
|
||||||
|
|
||||||
|
let MessageGp2 = "";
|
||||||
|
let MessageGp3 = "";
|
||||||
|
let MessageGp4 = "";
|
||||||
|
let MessageAll = "";
|
||||||
|
|
||||||
|
let userIndex2 = -1;
|
||||||
|
let userIndex3 = -1;
|
||||||
|
let userIndex4 = -1;
|
||||||
|
|
||||||
|
let IndexGp2 = 0;
|
||||||
|
let IndexGp3 = 0;
|
||||||
|
let IndexGp4 = 0;
|
||||||
|
let IndexAll = 0;
|
||||||
|
|
||||||
|
let TempErrorMessage = '',
|
||||||
|
TempSuccessMessage = '',
|
||||||
|
TempDisableMessage = '',
|
||||||
|
TempEnableMessage = '',
|
||||||
|
TempOErrorMessage = '';
|
||||||
|
|
||||||
|
let allMessage = '',
|
||||||
|
ErrorMessage = '',
|
||||||
|
SuccessMessage = '',
|
||||||
|
DisableMessage = '',
|
||||||
|
EnableMessage = '',
|
||||||
|
OErrorMessage = '';
|
||||||
|
|
||||||
|
let allMessageGp2 = '',
|
||||||
|
ErrorMessageGp2 = '',
|
||||||
|
SuccessMessageGp2 = '',
|
||||||
|
DisableMessageGp2 = '',
|
||||||
|
EnableMessageGp2 = '',
|
||||||
|
OErrorMessageGp2 = '';
|
||||||
|
|
||||||
|
let allMessageGp3 = '',
|
||||||
|
ErrorMessageGp3 = '',
|
||||||
|
SuccessMessageGp3 = '',
|
||||||
|
DisableMessageGp3 = '',
|
||||||
|
EnableMessageGp3 = '',
|
||||||
|
OErrorMessageGp3 = '';
|
||||||
|
|
||||||
|
let allMessageGp4 = '',
|
||||||
|
ErrorMessageGp4 = '',
|
||||||
|
SuccessMessageGp4 = '',
|
||||||
|
DisableMessageGp4 = '',
|
||||||
|
EnableMessageGp4 = '',
|
||||||
|
OErrorMessageGp4 = '';
|
||||||
|
|
||||||
|
let strAllNotify = "";
|
||||||
|
let strNotifyOneTemp = "";
|
||||||
|
let WP_APP_TOKEN_ONE = "";
|
||||||
|
if ($.isNode() && process.env.WP_APP_TOKEN_ONE) {
|
||||||
|
WP_APP_TOKEN_ONE = process.env.WP_APP_TOKEN_ONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
let ReturnMessageTitle = '';
|
||||||
|
|
||||||
|
if ($.isNode() && process.env.BEANCHANGE_USERGP2) {
|
||||||
|
MessageUserGp2 = process.env.BEANCHANGE_USERGP2 ? process.env.BEANCHANGE_USERGP2.split('&') : [];
|
||||||
|
console.log(`检测到设定了分组推送2`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && process.env.BEANCHANGE_USERGP3) {
|
||||||
|
MessageUserGp3 = process.env.BEANCHANGE_USERGP3 ? process.env.BEANCHANGE_USERGP3.split('&') : [];
|
||||||
|
console.log(`检测到设定了分组推送3`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && process.env.BEANCHANGE_USERGP4) {
|
||||||
|
MessageUserGp4 = process.env.BEANCHANGE_USERGP4 ? process.env.BEANCHANGE_USERGP4.split('&') : [];
|
||||||
|
console.log(`检测到设定了分组推送4`);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && process.env.CHECKCK_SHOWSUCCESSCK) {
|
||||||
|
ShowSuccess = process.env.CHECKCK_SHOWSUCCESSCK;
|
||||||
|
}
|
||||||
|
if ($.isNode() && process.env.CHECKCK_CKALWAYSNOTIFY) {
|
||||||
|
CKAlwaysNotify = process.env.CHECKCK_CKALWAYSNOTIFY;
|
||||||
|
}
|
||||||
|
if ($.isNode() && process.env.CHECKCK_CKAUTOENABLE) {
|
||||||
|
CKAutoEnable = process.env.CHECKCK_CKAUTOENABLE;
|
||||||
|
}
|
||||||
|
if ($.isNode() && process.env.CHECKCK_CKNOWARNERROR) {
|
||||||
|
NoWarnError = process.env.CHECKCK_CKNOWARNERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && process.env.CHECKCK_ALLNOTIFY) {
|
||||||
|
|
||||||
|
strAllNotify = process.env.CHECKCK_ALLNOTIFY;
|
||||||
|
/* if (strTempNotify.length > 0) {
|
||||||
|
for (var TempNotifyl in strTempNotify) {
|
||||||
|
strAllNotify += strTempNotify[TempNotifyl] + '\n';
|
||||||
|
}
|
||||||
|
} */
|
||||||
|
console.log(`检测到设定了温馨提示,将在推送信息中置顶显示...`);
|
||||||
|
strAllNotify = `\n【✨✨✨✨温馨提示✨✨✨✨】\n` + strAllNotify;
|
||||||
|
console.log(strAllNotify);
|
||||||
|
}
|
||||||
|
|
||||||
|
!(async() => {
|
||||||
|
const envs = await getEnvs();
|
||||||
|
if (!envs[0]) {
|
||||||
|
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {
|
||||||
|
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.log(`\n默认不自动启用CK,开启变量CHECKCK_CKAUTOENABLE='true'`);
|
||||||
|
for (let i = 0; i < envs.length; i++) {
|
||||||
|
if (envs[i].value) {
|
||||||
|
var tempid=0;
|
||||||
|
if(envs[i]._id){
|
||||||
|
tempid=envs[i]._id;
|
||||||
|
}
|
||||||
|
if(envs[i].id){
|
||||||
|
tempid=envs[i].id;
|
||||||
|
}
|
||||||
|
cookie = await getEnvById(tempid);
|
||||||
|
$.UserName = (cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
|
||||||
|
$.UserName2 = decodeURIComponent($.UserName);
|
||||||
|
$.index = i + 1;
|
||||||
|
$.isLogin = true;
|
||||||
|
$.error = '';
|
||||||
|
$.NoReturn = '';
|
||||||
|
$.nickName = "";
|
||||||
|
TempErrorMessage = '';
|
||||||
|
TempSuccessMessage = '';
|
||||||
|
TempDisableMessage = '';
|
||||||
|
TempEnableMessage = '';
|
||||||
|
TempOErrorMessage = '';
|
||||||
|
|
||||||
|
console.log(`开始检测【京东账号${$.index}】${$.UserName2} ....\n`);
|
||||||
|
if (MessageUserGp4) {
|
||||||
|
userIndex4 = MessageUserGp4.findIndex((item) => item === $.UserName);
|
||||||
|
}
|
||||||
|
if (MessageUserGp2) {
|
||||||
|
|
||||||
|
userIndex2 = MessageUserGp2.findIndex((item) => item === $.UserName);
|
||||||
|
}
|
||||||
|
if (MessageUserGp3) {
|
||||||
|
|
||||||
|
userIndex3 = MessageUserGp3.findIndex((item) => item === $.UserName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userIndex2 != -1) {
|
||||||
|
console.log(`账号属于分组2`);
|
||||||
|
IndexGp2 += 1;
|
||||||
|
ReturnMessageTitle = `【账号${IndexGp2}🆔】${$.UserName2}`;
|
||||||
|
}
|
||||||
|
if (userIndex3 != -1) {
|
||||||
|
console.log(`账号属于分组3`);
|
||||||
|
IndexGp3 += 1;
|
||||||
|
ReturnMessageTitle = `【账号${IndexGp3}🆔】${$.UserName2}`;
|
||||||
|
}
|
||||||
|
if (userIndex4 != -1) {
|
||||||
|
console.log(`账号属于分组4`);
|
||||||
|
IndexGp4 += 1;
|
||||||
|
ReturnMessageTitle = `【账号${IndexGp4}🆔】${$.UserName2}`;
|
||||||
|
}
|
||||||
|
if (userIndex4 == -1 && userIndex2 == -1 && userIndex3 == -1) {
|
||||||
|
console.log(`账号没有分组`);
|
||||||
|
IndexAll += 1;
|
||||||
|
ReturnMessageTitle = `【账号${IndexAll}🆔】${$.UserName2}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
await TotalBean();
|
||||||
|
if ($.NoReturn) {
|
||||||
|
console.log(`接口1检测失败,尝试使用接口2....\n`);
|
||||||
|
await isLoginByX1a0He();
|
||||||
|
} else {
|
||||||
|
if ($.isLogin) {
|
||||||
|
if (!$.nickName) {
|
||||||
|
console.log(`获取的别名为空,尝试使用接口2验证....\n`);
|
||||||
|
await isLoginByX1a0He();
|
||||||
|
} else {
|
||||||
|
console.log(`成功获取到别名: ${$.nickName},Pass!\n`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.error) {
|
||||||
|
console.log(`有错误,跳出....`);
|
||||||
|
TempOErrorMessage = $.error;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
const strnowstatus = await getstatus(tempid);
|
||||||
|
if (strnowstatus == 99) {
|
||||||
|
strnowstatus = envs[i].status;
|
||||||
|
}
|
||||||
|
if (!$.isLogin) {
|
||||||
|
|
||||||
|
if (strnowstatus == 0) {
|
||||||
|
const DisableCkBody = await DisableCk(tempid);
|
||||||
|
if (DisableCkBody.code == 200) {
|
||||||
|
if ($.isNode() && WP_APP_TOKEN_ONE) {
|
||||||
|
strNotifyOneTemp = `京东账号: ${$.nickName || $.UserName2} 已失效,自动禁用成功!\n如果要继续挂机,请联系管理员重新登录账号,账号有效期为30天.`
|
||||||
|
|
||||||
|
if (strAllNotify)
|
||||||
|
strNotifyOneTemp += `\n` + strAllNotify;
|
||||||
|
|
||||||
|
await notify.sendNotifybyWxPucher(`${$.name}`, strNotifyOneTemp, `${$.UserName2}`);
|
||||||
|
}
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已失效,自动禁用成功!\n`);
|
||||||
|
TempDisableMessage = ReturnMessageTitle + ` (自动禁用成功!)\n`;
|
||||||
|
TempErrorMessage = ReturnMessageTitle + ` 已失效,自动禁用成功!\n`;
|
||||||
|
} else {
|
||||||
|
if ($.isNode() && WP_APP_TOKEN_ONE) {
|
||||||
|
strNotifyOneTemp = `京东账号: ${$.nickName || $.UserName2} 已失效!\n如果要继续挂机,请联系管理员重新登录账号,账号有效期为30天.`
|
||||||
|
|
||||||
|
if (strAllNotify)
|
||||||
|
strNotifyOneTemp += `\n` + strAllNotify;
|
||||||
|
|
||||||
|
await notify.sendNotifybyWxPucher(`${$.name}`, strNotifyOneTemp, `${$.UserName2}`);
|
||||||
|
}
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已失效,自动禁用失败!\n`);
|
||||||
|
TempDisableMessage = ReturnMessageTitle + ` (自动禁用失败!)\n`;
|
||||||
|
TempErrorMessage = ReturnMessageTitle + ` 已失效,自动禁用失败!\n`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已失效,已禁用!\n`);
|
||||||
|
TempErrorMessage = ReturnMessageTitle + ` 已失效,已禁用.\n`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (strnowstatus == 1) {
|
||||||
|
|
||||||
|
if (CKAutoEnable == "true") {
|
||||||
|
const EnableCkBody = await EnableCk(tempid);
|
||||||
|
if (EnableCkBody.code == 200) {
|
||||||
|
if ($.isNode() && WP_APP_TOKEN_ONE) {
|
||||||
|
await notify.sendNotifybyWxPucher(`${$.name}`, `京东账号: ${$.nickName || $.UserName2} 已恢复,自动启用成功!\n祝您挂机愉快...`, `${$.UserName2}`);
|
||||||
|
}
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已恢复,自动启用成功!\n`);
|
||||||
|
TempEnableMessage = ReturnMessageTitle + ` (自动启用成功!)\n`;
|
||||||
|
TempSuccessMessage = ReturnMessageTitle + ` (自动启用成功!)\n`;
|
||||||
|
} else {
|
||||||
|
if ($.isNode() && WP_APP_TOKEN_ONE) {
|
||||||
|
await notify.sendNotifybyWxPucher(`${$.name}`, `京东账号: ${$.nickName || $.UserName2} 已恢复,但自动启用失败!\n请联系管理员处理...`, `${$.UserName2}`);
|
||||||
|
}
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已恢复,但自动启用失败!\n`);
|
||||||
|
TempEnableMessage = ReturnMessageTitle + ` (自动启用失败!)\n`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 已恢复,可手动启用!\n`);
|
||||||
|
TempEnableMessage = ReturnMessageTitle + ` 已恢复,可手动启用.\n`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log(`京东账号${$.index} : ${$.nickName || $.UserName2} 状态正常!\n`);
|
||||||
|
TempSuccessMessage = ReturnMessageTitle + `\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userIndex2 != -1) {
|
||||||
|
ErrorMessageGp2 += TempErrorMessage;
|
||||||
|
SuccessMessageGp2 += TempSuccessMessage;
|
||||||
|
DisableMessageGp2 += TempDisableMessage;
|
||||||
|
EnableMessageGp2 += TempEnableMessage;
|
||||||
|
OErrorMessageGp2 += TempOErrorMessage;
|
||||||
|
}
|
||||||
|
if (userIndex3 != -1) {
|
||||||
|
ErrorMessageGp3 += TempErrorMessage;
|
||||||
|
SuccessMessageGp3 += TempSuccessMessage;
|
||||||
|
DisableMessageGp3 += TempDisableMessage;
|
||||||
|
EnableMessageGp3 += TempEnableMessage;
|
||||||
|
OErrorMessageGp3 += TempOErrorMessage;
|
||||||
|
}
|
||||||
|
if (userIndex4 != -1) {
|
||||||
|
ErrorMessageGp4 += TempErrorMessage;
|
||||||
|
SuccessMessageGp4 += TempSuccessMessage;
|
||||||
|
DisableMessageGp4 += TempDisableMessage;
|
||||||
|
EnableMessageGp4 += TempEnableMessage;
|
||||||
|
OErrorMessageGp4 += TempOErrorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userIndex4 == -1 && userIndex2 == -1 && userIndex3 == -1) {
|
||||||
|
ErrorMessage += TempErrorMessage;
|
||||||
|
SuccessMessage += TempSuccessMessage;
|
||||||
|
DisableMessage += TempDisableMessage;
|
||||||
|
EnableMessage += TempEnableMessage;
|
||||||
|
OErrorMessage += TempOErrorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
console.log(`等待2秒....... \n`);
|
||||||
|
await $.wait(2 * 1000)
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode()) {
|
||||||
|
if (MessageUserGp2) {
|
||||||
|
if (OErrorMessageGp2) {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessageGp2 + `\n\n`;
|
||||||
|
}
|
||||||
|
if (DisableMessageGp2) {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessageGp2 + `\n\n`;
|
||||||
|
}
|
||||||
|
if (EnableMessageGp2) {
|
||||||
|
if (CKAutoEnable == "true") {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessageGp2 + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessageGp2 + `\n\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ErrorMessageGp2) {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessageGp2 + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ShowSuccess == "true" && SuccessMessage) {
|
||||||
|
allMessageGp2 += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessageGp2 + `\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NoWarnError == "true") {
|
||||||
|
OErrorMessageGp2 = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && (EnableMessageGp2 || DisableMessageGp2 || OErrorMessageGp2 || CKAlwaysNotify == "true")) {
|
||||||
|
console.log("京东CK检测#2:");
|
||||||
|
console.log(allMessageGp2);
|
||||||
|
|
||||||
|
if (strAllNotify)
|
||||||
|
allMessageGp2 += `\n` + strAllNotify;
|
||||||
|
|
||||||
|
await notify.sendNotify("京东CK检测#2", `${allMessageGp2}`, {
|
||||||
|
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MessageUserGp3) {
|
||||||
|
if (OErrorMessageGp3) {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessageGp3 + `\n\n`;
|
||||||
|
}
|
||||||
|
if (DisableMessageGp3) {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessageGp3 + `\n\n`;
|
||||||
|
}
|
||||||
|
if (EnableMessageGp3) {
|
||||||
|
if (CKAutoEnable == "true") {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessageGp3 + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessageGp3 + `\n\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ErrorMessageGp3) {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessageGp3 + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ShowSuccess == "true" && SuccessMessage) {
|
||||||
|
allMessageGp3 += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessageGp3 + `\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NoWarnError == "true") {
|
||||||
|
OErrorMessageGp3 = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && (EnableMessageGp3 || DisableMessageGp3 || OErrorMessageGp3 || CKAlwaysNotify == "true")) {
|
||||||
|
console.log("京东CK检测#3:");
|
||||||
|
console.log(allMessageGp3);
|
||||||
|
if (strAllNotify)
|
||||||
|
allMessageGp3 += `\n` + strAllNotify;
|
||||||
|
|
||||||
|
await notify.sendNotify("京东CK检测#3", `${allMessageGp3}`, {
|
||||||
|
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (MessageUserGp4) {
|
||||||
|
if (OErrorMessageGp4) {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessageGp4 + `\n\n`;
|
||||||
|
}
|
||||||
|
if (DisableMessageGp4) {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessageGp4 + `\n\n`;
|
||||||
|
}
|
||||||
|
if (EnableMessageGp4) {
|
||||||
|
if (CKAutoEnable == "true") {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessageGp4 + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessageGp4 + `\n\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ErrorMessageGp4) {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessageGp4 + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ShowSuccess == "true" && SuccessMessage) {
|
||||||
|
allMessageGp4 += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessageGp4 + `\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NoWarnError == "true") {
|
||||||
|
OErrorMessageGp4 = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && (EnableMessageGp4 || DisableMessageGp4 || OErrorMessageGp4 || CKAlwaysNotify == "true")) {
|
||||||
|
console.log("京东CK检测#4:");
|
||||||
|
console.log(allMessageGp4);
|
||||||
|
if (strAllNotify)
|
||||||
|
allMessageGp4 += `\n` + strAllNotify;
|
||||||
|
|
||||||
|
await notify.sendNotify("京东CK检测#4", `${allMessageGp4}`, {
|
||||||
|
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (OErrorMessage) {
|
||||||
|
allMessage += `👇👇👇👇👇检测出错账号👇👇👇👇👇\n` + OErrorMessage + `\n\n`;
|
||||||
|
}
|
||||||
|
if (DisableMessage) {
|
||||||
|
allMessage += `👇👇👇👇👇自动禁用账号👇👇👇👇👇\n` + DisableMessage + `\n\n`;
|
||||||
|
}
|
||||||
|
if (EnableMessage) {
|
||||||
|
if (CKAutoEnable == "true") {
|
||||||
|
allMessage += `👇👇👇👇👇自动启用账号👇👇👇👇👇\n` + EnableMessage + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessage += `👇👇👇👇👇账号已恢复👇👇👇👇👇\n` + EnableMessage + `\n\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ErrorMessage) {
|
||||||
|
allMessage += `👇👇👇👇👇失效账号👇👇👇👇👇\n` + ErrorMessage + `\n\n`;
|
||||||
|
} else {
|
||||||
|
allMessage += `👇👇👇👇👇失效账号👇👇👇👇👇\n 一个失效的都没有呢,羡慕啊...\n\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ShowSuccess == "true" && SuccessMessage) {
|
||||||
|
allMessage += `👇👇👇👇👇有效账号👇👇👇👇👇\n` + SuccessMessage + `\n`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NoWarnError == "true") {
|
||||||
|
OErrorMessage = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($.isNode() && (EnableMessage || DisableMessage || OErrorMessage || CKAlwaysNotify == "true")) {
|
||||||
|
console.log("京东CK检测:");
|
||||||
|
console.log(allMessage);
|
||||||
|
if (strAllNotify)
|
||||||
|
allMessage += `\n` + strAllNotify;
|
||||||
|
|
||||||
|
await notify.sendNotify(`${$.name}`, `${allMessage}`, {
|
||||||
|
url: `https://bean.m.jd.com/beanDetail/index.action?resourceValue=bean`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})()
|
||||||
|
.catch((e) => $.logErr(e))
|
||||||
|
.finally(() => $.done())
|
||||||
|
|
||||||
|
function TotalBean() {
|
||||||
|
return new Promise(async resolve => {
|
||||||
|
const options = {
|
||||||
|
url: "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion",
|
||||||
|
headers: {
|
||||||
|
Host: "me-api.jd.com",
|
||||||
|
Accept: "*/*",
|
||||||
|
Connection: "keep-alive",
|
||||||
|
Cookie: cookie,
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 Edg/106.0.1370.42",
|
||||||
|
"Accept-Language": "zh-cn",
|
||||||
|
"Referer": "https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&",
|
||||||
|
"Accept-Encoding": "gzip, deflate, br"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (err) {
|
||||||
|
$.logErr(err)
|
||||||
|
$.nickName = decodeURIComponent($.UserName);
|
||||||
|
$.NoReturn = `${$.nickName} :` + `${JSON.stringify(err)}\n`;
|
||||||
|
} else {
|
||||||
|
if (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data['retcode'] === "1001") {
|
||||||
|
$.isLogin = false; //cookie过期
|
||||||
|
$.nickName = decodeURIComponent($.UserName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (data['retcode'] === "0" && data.data && data.data.hasOwnProperty("userInfo")) {
|
||||||
|
$.nickName = (data.data.userInfo.baseInfo.nickname);
|
||||||
|
} else {
|
||||||
|
$.nickName = decodeURIComponent($.UserName);
|
||||||
|
console.log("Debug Code:" + data['retcode']);
|
||||||
|
$.NoReturn = `${$.nickName} :` + `服务器返回未知状态,不做变动\n`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$.nickName = decodeURIComponent($.UserName);
|
||||||
|
$.log('京东服务器返回空数据');
|
||||||
|
$.NoReturn = `${$.nickName} :` + `服务器返回空数据,不做变动\n`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
$.nickName = decodeURIComponent($.UserName);
|
||||||
|
$.logErr(e)
|
||||||
|
$.NoReturn = `${$.nickName} : 检测出错,不做变动\n`;
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
function isLoginByX1a0He() {
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
const options = {
|
||||||
|
url: 'https://plogin.m.jd.com/cgi-bin/ml/islogin',
|
||||||
|
headers: {
|
||||||
|
"Cookie": cookie,
|
||||||
|
"referer": "https://h5.m.jd.com/",
|
||||||
|
"User-Agent": "jdapp;iPhone;10.1.2;15.0;network/wifi;Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
$.get(options, (err, resp, data) => {
|
||||||
|
try {
|
||||||
|
if (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
if (data.islogin === "1") {
|
||||||
|
console.log(`使用X1a0He写的接口加强检测: Cookie有效\n`)
|
||||||
|
} else if (data.islogin === "0") {
|
||||||
|
$.isLogin = false;
|
||||||
|
console.log(`使用X1a0He写的接口加强检测: Cookie无效\n`)
|
||||||
|
} else {
|
||||||
|
console.log(`使用X1a0He写的接口加强检测: 未知返回,不作变更...\n`)
|
||||||
|
$.error = `${$.nickName} :` + `使用X1a0He写的接口加强检测: 未知返回...\n`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function jsonParse(str) {
|
||||||
|
if (typeof str == "string") {
|
||||||
|
try {
|
||||||
|
return JSON.parse(str);
|
||||||
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
|
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// prettier-ignore
|
||||||
|
function Env(t, e) {
|
||||||
|
"undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0);
|
||||||
|
class s {
|
||||||
|
constructor(t) {
|
||||||
|
this.env = t
|
||||||
|
}
|
||||||
|
send(t, e = "GET") {
|
||||||
|
t = "string" == typeof t ? {
|
||||||
|
url: t
|
||||||
|
}
|
||||||
|
: t;
|
||||||
|
let s = this.get;
|
||||||
|
return "POST" === e && (s = this.post),
|
||||||
|
new Promise((e, i) => {
|
||||||
|
s.call(this, t, (t, s, r) => {
|
||||||
|
t ? i(t) : e(s)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
get(t) {
|
||||||
|
return this.send.call(this.env, t)
|
||||||
|
}
|
||||||
|
post(t) {
|
||||||
|
return this.send.call(this.env, t, "POST")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new class {
|
||||||
|
constructor(t, e) {
|
||||||
|
this.name = t,
|
||||||
|
this.http = new s(this),
|
||||||
|
this.data = null,
|
||||||
|
this.dataFile = "box.dat",
|
||||||
|
this.logs = [],
|
||||||
|
this.isMute = !1,
|
||||||
|
this.isNeedRewrite = !1,
|
||||||
|
this.logSeparator = "\n",
|
||||||
|
this.startTime = (new Date).getTime(),
|
||||||
|
Object.assign(this, e),
|
||||||
|
this.log("", `🔔${this.name}, 开始!`)
|
||||||
|
}
|
||||||
|
isNode() {
|
||||||
|
return "undefined" != typeof module && !!module.exports
|
||||||
|
}
|
||||||
|
isQuanX() {
|
||||||
|
return "undefined" != typeof $task
|
||||||
|
}
|
||||||
|
isSurge() {
|
||||||
|
return "undefined" != typeof $httpClient && "undefined" == typeof $loon
|
||||||
|
}
|
||||||
|
isLoon() {
|
||||||
|
return "undefined" != typeof $loon
|
||||||
|
}
|
||||||
|
toObj(t, e = null) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(t)
|
||||||
|
} catch {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
toStr(t, e = null) {
|
||||||
|
try {
|
||||||
|
return JSON.stringify(t)
|
||||||
|
} catch {
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getjson(t, e) {
|
||||||
|
let s = e;
|
||||||
|
const i = this.getdata(t);
|
||||||
|
if (i)
|
||||||
|
try {
|
||||||
|
s = JSON.parse(this.getdata(t))
|
||||||
|
} catch {}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
setjson(t, e) {
|
||||||
|
try {
|
||||||
|
return this.setdata(JSON.stringify(t), e)
|
||||||
|
} catch {
|
||||||
|
return !1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
getScript(t) {
|
||||||
|
return new Promise(e => {
|
||||||
|
this.get({
|
||||||
|
url: t
|
||||||
|
}, (t, s, i) => e(i))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
runScript(t, e) {
|
||||||
|
return new Promise(s => {
|
||||||
|
let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
|
||||||
|
i = i ? i.replace(/\n/g, "").trim() : i;
|
||||||
|
let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
|
||||||
|
r = r ? 1 * r : 20,
|
||||||
|
r = e && e.timeout ? e.timeout : r;
|
||||||
|
const[o, h] = i.split("@"),
|
||||||
|
n = {
|
||||||
|
url: `http://${h}/v1/scripting/evaluate`,
|
||||||
|
body: {
|
||||||
|
script_text: t,
|
||||||
|
mock_type: "cron",
|
||||||
|
timeout: r
|
||||||
|
},
|
||||||
|
headers: {
|
||||||
|
"X-Key": o,
|
||||||
|
Accept: "*/*"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
this.post(n, (t, e, i) => s(i))
|
||||||
|
}).catch(t => this.logErr(t))
|
||||||
|
}
|
||||||
|
loaddata() {
|
||||||
|
if (!this.isNode())
|
||||||
|
return {}; {
|
||||||
|
this.fs = this.fs ? this.fs : require("fs"),
|
||||||
|
this.path = this.path ? this.path : require("path");
|
||||||
|
const t = this.path.resolve(this.dataFile),
|
||||||
|
e = this.path.resolve(process.cwd(), this.dataFile),
|
||||||
|
s = this.fs.existsSync(t),
|
||||||
|
i = !s && this.fs.existsSync(e);
|
||||||
|
if (!s && !i)
|
||||||
|
return {}; {
|
||||||
|
const i = s ? t : e;
|
||||||
|
try {
|
||||||
|
return JSON.parse(this.fs.readFileSync(i))
|
||||||
|
} catch (t) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writedata() {
|
||||||
|
if (this.isNode()) {
|
||||||
|
this.fs = this.fs ? this.fs : require("fs"),
|
||||||
|
this.path = this.path ? this.path : require("path");
|
||||||
|
const t = this.path.resolve(this.dataFile),
|
||||||
|
e = this.path.resolve(process.cwd(), this.dataFile),
|
||||||
|
s = this.fs.existsSync(t),
|
||||||
|
i = !s && this.fs.existsSync(e),
|
||||||
|
r = JSON.stringify(this.data);
|
||||||
|
s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lodash_get(t, e, s) {
|
||||||
|
const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
|
||||||
|
let r = t;
|
||||||
|
for (const t of i)
|
||||||
|
if (r = Object(r)[t], void 0 === r)
|
||||||
|
return s;
|
||||||
|
return r
|
||||||
|
}
|
||||||
|
lodash_set(t, e, s) {
|
||||||
|
return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
|
||||||
|
}
|
||||||
|
getdata(t) {
|
||||||
|
let e = this.getval(t);
|
||||||
|
if (/^@/.test(t)) {
|
||||||
|
const[, s, i] = /^@(.*?)\.(.*?)$/.exec(t),
|
||||||
|
r = s ? this.getval(s) : "";
|
||||||
|
if (r)
|
||||||
|
try {
|
||||||
|
const t = JSON.parse(r);
|
||||||
|
e = t ? this.lodash_get(t, i, "") : e
|
||||||
|
} catch (t) {
|
||||||
|
e = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e
|
||||||
|
}
|
||||||
|
setdata(t, e) {
|
||||||
|
let s = !1;
|
||||||
|
if (/^@/.test(e)) {
|
||||||
|
const[, i, r] = /^@(.*?)\.(.*?)$/.exec(e),
|
||||||
|
o = this.getval(i),
|
||||||
|
h = i ? "null" === o ? null : o || "{}" : "{}";
|
||||||
|
try {
|
||||||
|
const e = JSON.parse(h);
|
||||||
|
this.lodash_set(e, r, t),
|
||||||
|
s = this.setval(JSON.stringify(e), i)
|
||||||
|
} catch (e) {
|
||||||
|
const o = {};
|
||||||
|
this.lodash_set(o, r, t),
|
||||||
|
s = this.setval(JSON.stringify(o), i)
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
s = this.setval(t, e);
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
getval(t) {
|
||||||
|
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
|
||||||
|
}
|
||||||
|
setval(t, e) {
|
||||||
|
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
|
||||||
|
}
|
||||||
|
initGotEnv(t) {
|
||||||
|
this.got = this.got ? this.got : require("got"),
|
||||||
|
this.cktough = this.cktough ? this.cktough : require("tough-cookie"),
|
||||||
|
this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar,
|
||||||
|
t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
|
||||||
|
}
|
||||||
|
get(t, e = (() => {})) {
|
||||||
|
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]),
|
||||||
|
this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
|
||||||
|
"X-Surge-Skip-Scripting": !1
|
||||||
|
})), $httpClient.get(t, (t, s, i) => {
|
||||||
|
!t && s && (s.body = i, s.statusCode = s.status),
|
||||||
|
e(t, s, i)
|
||||||
|
})) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
|
||||||
|
hints: !1
|
||||||
|
})), $task.fetch(t).then(t => {
|
||||||
|
const {
|
||||||
|
statusCode: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
} = t;
|
||||||
|
e(null, {
|
||||||
|
status: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
}, o)
|
||||||
|
}, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
|
||||||
|
try {
|
||||||
|
if (t.headers["set-cookie"]) {
|
||||||
|
const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
|
||||||
|
s && this.ckjar.setCookieSync(s, null),
|
||||||
|
e.cookieJar = this.ckjar
|
||||||
|
}
|
||||||
|
} catch (t) {
|
||||||
|
this.logErr(t)
|
||||||
|
}
|
||||||
|
}).then(t => {
|
||||||
|
const {
|
||||||
|
statusCode: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
} = t;
|
||||||
|
e(null, {
|
||||||
|
status: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
}, o)
|
||||||
|
}, t => {
|
||||||
|
const {
|
||||||
|
message: s,
|
||||||
|
response: i
|
||||||
|
} = t;
|
||||||
|
e(s, i, i && i.body)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
post(t, e = (() => {})) {
|
||||||
|
if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon())
|
||||||
|
this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
|
||||||
|
"X-Surge-Skip-Scripting": !1
|
||||||
|
})), $httpClient.post(t, (t, s, i) => {
|
||||||
|
!t && s && (s.body = i, s.statusCode = s.status),
|
||||||
|
e(t, s, i)
|
||||||
|
});
|
||||||
|
else if (this.isQuanX())
|
||||||
|
t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
|
||||||
|
hints: !1
|
||||||
|
})), $task.fetch(t).then(t => {
|
||||||
|
const {
|
||||||
|
statusCode: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
} = t;
|
||||||
|
e(null, {
|
||||||
|
status: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
}, o)
|
||||||
|
}, t => e(t));
|
||||||
|
else if (this.isNode()) {
|
||||||
|
this.initGotEnv(t);
|
||||||
|
const {
|
||||||
|
url: s,
|
||||||
|
...i
|
||||||
|
} = t;
|
||||||
|
this.got.post(s, i).then(t => {
|
||||||
|
const {
|
||||||
|
statusCode: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
} = t;
|
||||||
|
e(null, {
|
||||||
|
status: s,
|
||||||
|
statusCode: i,
|
||||||
|
headers: r,
|
||||||
|
body: o
|
||||||
|
}, o)
|
||||||
|
}, t => {
|
||||||
|
const {
|
||||||
|
message: s,
|
||||||
|
response: i
|
||||||
|
} = t;
|
||||||
|
e(s, i, i && i.body)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
time(t, e = null) {
|
||||||
|
const s = e ? new Date(e) : new Date;
|
||||||
|
let i = {
|
||||||
|
"M+": s.getMonth() + 1,
|
||||||
|
"d+": s.getDate(),
|
||||||
|
"H+": s.getHours(),
|
||||||
|
"m+": s.getMinutes(),
|
||||||
|
"s+": s.getSeconds(),
|
||||||
|
"q+": Math.floor((s.getMonth() + 3) / 3),
|
||||||
|
S: s.getMilliseconds()
|
||||||
|
};
|
||||||
|
/(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length)));
|
||||||
|
for (let e in i)
|
||||||
|
new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length)));
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
msg(e = t, s = "", i = "", r) {
|
||||||
|
const o = t => {
|
||||||
|
if (!t)
|
||||||
|
return t;
|
||||||
|
if ("string" == typeof t)
|
||||||
|
return this.isLoon() ? t : this.isQuanX() ? {
|
||||||
|
"open-url": t
|
||||||
|
}
|
||||||
|
: this.isSurge() ? {
|
||||||
|
url: t
|
||||||
|
}
|
||||||
|
: void 0;
|
||||||
|
if ("object" == typeof t) {
|
||||||
|
if (this.isLoon()) {
|
||||||
|
let e = t.openUrl || t.url || t["open-url"],
|
||||||
|
s = t.mediaUrl || t["media-url"];
|
||||||
|
return {
|
||||||
|
openUrl: e,
|
||||||
|
mediaUrl: s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.isQuanX()) {
|
||||||
|
let e = t["open-url"] || t.url || t.openUrl,
|
||||||
|
s = t["media-url"] || t.mediaUrl;
|
||||||
|
return {
|
||||||
|
"open-url": e,
|
||||||
|
"media-url": s
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.isSurge()) {
|
||||||
|
let e = t.url || t.openUrl || t["open-url"];
|
||||||
|
return {
|
||||||
|
url: e
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
|
||||||
|
let t = ["", "==============📣系统通知📣=============="];
|
||||||
|
t.push(e),
|
||||||
|
s && t.push(s),
|
||||||
|
i && t.push(i),
|
||||||
|
console.log(t.join("\n")),
|
||||||
|
this.logs = this.logs.concat(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log(...t) {
|
||||||
|
t.length > 0 && (this.logs = [...this.logs, ...t]),
|
||||||
|
console.log(t.join(this.logSeparator))
|
||||||
|
}
|
||||||
|
logErr(t, e) {
|
||||||
|
const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
|
||||||
|
s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t)
|
||||||
|
}
|
||||||
|
wait(t) {
|
||||||
|
return new Promise(e => setTimeout(e, t))
|
||||||
|
}
|
||||||
|
done(t = {}) {
|
||||||
|
const e = (new Date).getTime(),
|
||||||
|
s = (e - this.startTime) / 1e3;
|
||||||
|
this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`),
|
||||||
|
this.log(),
|
||||||
|
(this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(t, e)
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,284 @@
|
||||||
|
# !/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Modify : 2024/4/21
|
||||||
|
# 京豆近7天输出表格统计
|
||||||
|
# 用不着每天跑,定时自行设置吧,配合desi可指定账号
|
||||||
|
# https://raw.githubusercontent.com/6dylan6/jdpro/main/jd_beans_7days.py
|
||||||
|
'''
|
||||||
|
new Env('豆子7天统计');
|
||||||
|
8 8 29 2 * jd_beans_7days.py
|
||||||
|
'''
|
||||||
|
|
||||||
|
import requests
|
||||||
|
import datetime
|
||||||
|
import random
|
||||||
|
import os,re,sys,json,time
|
||||||
|
from urllib.parse import unquote,quote
|
||||||
|
from datetime import timedelta
|
||||||
|
from datetime import timezone
|
||||||
|
|
||||||
|
try:
|
||||||
|
from prettytable import PrettyTable
|
||||||
|
except:
|
||||||
|
os.system('pip3 install prettytable &> /dev/null')
|
||||||
|
from prettytable import PrettyTable
|
||||||
|
|
||||||
|
SHA_TZ = timezone(
|
||||||
|
timedelta(hours=8),
|
||||||
|
name='Asia/Shanghai',
|
||||||
|
)
|
||||||
|
requests.adapters.DEFAULT_RETRIES = 5
|
||||||
|
session = requests.session()
|
||||||
|
session.keep_alive = False
|
||||||
|
|
||||||
|
url = "https://api.m.jd.com/api"
|
||||||
|
def getua():
|
||||||
|
global uuid,addressid,iosVer,iosV,clientVersion,iPhone,area,ADID,lng,lat
|
||||||
|
uuid=''.join(random.sample(['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','a','b','c','z'], 40))
|
||||||
|
addressid = ''.join(random.sample('1234567898647', 10))
|
||||||
|
iosVer = ''.join(random.sample(["15.1.1","14.5.1", "14.4", "14.3", "14.2", "14.1", "14.0.1"], 1))
|
||||||
|
iosV = iosVer.replace('.', '_')
|
||||||
|
clientVersion=''.join(random.sample(["10.3.0", "10.2.7", "10.2.4"], 1))
|
||||||
|
iPhone = ''.join(random.sample(["8", "9", "10", "11", "12", "13"], 1))
|
||||||
|
area=''.join(random.sample('0123456789', 2)) + '_' + ''.join(random.sample('0123456789', 4)) + '_' + ''.join(random.sample('0123456789', 5)) + '_' + ''.join(random.sample('0123456789', 4))
|
||||||
|
ADID = ''.join(random.sample('0987654321ABCDEF', 8)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 4)) + '-' + ''.join(random.sample('0987654321ABCDEF', 12))
|
||||||
|
lng='119.31991256596'+str(random.randint(100,999))
|
||||||
|
lat='26.1187118976'+str(random.randint(100,999))
|
||||||
|
UserAgent=''
|
||||||
|
if not UserAgent:
|
||||||
|
return f'jdapp;iPhone;10.0.4;{iosVer};{uuid};network/wifi;ADID/{ADID};model/iPhone{iPhone},1;addressid/{addressid};appBuild/167707;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS {iosV} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/null;supportJDSHWK/1'
|
||||||
|
else:
|
||||||
|
return UserAgent
|
||||||
|
def gen_body(page):
|
||||||
|
body = {
|
||||||
|
"beginDate": datetime.datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(SHA_TZ).strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
"endDate": datetime.datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(SHA_TZ).strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
"pageNo": page,
|
||||||
|
"pageSize": 20,
|
||||||
|
}
|
||||||
|
return body
|
||||||
|
|
||||||
|
def printf(text):
|
||||||
|
print(text)
|
||||||
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
def column_pad(*columns):
|
||||||
|
max_len = max([len(x) for x in columns])
|
||||||
|
for y in columns:
|
||||||
|
y.extend(['NaN']*(max_len-len(y)))
|
||||||
|
|
||||||
|
class getJDCookie(object):
|
||||||
|
|
||||||
|
# 获取cookie
|
||||||
|
def getCookie(self):
|
||||||
|
global cookies
|
||||||
|
cookies = []
|
||||||
|
try:
|
||||||
|
if "JD_COOKIE" in os.environ:
|
||||||
|
if len(os.environ["JD_COOKIE"]) > 10:
|
||||||
|
cookies = os.environ["JD_COOKIE"]
|
||||||
|
printf("\n当前从环境变量获取CK\n")
|
||||||
|
return
|
||||||
|
except Exception as e:
|
||||||
|
printf(f"【getCookie Error】{e}")
|
||||||
|
|
||||||
|
# 检测cookie格式是否正确
|
||||||
|
|
||||||
|
def getUserInfo(self, ck, pinName, userNum):
|
||||||
|
url = 'https://me-api.jd.com/user_new/info/GetJDUserInfoUnion?orgFlag=JD_PinGou_New&callSource=mainorder&channel=4&isHomewhite=0&sceneval=2&sceneval=2&callback='
|
||||||
|
headers = {
|
||||||
|
'Cookie': ck,
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Connection': 'close',
|
||||||
|
'Referer': 'https://home.m.jd.com/myJd/home.action',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Host': 'me-api.jd.com',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.2 Mobile/15E148 Safari/604.1',
|
||||||
|
'Accept-Language': 'zh-cn'
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
if sys.platform == 'ios':
|
||||||
|
resp = requests.get(url=url, verify=False, headers=headers, timeout=60).json()
|
||||||
|
else:
|
||||||
|
resp = requests.get(url=url, headers=headers, timeout=60).json()
|
||||||
|
if resp['retcode'] == "0":
|
||||||
|
nickname = resp['data']['userInfo']['baseInfo']['nickname']
|
||||||
|
if not nickname:
|
||||||
|
nickname = resp['data']['userInfo']['baseInfo']['curPin']
|
||||||
|
return ck, nickname
|
||||||
|
else:
|
||||||
|
context = f"账号{userNum}【{pinName}】Cookie 已失效!请重新获取\n。"
|
||||||
|
printf(context)
|
||||||
|
return ck, False
|
||||||
|
except Exception:
|
||||||
|
context = f"账号{userNum}【{pinName}】Cookie 已失效!请重新获取\n。"
|
||||||
|
printf(context)
|
||||||
|
return ck, False
|
||||||
|
|
||||||
|
def iscookie(self):
|
||||||
|
"""
|
||||||
|
:return: cookiesList,userNameList,pinNameList
|
||||||
|
"""
|
||||||
|
cookiesList = []
|
||||||
|
userNameList = []
|
||||||
|
pinNameList = []
|
||||||
|
if 'pt_key=' in cookies and 'pt_pin=' in cookies:
|
||||||
|
r = re.compile(r"pt_key=.*?pt_pin=.*?;", re.M | re.S | re.I)
|
||||||
|
result = r.findall(cookies)
|
||||||
|
if len(result) >= 1:
|
||||||
|
printf("您有{}个账号".format(len(result)))
|
||||||
|
u = 1
|
||||||
|
for i in result:
|
||||||
|
r = re.compile(r"pt_pin=(.*?);")
|
||||||
|
pinName = r.findall(i)
|
||||||
|
pinName = unquote(pinName[0])
|
||||||
|
# 获取账号名
|
||||||
|
ck, nickname = self.getUserInfo(i, pinName, u)
|
||||||
|
if nickname:
|
||||||
|
cookiesList.append(ck)
|
||||||
|
userNameList.append(nickname)
|
||||||
|
pinNameList.append(pinName)
|
||||||
|
else:
|
||||||
|
u += 1
|
||||||
|
continue
|
||||||
|
u += 1
|
||||||
|
if len(cookiesList) > 0 and len(userNameList) > 0:
|
||||||
|
return cookiesList, userNameList, pinNameList
|
||||||
|
else:
|
||||||
|
printf("没有可用CK,已退出\n")
|
||||||
|
exit(3)
|
||||||
|
else:
|
||||||
|
printf("CK格式错误!...本次运行退出\n")
|
||||||
|
exit(4)
|
||||||
|
else:
|
||||||
|
printf("CK格式错误或无CK!...请检查\n")
|
||||||
|
exit(4)
|
||||||
|
|
||||||
|
|
||||||
|
getCk = getJDCookie()
|
||||||
|
getCk.getCookie()
|
||||||
|
|
||||||
|
|
||||||
|
def gen_params(page):
|
||||||
|
body = gen_body(page)
|
||||||
|
params = {
|
||||||
|
"functionId": "jposTradeQuery",
|
||||||
|
"appid": "swat_miniprogram",
|
||||||
|
"client": "tjj_m",
|
||||||
|
"sdkName": "orderDetail",
|
||||||
|
"sdkVersion": "1.0.0",
|
||||||
|
"clientVersion": "3.1.3",
|
||||||
|
"timestamp": int(round(time.time() * 1000)),
|
||||||
|
"body": json.dumps(body)
|
||||||
|
}
|
||||||
|
return params
|
||||||
|
|
||||||
|
def creat_bean_count(date, beansin, beansout, beanstotal):
|
||||||
|
tb = PrettyTable()
|
||||||
|
tb.add_column('DATE', date)
|
||||||
|
tb.add_column('BEANSIN', beansin)
|
||||||
|
tb.add_column('BEANSOUT', beansout)
|
||||||
|
tb.add_column('TOTAL', beanstotal)
|
||||||
|
printf(tb)
|
||||||
|
|
||||||
|
|
||||||
|
def get_beans_7days(ck):
|
||||||
|
try:
|
||||||
|
day_7 = True
|
||||||
|
page = 0
|
||||||
|
headers = {
|
||||||
|
"Host": "bean.m.jd.com",
|
||||||
|
"User-Agent": getua(),
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded;",
|
||||||
|
"Cookie": ck,
|
||||||
|
}
|
||||||
|
days = []
|
||||||
|
for i in range(0, 7):
|
||||||
|
days.append((datetime.date.today() - datetime.timedelta(days=i)).strftime("%Y-%m-%d"))
|
||||||
|
beans_in = {key: 0 for key in days}
|
||||||
|
beans_out = {key: 0 for key in days}
|
||||||
|
while day_7:
|
||||||
|
page = page + 1
|
||||||
|
url="https://bean.m.jd.com/beanDetail/detail.json?page="+str(page)
|
||||||
|
data='body='+quote(str({"pageSize":"20","page":str(page)}))+'&appid=ld'
|
||||||
|
resp = session.post(url, headers=headers, data=data ,timeout=1000).text
|
||||||
|
|
||||||
|
res = json.loads(resp)
|
||||||
|
if res['code'] == '0' :
|
||||||
|
for i in res['jingDetailList']:
|
||||||
|
for date in days:
|
||||||
|
if str(date) in i['date'] and int(i['amount']) > 0:
|
||||||
|
beans_in[str(date)] = beans_in[str(date)] + int(i['amount'])
|
||||||
|
break
|
||||||
|
elif str(date) in i['date'] and int(i['amount']) < 0:
|
||||||
|
beans_out[str(date)] = beans_out[str(date)] + int(i['amount'])
|
||||||
|
break
|
||||||
|
if i['date'].split(' ')[0] not in str(days):
|
||||||
|
day_7 = False
|
||||||
|
else:
|
||||||
|
print("未获取到数据,原因未知!!\n")
|
||||||
|
return {'code': 400, 'data': res}
|
||||||
|
#print(beans_in, beans_out, days)
|
||||||
|
return {'code': 200, 'data': [beans_in, beans_out, days]}
|
||||||
|
except Exception as e:
|
||||||
|
print(str(e))
|
||||||
|
return {'code': 400, 'data': str(e)}
|
||||||
|
|
||||||
|
|
||||||
|
def get_total_beans(ck):
|
||||||
|
try:
|
||||||
|
headers = {
|
||||||
|
"Host": "me-api.jd.com",
|
||||||
|
"User-Agent": getua(),
|
||||||
|
"Content-Type": "application/x-www-form-urlencoded;",
|
||||||
|
"Cookie": ck,
|
||||||
|
#"Referer": 'https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2'
|
||||||
|
}
|
||||||
|
jurl = "https://me-api.jd.com/user_new/info/GetJDUserInfoUnion"
|
||||||
|
resp = requests.get(jurl, headers=headers).text
|
||||||
|
res = json.loads(resp)
|
||||||
|
#print(res)
|
||||||
|
return res['data']['assetInfo']['beanNum']
|
||||||
|
except Exception as e:
|
||||||
|
printf(str(e))
|
||||||
|
|
||||||
|
|
||||||
|
def get_bean_data(i,ck):
|
||||||
|
try:
|
||||||
|
if ck:
|
||||||
|
#ck = cookies[i-1]
|
||||||
|
beans_res = get_beans_7days(ck)
|
||||||
|
beantotal = get_total_beans(ck)
|
||||||
|
if beans_res['code'] != 200:
|
||||||
|
return beans_res
|
||||||
|
else:
|
||||||
|
beans_in, beans_out = [], []
|
||||||
|
beanstotal = [int(beantotal), ]
|
||||||
|
for i in beans_res['data'][0]:
|
||||||
|
beantotal = int(beantotal) - int(beans_res['data'][0][i]) - int(beans_res['data'][1][i])
|
||||||
|
beans_in.append(int(beans_res['data'][0][i]))
|
||||||
|
beans_out.append(int(str(beans_res['data'][1][i]).replace('-', '')))
|
||||||
|
beanstotal.append(beantotal)
|
||||||
|
return {'code': 200, 'data': [beans_in[::-1], beans_out[::-1], beanstotal[::-1], beans_res['data'][2][::-1]]}
|
||||||
|
except Exception as e:
|
||||||
|
print(str(e))
|
||||||
|
|
||||||
|
def query():
|
||||||
|
try:
|
||||||
|
global cookiesList, userNameList, pinNameList, ckNum, beanCount, userCount
|
||||||
|
cookiesList, userNameList, pinNameList = getCk.iscookie()
|
||||||
|
for i,ck,user,pin in zip(range(1,len(cookiesList)+1),cookiesList,userNameList,pinNameList):
|
||||||
|
printf(f"\n****** [账号{i}]-{user} ******")
|
||||||
|
res=get_bean_data(i,ck)
|
||||||
|
if res['code'] != 200:
|
||||||
|
printf(res['data'])
|
||||||
|
continue
|
||||||
|
if res['data'][2][1:] != []:
|
||||||
|
creat_bean_count(res['data'][3], res['data'][0], res['data'][1], res['data'][2][1:])
|
||||||
|
time.sleep(2)
|
||||||
|
except Exception as e:
|
||||||
|
printf(str(e))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
query()
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
#依赖安装,运行一次就好
|
||||||
|
#0 8 5 5 * jd_indeps.sh
|
||||||
|
#new Env('依赖安装');
|
||||||
|
#
|
||||||
|
|
||||||
|
npm_ver=`pnpm -v|awk -F. '{print $1}'`
|
||||||
|
if [[ $npm_ver -ge 7 ]];then
|
||||||
|
export PNPM_HOME="/root/.local/share/pnpm"
|
||||||
|
export PATH="$PNPM_HOME:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -e "安装脚本所需依赖,不一定一次全部安装成功,请自己检查\n"
|
||||||
|
echo -e "开始安装............\n"
|
||||||
|
|
||||||
|
#apk add g++ make pixman-dev pango-dev cairo-dev pkgconf --no-cache
|
||||||
|
#apk add g++ make --no-cache
|
||||||
|
pnpm config set registry https://registry.npmmirror.com
|
||||||
|
pnpm install -g
|
||||||
|
pnpm install -g ds
|
||||||
|
pnpm install -g png-js
|
||||||
|
pnpm install -g date-fns
|
||||||
|
pnpm install -g axios
|
||||||
|
pnpm install -g crypto-js
|
||||||
|
pnpm install -g ts-md5
|
||||||
|
pnpm install -g tslib
|
||||||
|
pnpm install -g @types/node
|
||||||
|
pnpm install -g request
|
||||||
|
pnpm install -g jsdom
|
||||||
|
pnpm install -g moment
|
||||||
|
pnpm install -g cheerio
|
||||||
|
pnpm install -g tough-cookie
|
||||||
|
pnpm install -g https-proxy-agent
|
||||||
|
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ jieba
|
||||||
|
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ requests
|
||||||
|
rm -rf /usr/local/pnpm-global/5/node_modules/.pnpm/canvas*
|
||||||
|
rm -rf /root/.local/share/pnpm/global/5/.pnpm/canvas*
|
||||||
|
echo -e "\n所需依赖安装完成,请检查有没有报错,可尝试再次运行"
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue