mirror of https://github.com/KingRan/KR.git
13 lines
51 KiB
JavaScript
13 lines
51 KiB
JavaScript
|
/*
|
|||
|
领京豆升级任务
|
|||
|
活动入口:京东APP首页-领京豆任务
|
|||
|
cron "25 2,14 * * *" script-path=jd_bean_home.js, tag=领京豆升级任务
|
|||
|
|
|||
|
请使用本地IP环境 请使用本地IP环境 请使用本地IP环境
|
|||
|
|
|||
|
*/
|
|||
|
const $ = new Env('领京豆升级任务')
|
|||
|
var version_='jsjiami.com.v7';const IIlI11=iii1II;(function(l1lilI,i1Iil1,liI1Ii,l1lil1,i1lil,I1iIl,IilII){return l1lilI=l1lilI>>0x9,I1iIl='hs',IilII='hs',function(ili1l,i1lii,iilIII,liI1Il,I1iIi){const I1IllI=iii1II;liI1Il='tfi',I1iIl=liI1Il+I1iIl,I1iIi='up',IilII+=I1iIi,I1iIl=iilIII(I1iIl),IilII=iilIII(IilII),iilIII=0x0;const iiiI1I=ili1l();while(!![]&&--l1lil1+i1lii){try{liI1Il=parseInt(I1IllI(0x218,'D%Nv'))/0x1+-parseInt(I1IllI(0x269,'xHx6'))/0x2+-parseInt(I1IllI(0x228,'RtUT'))/0x3*(-parseInt(I1IllI(0x299,'@fHJ'))/0x4)+parseInt(I1IllI(0x1f0,'2evQ'))/0x5+parseInt(I1IllI(0x281,'8uLw'))/0x6*(-parseInt(I1IllI(0x155,'uU3m'))/0x7)+parseInt(I1IllI(0x30b,'z%p3'))/0x8+parseInt(I1IllI(0x1e7,'d*i5'))/0x9*(-parseInt(I1IllI(0x29d,'2evQ'))/0xa);}catch(lilI11){liI1Il=iilIII;}finally{I1iIi=iiiI1I[I1iIl]();if(l1lilI<=l1lil1)iilIII?i1lil?liI1Il=I1iIi:i1lil=I1iIi:iilIII=I1iIi;else{if(iilIII==i1lil['replace'](/[DLfqWrnXNMkAJyEtwBx=]/g,'')){if(liI1Il===i1lii){iiiI1I['un'+I1iIl](I1iIi);break;}iiiI1I[IilII](I1iIi);}}}}}(liI1Ii,i1Iil1,function(Ili1II,ili1i,IiIi1,l1Ii1,i1IilI,III1I1,ilI111){return ili1i='\x73\x70\x6c\x69\x74',Ili1II=arguments[0x0],Ili1II=Ili1II[ili1i](''),IiIi1='\x72\x65\x76\x65\x72\x73\x65',Ili1II=Ili1II[IiIi1]('\x76'),l1Ii1='\x6a\x6f\x69\x6e',(0x139ca5,Ili1II[l1Ii1](''));});}(0x18a00,0xc0b08,Iii11l,0xc7),Iii11l)&&(version_=Iii11l);const i1lIii=$['isNode']()?require('./sendNotify'):'',III11i=$['isNode']()?require(IIlI11(0x1e6,'l7LL')):'',i1lIil=require(IIlI11(0x177,'E4Ww')),III11l=require(IIlI11(0x32d,'ks0L')),llIl1i=require(IIlI11(0x2a2,'7Q4x')),llIl1l=process[IIlI11(0x222,'5uu(')][IIlI11(0x2a6,')GQo')]||'';let IiiII=!![],Iiil=[],IIIli='',ii1i1;if($['isNode']()){Object[IIlI11(0x1bd,'@5vD')](III11i)[IIlI11(0x2dd,'&3Tt')](IiiI=>{const iIIll1=IIlI11;Iiil[iIIll1(0x170,'xHx6')](III11i[IiiI]);});if(process['env'][IIlI11(0x207,'l7LL')]&&process[IIlI11(0x270,'Z%hK')][IIlI11(0x1b8,'2evQ')]===IIlI11(0x223,'yhCT'))console[IIlI11(0x32c,'8uLw')]=()=>{};}else Iiil=[$[IIlI11(0x21e,'ks0L')](IIlI11(0x16d,'uU3m')),$[IIlI11(0x2ef,'2evQ')](IIlI11(0x255,'Z%hK')),...IIIll($[IIlI11(0x2a1,'U8GR')](IIlI11(0x2af,'uU3m'))||'[]')['map'](iIi1i=>iIi1i[IIlI11(0x26e,'5uu(')])][IIlI11(0x1b4,'G99o')](l1iIll=>!!l1iIll);!(async()=>{const llIIII=IIlI11,l1iIli={'kZArL':function(iIi1l,i1lIlI){return iIi1l+i1lIlI;},'jesGd':function(l1lliI,I1I1iI){return l1lliI!==I1I1iI;},'cLFgS':llIIII(0x31a,'G99o'),'XQFyH':llIIII(0x302,'zkm!'),'sAoFQ':llIIII(0x2e5,'f[dw'),'gIajg':function(IIIlII,iiIiI1){return IIIlII(iiIiI1);},'OqynC':'❖\x20测试连通性中...\x0a❖\x20服务状态正常...\x0a','gbira':function(ili1Il,ili1Ii,Iilll1){return ili1Il(ili1Ii,Iilll1);},'JNIJr':'❖\x20kr提醒您...\x0a❖\x20请使用本地IP环境...\x0a❖\x20否则不会完成任务...\x0a','eAlhq':llIIII(0x178,'z%p3'),'iSghv':llIIII(0x2a8,'aMux'),'ttGEB':function(ll11I,iIi1I){return ll11I*iIi1I;}};if(!Iiil[0x0]){if(l1iIli[llIIII(0x217,'ks0L')](l1iIli[llIIII(0x213,'z%p3')],l1iIli[llIIII(0x1ab,'5XYq')])){$[llIIII(0x29e,'c#yW')]($['name'],'【提示】请先获取京东账号一cookie\x0a直接使用NobyDa的京东签到获取',l1iIli['sAoFQ'],{'open-url':l1iIli['sAoFQ']});return;}else IIlii['log'](l1iIli['kZArL']('',IlI1il[llIIII(0x249,'E4Ww')](IilliI)));}authorCodeList=await l1iIli[llIIII(0x1cf,'HmD(')](IIIlIl,'http://code.kingran.cf/fw.json');authorCodeList?(console[llIIII(0x25e,'U8GR')](l1iIli[llIIII(0x1e0,'KXG4')]),$[llIIII(0x2b9,'D%Nv')]=authorCodeList[l1iIli[llIIII(0x2bb,'@WK*')](IIIlI,0x0,authorCodeList[llIIII(0x298,'78AD')])]):$['krserve']=![];console['log'](l1iIli['JNIJr']);for(let IlI1lI=0x0;IlI1lI<Iiil[llIIII(0x2b8,'7Q4x')];IlI1lI++){if(Iiil[IlI1lI]){IIIli=Iiil[IlI1lI],$['UserName']=decodeURIComponent(IIIli[llIIII(0x292,'xHx6')](/pt_pin=([^; ]+)(?=;?)/)&&IIIli[llIIII(0x315,'^qBs')](/pt_pin=([^; ]+)(?=;?)/)[0x1]),$[llIIII(0x1a8,'ks0L')]=IlI1lI+0x1,$['isLogin']=!![],$[llIIII(0x1ba,'2evQ')]='',ii1i1='',console['log'](llIIII(0x168,'yhCT')+$[llIIII(0x172,')GQo')]+'】'+($[llIIII(0x1f6,'hPgQ')]||$[llIIII(0x2cb,'D%Nv')])+llIIII(0x338,'MjWS'));if(!$[llIIII(0x271,'6g@e')]){$['msg']($[llII
|
|||
|
// 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"])
|