faker3/jd_dplh0801.js

21 lines
54 KiB
JavaScript
Raw Normal View History

2024-08-01 10:49:23 +08:00
/*
活动名称大牌联合开卡
环境变量
jd_dplh_viewShop // 是否true/false做浏览任务默认不做
jd_dplh_addCart // 是否true/false做加购任务默认不做
jd_dplh_draw // 抽奖次数,变量暂时无效
jd_dplh_blacklist // 黑名单 用&隔开 pin值
jd_dplh_Notify // 是否通知true/false默认不通知
jd_dplh_break // IP限制后继续执行true/false
实物奖品需要填写地址变量才行具体请查看 WIki
cron "1 1 1 1 *" script-path=jd_dplh.js
*/
const $ = new Env('大牌联合0801')
const _0x199bc2=_0x352d;(function(_0x3e7b13,_0xe926e){const _0x25616f=_0x352d,_0x4f4b40=_0x3e7b13();while(!![]){try{const _0x463584=parseInt(_0x25616f(0x2c4,'Tudz'))/0x1+-parseInt(_0x25616f(0x234,'eTsV'))/0x2+-parseInt(_0x25616f(0x2a5,'e%[C'))/0x3+-parseInt(_0x25616f(0x1d0,'LISE'))/0x4*(parseInt(_0x25616f(0x20e,'#ETO'))/0x5)+-parseInt(_0x25616f(0x3a1,'5*%('))/0x6*(-parseInt(_0x25616f(0x296,'n$PP'))/0x7)+-parseInt(_0x25616f(0x29d,'U[g3'))/0x8*(parseInt(_0x25616f(0x3c9,')Ppe'))/0x9)+parseInt(_0x25616f(0x328,'WW3B'))/0xa;if(_0x463584===_0xe926e)break;else _0x4f4b40['push'](_0x4f4b40['shift']());}catch(_0x27fefb){_0x4f4b40['push'](_0x4f4b40['shift']());}}}(_0x2026,0x833b9));const jdCookie=require('./jdCookie'),common=require(_0x199bc2(0x36f,'1e8$')),notify=require(_0x199bc2(0x2e2,'*7fO')),getToken=require(_0x199bc2(0x345,'eTsV')),CryptoJS=require(_0x199bc2(0x24b,'bx[N')),activityUrl=process[_0x199bc2(0x209,'xqVw')][_0x199bc2(0x264,'HIqH')]||_0x199bc2(0x2dc,'7cZ2'),joinMember=process[_0x199bc2(0x40a,'v*bV')][_0x199bc2(0x301,'gP1u')]===_0x199bc2(0x20a,'61Fh'),dplh_viewShop=process[_0x199bc2(0x2e1,'tJd&')][_0x199bc2(0x2fc,'*7fO')]===_0x199bc2(0x38f,'WW3B'),dplh_AddCart=process['env']['jd_dplh_addCart']===_0x199bc2(0x2f2,'%GN!'),dplh_draw=process[_0x199bc2(0x40b,'K0Pm')]['jd_dplh_draw']||0x5,dplh_wait=process[_0x199bc2(0x375,')Ppe')][_0x199bc2(0x2b3,'Dld%')]||0x1,isNotify=process[_0x199bc2(0x2de,'dsN^')][_0x199bc2(0x26e,'1e8$')]===_0x199bc2(0x3cd,'j(Br'),hotbreak=process[_0x199bc2(0x2d5,'sx8%')][_0x199bc2(0x3e9,'R&3(')]==='true';let waitTimes=parseInt(dplh_wait)*0x3e8;const prize_type={'jdMarket':_0x199bc2(0x2db,'bDp0'),'coin':_0x199bc2(0x3e6,'j(Br'),'point':_0x199bc2(0x252,'gP1u'),'integral':_0x199bc2(0x291,'2&53'),'goods':_0x199bc2(0x228,'aUOy'),'product':'[广告]','coupon':_0x199bc2(0x306,'pt#Q'),'chance':_0x199bc2(0x353,'Dld%'),'card':_0x199bc2(0x304,'O7B^')};let cookie='',originCookie='',cookiesArr=Object['keys'](jdCookie)['map'](_0x1f7b2c=>jdCookie[_0x1f7b2c])[_0x199bc2(0x350,'K0Pm')](_0x2005f9=>_0x2005f9);!cookiesArr[0x0]&&($[_0x199bc2(0x1e7,'K]5Q')]($['name'],_0x199bc2(0x2ef,'F$p[')),process['exit'](0x1));$['blacklist']=process[_0x199bc2(0x2de,'dsN^')][_0x199bc2(0x2a8,'c@5W')]||'',getBlacklist(),$[_0x199bc2(0x347,'e%[C')]=[],$[_0x199bc2(0x31f,'Bq[4')]=[],!(async()=>{const _0x11ee43=_0x199bc2;console[_0x11ee43(0x208,'Dld%')](_0x11ee43(0x1f5,'Bq[4')+$[_0x11ee43(0x1ce,'tJd&')]+'变量开启状态=========='),console['log']('开卡类活动不会自动运行,请自行测试是否有水'),console['log'](_0x11ee43(0x3a5,'1e8$')+common['getProxyStatus']()+']'),console[_0x11ee43(0x30a,')Ppe')]('间隔时长:\x20['+(waitTimes===0x0?'无':waitTimes/0x3e8+'秒')+_0x11ee43(0x1dc,'pt#Q')),console[_0x11ee43(0x363,'5*%(')]('浏览任务:\x20['+(dplh_viewShop?'开启':'关闭')+']'),console[_0x11ee43(0x27e,'EDxn')](_0x11ee43(0x207,'*7fO')+(dplh_AddCart?'开启':'关闭')+']'),console[_0x11ee43(0x2b6,'HIqH')](_0x11ee43(0x26a,'JgvA')+(hotbreak?'开启':'关闭')+']'),console[_0x11ee43(0x3c2,'OqdZ')]('=========='+$['name']+'变量状态结束==========');if(!activityUrl){console[_0x11ee43(0x2d4,'61Fh')]('⚠\x20请先定义必要的环境变量后再运行脚本');return;}authorCodeList=await getAuthorCodeList('http://code.257999.xyz/jd_dplh.json');authorCodeList?(console[_0x11ee43(0x1fb,'gP1u')](_0x11ee43(0x32d,'1e8$')),$[_0x11ee43(0x34c,'j(Br')]=authorCodeList[random(0x0,authorCodeList[_0x11ee43(0x2a6,'bDp0')])]):($[_0x11ee43(0x2b8,'BGXH')]='',console[_0x11ee43(0x41f,'*7fO')]('\x0a服务状态异常请检查网络是否正常\x0a'));$[_0x11ee43(0x36e,'c@5W')]=activityUrl;$[_0x11ee43(0x20b,'n$PP')]&&($[_0x11ee43(0x3da,'tJd&')][_0x11ee43(0x2f1,'lAxC')](_0x11ee43(0x1e3,'7cZ2'))?$[_0x11ee43(0x35d,'g[(#')]=common[_0x11ee43(0x3ec,'v*bV')](activityUrl,_0x11ee43(0x1fe,'#ETO')):$[_0x11ee43(0x281,'8&6$')]=$[_0x11ee43(0x3ea,'61Fh')]);$[_0x11ee43(0x21f,'n$PP')]=_0x11ee43(0x385,'lAxC'),$['baseUrl']=_0x11ee43(0x3ac,'O7B^')+$[_0x11ee43(0x28b,'pt#Q')];if(!$[_0x11ee43(0x28c,'Dld%')]){console[_0x11ee43(0x288,'K0Pm')]('\x20请填写格式正确<EFBFBD><EFBFBD>
// 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"])