KR/activity/jd_Red.js

509 lines
92 KiB
JavaScript
Raw Normal View History

2022-02-11 16:56:14 +08:00
/*
京东领红包
脚本兼容: Node.js
返利变量jd_rebateCode若需要返利给自己请自己修改环境变量
SCLyQi4换成自己的返利
需要助力[火力值]的账号pin值
京东账号2pin
pin1换成对应的pin值 ,分开
只助力2个 满了脚本自动从ck1开始替换未满的
export jd_rebatePin="pin1,pin2"
============Quantumultx===============
[task_local]
#京东领红包
0 0,10,20,22 * * * https://raw.githubusercontent.com/KingRan/JDJB/main/jd_red.js, tag=京东领红包, enabled=true
================Loon==============
[Script]
cron "0 0,10,20,22 * * *" script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_red.js,tag=京东领红包
===============Surge=================
京东领红包 = type=cron,cronexp="0 0,10,20,22 * * *",wake-system=1,timeout=3600,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_red.js
============小火箭=========
京东领红包 = type=cron,script-path=https://raw.githubusercontent.com/KingRan/JDJB/main/jd_red.js, cronexpr="0 0,10,20,22 * * *", timeout=3600, enable=true
*/
const $ = new Env('京东领红包');
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const notify = $.isNode() ? require('./sendNotify') : '';
let rebateCodes = ''
let rebatePin = ''
CryptoScripts()
$.CryptoJS = $.isNode() ? require('crypto-js') : CryptoJS;
//IOS等用户直接用NobyDa的jd cookie
let cookiesArr = [],
cookie = '';
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);
}
rebatePin = $.isNode() ? (process.env.jd_rebatePin ? process.env.jd_rebatePin : `${rebatePin}`) : ($.getdata('jd_rebatePin') ? $.getdata('jd_rebatePin') : `${rebatePin}`);
let rebatePinArr = rebatePin && rebatePin.split(',') || []
let rebateCode = ''
message = ''
newCookie = ''
resMsg = ''
$.endFlag = false
let shareCodeArr = {}
$.runArr = {}
const activeEndTime = '2022/01/27 00:00:00+08:00';//活动结束时间
let nowTime = new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000;
let timeH = $.time('H')
!(async () => {
if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {
"open-url": "https://bean.m.jd.com/"
});
return;
}
if (nowTime > new Date(activeEndTime).getTime()) {
//活动结束后弹窗提醒
$.msg($.name, '活动已结束', `请删除此脚本\n咱江湖再见`);
$.setdata('','jd_JDnhjRed')
return
}
$.shareCodeArr = $.getdata('jd_JDnhjRed') || {};
// $.shareCodeArr = {};
let pinUpdateTime = $.shareCodeArr["updateTime"] || ''
$.shareCode = ''
$.again = false
let getShare = false
if(Object.getOwnPropertyNames($.shareCodeArr).length > 0 && ($.shareCodeArr["updateTime"] && $.time('d',new Date($.shareCodeArr["updateTime"] || Date.now()).getTime()) == $.time('d')) && timeH != 20 && timeH != 0){
$.shareCodeArr = {}
$.shareCodeArr["flag"] = true
getShare = true
}
try{
for (let i = 0; i < cookiesArr.length && getShare; i++) {
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
if(rebatePinArr.length > 0 && rebatePinArr.indexOf($.UserName) == -1) continue
$.index = i + 1;
await getUA()
await run(1);
let n = 0
for(let s in $.shareCodeArr || {}){
if(s === 'flag' || s === 'updateTime') continue
if($.shareCodeArr[s]) n++
}
if($.endFlag || n >= 2) break
}
}
}catch(e){
console.log(e)
}
try{
for (let i = 0; i < cookiesArr.length && getShare; i++) {
cookie = cookiesArr[i];
if (cookie) {
let n = 0
for(let s in $.shareCodeArr || {}){
if(s === 'flag' || s === 'updateTime') continue
if($.shareCodeArr[s]) n++
}
if(n >= 2) break
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
if(n >= 2 && rebatePinArr.length > 0 && $.rebatePinArr[$.UserName]) continue
$.index = i + 1;
await getUA()
await run(1);
if($.endFlag) break
}
}
}catch(e){
console.log(e)
}
if(Object.getOwnPropertyNames($.shareCodeArr).length > 0 && $.shareCodeArr["updateTime"] != pinUpdateTime) $.setdata($.shareCodeArr,'jd_JDnhjRed')
if(Object.getOwnPropertyNames($.shareCodeArr).length > 0){
for(let s in $.shareCodeArr || {}){
if(s === 'flag' || s === 'updateTime') continue
if($.shareCodeArr[s]) shareCodeArr[s] = $.shareCodeArr[s]
}
}
for (let i = 0; i < cookiesArr.length; i++) {
if($.endFlag) break
cookie = cookiesArr[i];
if (cookie) {
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1;
if($.runArr[$.UserName]) continue
console.log(`\n\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
await getUA()
await run();
if($.endFlag) break
}
}
if(Object.getOwnPropertyNames($.shareCodeArr).length > 0 && $.shareCodeArr["updateTime"] != pinUpdateTime) $.setdata($.shareCodeArr,'jd_JDnhjRed')
if(message){
$.msg($.name, ``, `${message}\nhttps://u.jd.com/PC8TEnS\n\n跳转到app 可查看助力情况`);
if ($.isNode()){
// await notify.sendNotify(`${$.name}`, `${message}\n\nhttps://u.jd.com/PC8TEnS\n跳转到app 可查看助力情况`);
}
}
})()
.catch((e) => $.logErr(e))
.finally(() => $.done())
async function run(type = 0){
try{
rebateCodes = ["PC8TEnS", "PC8pEWg", "Pd8B3sJ"];
rebateCodes = rebateCodes[Math.floor((Math.random() * rebateCodes.length))]
rebateCodes = $.isNode() ? (process.env.jd_rebateCode ? process.env.jd_rebateCode : `${rebateCodes}`) : ($.getdata('jd_rebateCode') ? $.getdata('jd_rebateCode') : `${rebateCodes}`);
rebateCode = rebateCodes
//console.log(rebateCode)
resMsg = ''
let s = 0
let t = 0
do{
rebateCode = rebateCodes
if(t>2) s = 0
$.flag = 0
newCookie = ''
await getUrl()
if(!$.url1){
console.log('获取url1失败')
break
}
await getUrl1()
$.actId = $.url2.match(/mall\/active\/([^/]+)\/index\.html/) && $.url2.match(/mall\/active\/([^/]+)\/index\.html/)[1] || `https://prodev.m.jd.com/mall/active/2UboZe4RXkJPrpkp6SkpJJgtRmod/index.html?unionActId=31137&d=${rebateCode}`
// let arr = await getBody($.UA,$.url2)
// await getEid(arr)
if(!$.eid){
$.eid = -1
}
if(type == 0){
let n = 0
if(Object.getOwnPropertyNames(shareCodeArr).length > s && timeH != 10 && timeH != 20){
for(let i in shareCodeArr || {}){
if(i == $.UserName) {
$.flag = 1
continue
}
if(n == s) {
$.flag = 0
$.shareCode = shareCodeArr[i] || ''
if($.shareCode) console.log(`助力[${i}]`)
let res = await getCoupons($.shareCode,1)
if(res.indexOf('上限') > -1){
await $.wait(parseInt(Math.random() * 5000 + 3000, 10))
await getCoupons('',1)
}
}
n++
}
}else{
let res = await getCoupons('',1)
if(res.indexOf('上限') > -1){
await $.wait(parseInt(Math.random() * 5000 + 3000, 10))
await getCoupons('',1)
}
}
if($.endFlag) break
}else{
let res = await showCoupon()
if(res && $.again == false) await shareUnionCoupon()
if($.again == false) break
}
if($.again == true && t < 2){
t++
$.again = false
}
s++
if($.flag == 1){
await $.wait(parseInt(Math.random() * 5000 + 3000, 10))
}
}while ($.flag == 1 && s < 5)
if($.endFlag) return
if(resMsg){
message += `【京东账号${$.index}${$.nickName || $.UserName}\n${resMsg}`
}
await $.wait(parseInt(Math.random() * 2000 + 2000, 10))
}catch(e){
console.log(e)
}
}
function getCoupons(shareId = '',type = 1) {
return new Promise(async resolve => {
await requestAlgo();
let time = Date.now()
let body = {"platform": 2,"unionActId": "31137","actId": $.actId,"d": rebateCode,"unionShareId": shareId, "type": type,"eid": "-1"}
let h5st = h5stSign(body) || 'undefined'
let message = ''
let opts = {
url: `https://api.m.jd.com/api?functionId=getCoupons&appid=u&_=${time}&loginType=2&body=${(JSON.stringify(body))}&client=apple&clientVersion=8.3.6&h5st=${h5st}`,
headers: {
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
'Cookie': `${newCookie} ${cookie}`,
"User-Agent": $.UA ,
}
}
if($.url2) opts["headers"]["Referer"] = $.url2
$.get(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
if(Object.getOwnPropertyNames($.shareCodeArr).length > 0 && ($.shareCodeArr["updateTime"] && $.time('d',new Date($.shareCodeArr["updateTime"] || Date.now()).getTime()) == $.time('d'))){
$.shareCodeArr["flag"] = false
}else if(Object.getOwnPropertyNames($.shareCodeArr).length > 0 && ($.shareCodeArr["updateTime"] && $.time('d',new Date($.shareCodeArr["updateTime"] || Date.now()).getTime()) != $.time('d'))){
$.shareCodeArr["flag"] = true
$.shareCodeArr["updateTime"] = $.time('yyyy-MM-dd HH:mm:ss')
}
let res = $.toObj(data,data);
if(typeof res == 'object'){
if(res.msg){
message = res.msg
console.log(res.msg)
}
if(res.msg.indexOf('不展示弹层') > -1) $.again = true
if(res.msg.indexOf('上限') === -1 && res.msg.indexOf('登录') === -1){
$.flag = 1
}
if(res.msg.indexOf('活动已结束') > -1 || res.msg.indexOf('活动未开始') > -1){
$.endFlag = true
return
}
if(shareId && typeof res.data !== 'undefined' && typeof res.data.joinNum !== 'undefined'){
console.log(`当前${res.data.joinSuffix}:${res.data.joinNum}`)
}
if(res.code == 0 && res.data){
let msg = ''
if(res.data.type == 1){
msg = `获得[红包]🧧${res.data.discount}元 使用时间:${$.time('yyyy-MM-dd',res.data.beginTime)} ${$.time('yyyy-MM-dd',res.data.endTime)}`
}else if(res.data.type == 3){
msg = `获得[优惠券]🎟️满${res.data.quota}${res.data.discount} 使用时间:${$.time('yyyy-MM-dd',res.data.beginTime)} ${$.time('yyyy-MM-dd',res.data.endTime)}`
}else if(res.data.type == 6){
msg = `获得[打折券]]🎫满${res.data.quota}${res.data.discount*10}折 使用时间:${$.time('yyyy-MM-dd',res.data.beginTime)} ${$.time('yyyy-MM-dd',res.data.endTime)}`
}else{
msg = `获得[未知]🎉${res.data.quota || ''} ${res.data.discount} 使用时间:${$.time('yyyy-MM-dd',res.data.beginTime)} ${$.time('yyyy-MM-dd',res.data.endTime)}`
console.log(data)
}
if(msg){
resMsg += msg+'\n'
console.log(msg)
}
}
if(shareId && typeof res.data !== 'undefined' && typeof res.data.groupInfo !== 'undefined'){
for(let i of res.data.groupInfo || []){
if(i.status == 2){
console.log(`助力满可以领取${i.info}元红包🧧`)
await $.wait(parseInt(Math.random() * 2000 + 2000, 10))
await getCoupons('',2)
}
}
}
}else{
console.log(data)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(message);
}
})
})
}
function showCoupon(shareId = '') {
let msg = true
return new Promise(resolve => {
let opts = {
url: `https://api.m.jd.com/api?functionId=showCoupon&appid=u&_=${Date.now()}&loginType=2&body={%22actId%22:%22${$.actId}%22,%22unionActId%22:%2231137%22,%22unpl%22:%22%22,%22platform%22:4,%22unionShareId%22:%22%22,%22uiUpdateTime%22:1641456650000,%22d%22:%22${rebateCode}%22,%22eid%22:%22${$.eid}%22}&client=apple&clientVersion=8.3.6`,
headers: {
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
'Cookie': `${newCookie} ${cookie}`,
"User-Agent": $.UA ,
}
}
if($.url2) opts["headers"]["Referer"] = $.url2
$.get(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
let res = $.toObj(data,data);
if(typeof res == 'object'){
if(res.msg) console.log(res.msg)
if(res.msg.indexOf('不展示弹层') > -1) $.again = true
if(res.msg.indexOf('领取上限') > -1) $.runArr[$.UserName] = true
if(res.msg.indexOf('上限') === -1 && res.msg.indexOf('登录') === -1){
$.flag = 1
}
if(typeof res.data !== 'undefined' && typeof res.data.joinNum !== 'undefined'){
let flag = false
for(let i of res.data.groupInfo){
if(i.status != 6 && res.data.joinNum >= i.num){
flag = true
}else{
flag = false
}
}
if(flag == true) msg = false
console.log(`【账号${$.index}${$.nickName || $.UserName} ${res.data.joinSuffix}:${res.data.joinNum} ${flag == true && res.data.joinSuffix+"满了" || ''}`)
}
if(res.msg.indexOf('活动已结束') > -1){
msg = false
}
}else{
console.log(data)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve(msg);
}
})
})
}
function shareUnionCoupon() {
$.shareCodeArr[$.UserName] = ''
return new Promise(resolve => {
let opts = {
url: `https://api.m.jd.com/api?functionId=shareUnionCoupon&appid=u&_=${Date.now()}&loginType=2&body={%22unionActId%22:%2231137%22,%22actId%22:%22${$.actId}%22,%22platform%22:4,%22unionShareId%22:%22${$.shareCode}%22,%22d%22:%22${rebateCode}%22,%22supportPic%22:2,%22supportLuckyCode%22:0,%22eid%22:%22${$.eid}%22}&client=apple&clientVersion=8.3.6`,
headers: {
"Accept-Language": "zh-cn",
"Accept-Encoding": "gzip, deflate, br",
'Cookie': `${newCookie} ${cookie}`,
"User-Agent": $.UA ,
}
}
$.get(opts, async (err, resp, data) => {
try {
if (err) {
console.log(`${$.toStr(err)}`)
console.log(`${$.name} API请求失败请检查网路重试`)
} else {
// console.log(data)
let res = $.toObj(data,data);
if(typeof res == 'object'){
if(res.code == 0 && res.data && res.data.shareUrl){
let shareCode = res.data.shareUrl.match(/\?s=([^&]+)/) && res.data.shareUrl.match(/\?s=([^&]+)/)[1] || ''
if(shareCode){
console.log(`【账号${$.index}${$.nickName || $.UserName} 分享码:${shareCode}`)
$.shareCodeArr["updateTime"] = $.time('yyyy-MM-dd HH:mm:ss')
$.shareCodeArr[$.UserName] = shareCode
}
}
}else{
console.log(data)
}
}
} catch (e) {
$.logErr(e, resp)
} finally {
resolve();
}
})
})
}
function getUrl1() {
return new Promise(resolve => {
const options = {
url: $.url1,
followRedirect:false,
headers: {
'Cookie': `${newCookie} ${cookie}`,
"User-Agent": $.UA
}
}
$.get(options, async (err, resp, data) => {
try {
setActivityCookie(resp)
$.url2 = resp && resp['headers'] && (resp['headers']['location'] || resp['headers']['Location'] || '') || ''
$.url2 = decodeURIComponent($.url2)
$.url2 = $.url2.match(/(https:\/\/prodev[\.m]{0,}\.jd\.com\/mall[^'"]+)/) && $.url2.match(/(https:\/\/prodev[\.m]{0,}\.jd\.com\/mall[^'"]+)/)[1] || ''
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
})
})
}
function getUrl() {
return new Promise(resolve => {
const options = {
url: `https://u.jd.com/${rebateCode}${$.shareCode && "?s="+$.shareCode || ""}`,
followRedirect:false,
headers: {
'Cookie': `${newCookie} ${cookie}`,
"User-Agent": $.UA
}
}
$.get(options, async (err, resp, data) => {
try {
setActivityCookie(resp)
$.url1 = data && data.match(/(https:\/\/u\.jd\.com\/jda[^']+)/) && data.match(/(https:\/\/u\.jd\.com\/jda[^']+)/)[1] || ''
} catch (e) {
$.logErr(e, resp);
} finally {
resolve(data);
}
})
})
}
function setActivityCookie(resp){
let setcookies = resp && resp['headers'] && (resp['headers']['set-cookie'] || resp['headers']['Set-Cookie'] || '') || ''
let setcookie = ''
if(setcookies){
if(typeof setcookies != 'object'){
setcookie = setcookies.split(',')
}else setcookie = setcookies
for (let ck of setcookie) {
let name = ck.split(";")[0].trim()
if(name.split("=")[1]){
if(newCookie.indexOf(name.split("=")[1]) == -1) newCookie += name.replace(/ /g,'')+'; '
}
}
}
}
function getUA(){
$.UA = `jdapp;iPhone;10.2.2;14.3;${randomString(40)};M/5.0;network/wifi;ADID/;model/iPhone12,1;addressid/4199175193;appBuild/167863;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;`
}
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
}
function jsonParse(str) {
if (typeof str == "string") {
try {
return JSON.parse(str);
} catch (e) {
console.log(e);
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
return [];
}
}
}
var _0xodD='jsjiami.com.v6',_0xodD_=['_0xodD'],_0x3755=[_0xodD,'w6EddcKmwr8EHl8=','eyVdw4RJAsKewrY=','TA5SF8KrCgnClTVq','eyVdw4hHDg==','w5ACB8O0wpY=','CF0/w5TCnsO1wpvCjw==','w4kXKSTCtMK6wrvDhUnDrsKTw7pyO0g=','XmUjwpQ=','wqvCosOkw78iwqLDtcOtQSdq','w4UbCsOowpBR','AiAOw7Yd','JCXCvMKhY0Y=','wolnw43Cp8OefcKC','LcKgX8Od','wo7Dl8K0Tm0=','XsOqOhbDlg==','w5l3VCzDi8KH','Smplw67DiMOs','w5UBBsO4woVX','SMK8aAjCosKu','w6TDkwHCr8K/w5c=','X17Do0DCvQ==','w5LCgsOdwprDoA==','XVrDpUbCqsOnwo4=','woNnw5jCp8ONbA==','EMKNwpA=','w5R8w58scg==','w6/DkxvCi8Kkw4p0e0pj','e3AJwo5Y','wq8xOUY0wqB3bGPCow==','VVfCvHDClsKlw5RpMcKFHsKrRsOYLD8/bnsmwqcrFg==','wqjDj8OUw6/DknAawoDCt8KEMHHCksKNS1nDkxPCmUXCgT55wrY=','w4xfw64AVA==','w4BAw4cNbA==','wrl4w5rCl8O5','wqnDqBDCq8Kjwp/CsQ==','EmrDisKMw7Q=','LFnCkB5r','wrPDrsKbw6jCtw==','w7nCjMKywoYL','CcO8Fxht','TcKadwjCsQ==','w5AnGcO4wpY=','w6s7dsK6wpc=','VCoBwrnDkA==','w5k3I8OUwqg=','dQxQw49C','w68iJT3CvA==','w53Cm8OHejM=','w6rCr00IXHUFwrHDssOUT3E7JS3Dv8KqJ8OXEsO5EsKowoYWw4LCjsOKw7ZmeU3CsMOSVErCp8KIwpfDg2vCkMO8aA==','wobDucKjwrjDjw==','w4kINBnDscO2wrPDiVzDp8KRw6F5cxvCtcOV','w5UqJ8OjwrE=','JjMpwrpR','w5TCscOFwq/DlcK9w40EdQXCsHHCngkfw718w6rCtmQwwppOA11Gwo9Iwqdl','w4AdKg==','w7fCrxDCq8KjwojCssK2wpPCjMOcasKzQCRvMWTCs8KPwq9GD8Kuwq/DnsKpLmdWDsKaw4Znwr7Cow==','P8KpwrjDiTY=','GsKEesOow7M=','w57Dm8OkZhg=','wpbDl8OYw5vDpA==','ZVrCkRvCpw==','wqnDk8Ouw5bDlg==','w6wWQsKJwrk=','w4o+R8KJwqU=','w4defB/DuA==','wpTDq8KEwpbDgQ==','Q8OoKAg=','YsKXecKBw5A=','w43Cl8OhQA==','PgPCusKSYA==','wo5AW8K1w5I=','Kl8Hw4DChw==','WcOoMhI=','CMKXYcOmw6Q=','DcKWAcK7woc=','ScKPbMKiw4Q=','wq3DoxbClcK6','w7TCulUNSg==','wplJwpHChsKM','w4Ntw4Mwcw==','w6fCnsOXwrTDvw==','KzYNwrtl','bE3DqEPCrMOmw6RS','ek1Kwr/CnMKu','X8K8VR/CscKzA18=','w4J5w44qTg==','Smliw6jDh8Osw749FDPDimHDtA==','eW5+w7rDoA==','woJNwoLCqcK2','XsOmKw==','JMK7P8KQwpU=','wrDDr8Oaw5nDlA==','PMKEwrI=','MsOoGgNu','w5lcw54JUg==','QSwtwrHDjEE=','XWpgw6jDhw==','P3nCkD56cj8H','wqDCrMOJw5U6','w7zDmTzCvMK5w5Zqcw==','w7UcEcOrwpBMFUc=','w7XCtMKHwqYIwro9Aw==','w5LCgsOlwovDvMKaw6TDjQ==','w73CtsKpw5EJw7ATwpo=','TnbCtxDCoVY=','XWpYw7nDm8Oxw4Y/','w6rCtsKUw4Yaw60=','w5IzIAbDqA==','ciVhw4FJ','w6jCtFAW','w7Rew7s2WQ==','w7nCuMKIw5Ye','UiYowp/Dhw==','VMOiNTfDucKA','w5Q5PxbDtE8b','wpR3wqLCocKUXQ==','w6xWczPDhQ==','w5vDgiDCpcKx','w73CscKvw7Qr','wq7DjsONw73DhDg=','wrLDqgtLG3ocwqnCqcKMTWctMmbDs8KpYcOdF8O/UcK3wo0Iw4fCmsOLw7FNbVfCoMOFElfCucK+wq3Cuk/CvMOaWHxXw45ww4sQb38mVsOawq7CtVMGwoHDosOnLXg=','w47DjcOxThs=','a8ODOTvDhA==','wrLDiMKCw5vChMKU','L2wBMw==','w5Flw4wxQsK6w67Cjg==','YsKaQzPCrA==','WB9UM8KsAw==','w5Y7wqIjwqhRXiI=','EgjCp8K+bw==','FsKJwpE=','BGgKMEM=','w48xRMK2wr8=','A8K2aU/CqMOMG8Kuwpoc','UEY/wopf','OXfCrS5ndg==','RnzCoA==','wq3DrAzCssKn','w4csOwrDog==','wo7DtMKUfw==','w6jCqcKKw4ke','w6bCg8OfwpLDhg==','LD04w4AcYMKAAWk4','w4x1w5Y8W8KOw7rCjwvDg8KBwpMAw7nCi8Kpw58=','w4DDvMOew7bDgQ==','w7/DqcKg','w6EdKcOawqA=','w706HFvDqMOg','w4F9aT/DjQ==','wq3DiMOWw6/DtQ==','Bi8Dwrpw','w5Y8acK+wpc=','w7hlfzZvw6AxNDXDqQ==','wqbDksOrw57Dsw==','w4DCocOlwpbDqA==','Ii/Cu8Ko','w6coGMOPwr4=','aSdLw69f','w6XCvlczSjY=','W1DDulbCtg==','w4M4woE/wrtaVTE=','R8OKSHR4','W1DDgkfCqsOgw4Bm','XzJQw7xSGMKmwpY=','w5IzGBfDtEhVw6U=','wrfCny3DoBPDhg==','LWHDtMKXw63CjsK4w5Q=','fy9Hw69HAw==','w6LCtMK6wrEbwqc=','wrTDlMOLw7rDjw==','w7xvZRZhw6E=','wprCoMO+w4gU','w4XDicOBATjChA==','w4XCl8OsVw==','w6gRwoHCrw8=','w5HDhMOj','w4XCq8KmwqMP','FsOOBQFzLgFa','w6/DkxvCjMKqw4th','UjOswzgjiYakmNi.lcorLmd.v6Mh=='];if(function(_0x3cc2ee,_0x401c8f,_0x52fa5){function _0x292300(_0x4aecde,_0x30a469,_0x22febf,_0x1c3485,_0x5f90e8,_0x183d88){_0x30a469=_0x30a469>>0x8,_0x5f90e8='po';var _0x4ea584='shift',_0x2c1210='push',_0x183d88='';if(_0x30a469<_0x4aecde){while(--_0x4aecde){_0x1c3485=_0x3cc2ee[_0x4ea584]();if(_0x30a469===_0x4aecde&&_0x183d88===''&&_0x183d88['length']===0x1){_0x30a469=_0x1c3485,_0x22febf=_0x3cc2ee[_0x5f90e8+'p']();}else if(_0x30a469&&_0x22febf['replace'](/[UOwzgYkNlrLdMh=]/g,'')===_0x30a469){_0x3cc2ee[_0x2c1210](_0x1c3485);}}_0x3cc2ee[_0x2c1210](_0x3cc2ee[_0x4ea584]());}return 0xcc15a;};return _0x292300(++_0x401c8f,_0x52fa5)>>_0x401c8f^_0x52fa5;}(_0x3755,0xcd
function CryptoScripts() {
// prettier-ignore
!function(t,e){"object"==typeof exports?module.exports=exports=e():"function"==typeof define&&define.amd?define([],e):t.CryptoJS=e()}(this,function(){var t,e,r,i,n,o,s,c,a,h,l,f,d,u,p,_,v,y,g,B,w,k,S,m,x,b,H,z,A,C,D,E,R,M,F,P,W,O,I,U,K,X,L,j,N,T,q,Z,V,G,J,$,Q,Y,tt,et,rt,it,nt,ot,st,ct,at,ht,lt,ft,dt,ut,pt,_t,vt,yt,gt,Bt,wt,kt,St,mt=mt||function(t){var e;if("undefined"!=typeof window&&window.crypto&&(e=window.crypto),!e&&"undefined"!=typeof window&&window.msCrypto&&(e=window.msCrypto),!e&&"undefined"!=typeof global&&global.crypto&&(e=global.crypto),!e&&"function"==typeof require)try{e=require("crypto")}catch(e){}function r(){if(e){if("function"==typeof e.getRandomValues)try{return e.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof e.randomBytes)try{return e.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")}var i=Object.create||function(t){var e;return n.prototype=t,e=new n,n.prototype=null,e};function n(){}var o={},s=o.lib={},c=s.Base={extend:function(t){var e=i(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),(e.init.prototype=e).$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},a=s.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,r=t.words,i=this.sigBytes,n=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o<n;o++){var s=r[o>>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else for(o=0;o<n;o+=4)e[i+o>>>2]=r[o>>>2];return this.sigBytes+=n,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],i=0;i<t;i+=4)e.push(r());return new a.init(e,t)}}),h=o.enc={},l=h.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n<r;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i+=2)r[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new a.init(r,e/2)}},f=h.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,i=[],n=0;n<r;n++){var o=e[n>>>2]>>>24-n%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,r=[],i=0;i<e;i++)r[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new a.init(r,e)}},d=h.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},u=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,i=this._data,n=i.words,o=i.sigBytes,s=this.blockSize,c=o/(4*s),h=(c=e?t.ceil(c):t.max((0|c)-this._minBufferSize,0))*s,l=t.min(4*h,o);if(h){for(var f=0;f<h;f+=s)this._doProcessBlock(n,f);r=n.splice(0,h),i.sigBytes-=l}return new a.init(r,l)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(s.Hasher=u.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){u.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),o.algo={});return o}(Math);function xt(t,e,r){return t^e^r}fu
}
// 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"])