KR/jd_token.js

22 lines
37 KiB
JavaScript
Raw Normal View History

2023-09-16 18:12:25 +08:00
/*
变量
JD_PROXY_OPEN // 代理启用变量默认不开启true/false
JD_PROXY_TUNNRL // 代理池代理地址变量,默认不开启,仅支持代理池模式(auto-proxy-pool)格式为http://ip:port
JD_PROXY_URL // API代理地址变量默认不开启仅支持 数据格式:txt;提取数量:每次一个格式为http://api.xxx.xxx
JD_NO_PROXY // 禁止走代理,默认 127.0.0.1,*.baidu.com 需要自行修改
2023-09-23 12:00:16 +08:00
JD_TOKEN_BLACKLIST // 黑名单 用&隔开 pin值
2023-09-16 18:12:25 +08:00
根据自行需要设定脚本定时每25分钟自动执行一次
2023-09-16 18:15:21 +08:00
cron:5/25 * * * *
2023-09-16 18:12:25 +08:00
============Quantumultx===============
[task_local]
#代理缓存Token
2023-09-23 11:59:37 +08:00
0/25 * * * * jd_token.js, tag=代理缓存Token, enabled=true
2023-09-16 18:12:25 +08:00
*/
const $ = new Env('代理缓存Token');
2023-09-23 11:59:37 +08:00
var version_='jsjiami.com.v7';const iiil111l=ii1lIliI;(function(I1llIIi,lIIil1Il,lIi11Ii1,l1llII,ii1li1,Ii1li11I,il1i1ii){return I1llIIi=I1llIIi>>0x5,Ii1li11I='hs',il1i1ii='hs',function(lI1lIIIi,iIlilllI,li1i1ll1,iIiIIllI,lIiilIII){const lliI1ii=ii1lIliI;iIiIIllI='tfi',Ii1li11I=iIiIIllI+Ii1li11I,lIiilIII='up',il1i1ii+=lIiilIII,Ii1li11I=li1i1ll1(Ii1li11I),il1i1ii=li1i1ll1(il1i1ii),li1i1ll1=0x0;const Illi1I1i=lI1lIIIi();while(!![]&&--l1llII+iIlilllI){try{iIiIIllI=parseInt(lliI1ii(0x2c2,'UbPq'))/0x1*(-parseInt(lliI1ii(0x29d,'UBK8'))/0x2)+-parseInt(lliI1ii(0x1e5,'[sC]'))/0x3*(parseInt(lliI1ii(0x229,'Pvzw'))/0x4)+parseInt(lliI1ii(0x26b,'0bHp'))/0x5+parseInt(lliI1ii(0x207,'6sB9'))/0x6+-parseInt(lliI1ii(0x201,'lmo#'))/0x7*(parseInt(lliI1ii(0x1bb,'zo6R'))/0x8)+parseInt(lliI1ii(0x278,'YNx@'))/0x9*(-parseInt(lliI1ii(0x1b3,'YNx@'))/0xa)+parseInt(lliI1ii(0x28e,'$UOD'))/0xb;}catch(ll1lIII1){iIiIIllI=li1i1ll1;}finally{lIiilIII=Illi1I1i[Ii1li11I]();if(I1llIIi<=l1llII)li1i1ll1?ii1li1?iIiIIllI=lIiilIII:ii1li1=lIiilIII:li1i1ll1=lIiilIII;else{if(li1i1ll1==ii1li1['replace'](/[GYnHhFJQSDgqPEbpKLy=]/g,'')){if(iIiIIllI===iIlilllI){Illi1I1i['un'+Ii1li11I](lIiilIII);break;}Illi1I1i[il1i1ii](lIiilIII);}}}}}(lIi11Ii1,lIIil1Il,function(llIIIiil,Iiill1lI,l1lii1Ii,li1iI1li,iIlIlill,ili1lII,I11lIlii){return Iiill1lI='\x73\x70\x6c\x69\x74',llIIIiil=arguments[0x0],llIIIiil=llIIIiil[Iiill1lI](''),l1lii1Ii=`\x72\x65\x76\x65\x72\x73\x65`,llIIIiil=llIIIiil[l1lii1Ii]('\x76'),li1iI1li=`\x6a\x6f\x69\x6e`,(0x13f914,llIIIiil[li1iI1li](''));});}(0x1780,0x9f47e,iIlI1iii,0xbe),iIlI1iii)&&(version_=iIlI1iii);const il111I1=$['isNode']()?require(iiil111l(0x215,'zo6R')):'',I1I1IIil=$[iiil111l(0x28d,'UUzM')]()?require(iiil111l(0x2af,'AL7N')):'',lIIl1lll=require(iiil111l(0x2b9,'7N&]')),iIlIilll=require(iiil111l(0x2a7,'mh!5')),l11ili1I=require(iiil111l(0x242,'AL7N')),l1iI1II=require('./function/jdCommon'),ii1IiiI1=process[iiil111l(0x2a4,'6sB9')]['JD_CACHE_INTERVAL']||'25';let lIl11iil=parseInt(ii1IiiI1)*0x3c*0x3e8;const IiI1li1=new iIlIilll(lIl11iil,__dirname+iiil111l(0x251,'[cKE')),IIl1lIli=[iiil111l(0x22e,'f$bH'),'http://kr.kingran.cf/sign'],llilil1=IIl1lIli[IIiiliIi(0x0,IIl1lIli['length'])],il1I1llI=llilil1,Ill11il1=process['env'][iiil111l(0x232,'UbPq')]||'';let ilIilIll=iiil111l(0x220,'GKq!');function ii1lIliI(_0x180bc5,_0x9dad19){const _0x2b5198=iIlI1iii();return ii1lIliI=function(_0x561a02,_0x4452f3){_0x561a02=_0x561a02-0x1a8;let _0xbdf284=_0x2b5198[_0x561a02];if(ii1lIliI['gIGjAz']===undefined){var _0x294bb0=function(_0x4075ef){const _0x18fb22='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5f16d6='',_0x2f4839='';for(let _0x2b4b87=0x0,_0x5622d3,_0x29aecd,_0x535afd=0x0;_0x29aecd=_0x4075ef['charAt'](_0x535afd++);~_0x29aecd&&(_0x5622d3=_0x2b4b87%0x4?_0x5622d3*0x40+_0x29aecd:_0x29aecd,_0x2b4b87++%0x4)?_0x5f16d6+=String['fromCharCode'](0xff&_0x5622d3>>(-0x2*_0x2b4b87&0x6)):0x0){_0x29aecd=_0x18fb22['indexOf'](_0x29aecd);}for(let _0xdde6e3=0x0,_0x3b54e4=_0x5f16d6['length'];_0xdde6e3<_0x3b54e4;_0xdde6e3++){_0x2f4839+='%'+('00'+_0x5f16d6['charCodeAt'](_0xdde6e3)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2f4839);};const _0x293446=function(_0x1fb7bc,_0x3a3d86){let _0x43db71=[],_0x317ecd=0x0,_0x296427,_0x52aec4='';_0x1fb7bc=_0x294bb0(_0x1fb7bc);let _0x2623d6;for(_0x2623d6=0x0;_0x2623d6<0x100;_0x2623d6++){_0x43db71[_0x2623d6]=_0x2623d6;}for(_0x2623d6=0x0;_0x2623d6<0x100;_0x2623d6++){_0x317ecd=(_0x317ecd+_0x43db71[_0x2623d6]+_0x3a3d86['charCodeAt'](_0x2623d6%_0x3a3d86['length']))%0x100,_0x296427=_0x43db71[_0x2623d6],_0x43db71[_0x2623d6]=_0x43db71[_0x317ecd],_0x43db71[_0x317ecd]=_0x296427;}_0x2623d6=0x0,_0x317ecd=0x0;for(let _0x1c35ba=0x0;_0x1c35ba<_0x1fb7bc['length'];_0x1c35ba++){_0x2623d6=(_0x2623d6+0x1)%0x100,_0x317ecd=(_0x317ecd+_0x43db71[_0x2623d6])%0x100,_0x296427=_0x43db71[_0x2623d6],_0x43db71[_0x2623d6]=_0x43db71[_0x317ecd],_0x43db71[_0x317ecd]=_0x296427,_0x52aec4+=String['fromCharCode'](_0x1fb7bc['charCodeAt'](_0x1c35ba)^_0x43db71[(_0x43db71[_0x2623d6]+_0x43db71[_0x317ecd])%0x100]);}return _0x52aec4;};ii1lIliI['svHhZm']=_0
2023-09-16 18:12:25 +08:00
// 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.d