├── README.md ├── appShare.js ├── dmGetActivity.js ├── dt.js ├── dygy.js ├── dyjsb.js ├── fmp.js ├── glados.js ├── hdl.js ├── hjq.js ├── hkl.js ├── hmdLY.js ├── hqzl.js ├── kjwj.js ├── lxly.js ├── lxzx.js ├── mbz.js ├── qhhz.js ├── qtx.js ├── tczs.js ├── tyqh.js ├── tyqs.js ├── tyshj.js ├── wyx.js ├── xmbs.js └── zsbtzc.js /README.md: -------------------------------------------------------------------------------- 1 | # 自用青龙脚本备份
2 | -------------------------------------------------------------------------------- /appShare.js: -------------------------------------------------------------------------------- 1 | /* 2 | 作者:临渊 3 | 日期:6-26 4 | 软件:APP分享 5 | 功能:签到 6 | 抓包:点一下自己的主页 找这个 http://spare.appshare.muge.info/user/v1/fragmentMeData 链接里oaid 7 | 变量:appShare='oaid@oaid ' 多个账号用 @ 或者 换行 分割 8 | 定时一天一次 9 | 10 | cron: 5 10 * * * 11 | */ 12 | 13 | const $ = new Env('APP分享签到'); 14 | const notify = $.isNode() ? require('./sendNotify') : ''; 15 | const crypto = require('crypto-js'); 16 | const {log} = console; 17 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 18 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 19 | ////////////////////// 20 | let appShare = process.env.appShare; 21 | let appShareArr = []; 22 | let data = ''; 23 | let msg = ''; 24 | let date = new Date().toLocaleDateString().split('/').map(item=>{if (item<10){return '0'+ item}else {return item}}).join(''); 25 | let key = ''; 26 | 27 | !(async () => { 28 | 29 | if (!(await Envs())) 30 | return; 31 | else { 32 | 33 | 34 | 35 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 36 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 37 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 38 | 39 | await poem(); 40 | 41 | log(`\n=================== 共找到 ${appShareArr.length} 个账号 ===================`) 42 | 43 | if (debug) { 44 | log(`【debug】 这是你的全部账号数组:\n ${appShareArr}`); 45 | } 46 | 47 | date = crypto.MD5(date).toString().toUpperCase(); 48 | 49 | for (let index = 0; index < appShareArr.length; index++) { 50 | 51 | 52 | let num = index + 1 53 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 54 | 55 | data = appShareArr[index]; 56 | key = data + date; 57 | key = crypto.MD5(key).toString().toUpperCase(); 58 | if (debug) { 59 | log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 60 | } 61 | 62 | msg += `\n第${num}个账号运行结果:` 63 | log('开始签到'); 64 | await doSign(); 65 | await $.wait(2 * 1000); 66 | 67 | } 68 | await SendMsg(msg); 69 | } 70 | 71 | })() 72 | .catch((e) => log(e)) 73 | .finally(() => $.done()) 74 | 75 | 76 | /** 77 | * 签到 78 | */ 79 | function doSign(timeout = 3 * 1000) { 80 | return new Promise((resolve) => { 81 | let url = { 82 | url: `https://appshare.muge.info/user/v1/daySign?oaid=${data}&sign=${key}`, 83 | headers: {"Host":"appshare.muge.info","accept-encoding":"gzip","user-agent":"okhttp/5.0.0-alpha.6"}, 84 | } 85 | 86 | if (debug) { 87 | log(`\n【debug】=============== 这是 签到 请求 url ===============`); 88 | log(JSON.stringify(url)); 89 | } 90 | 91 | $.get(url, async (error, response, data) => { 92 | try { 93 | if (debug) { 94 | log(`\n\n【debug】===============这是 签到 返回data==============`); 95 | log(data) 96 | } 97 | 98 | let result = JSON.parse(data); 99 | if (result.code == 100) { 100 | 101 | log(`签到成功,获得:${result.data.count}`) 102 | msg += `\n签到成功,获得:${result.data.count}` 103 | 104 | } else if (result.code === 200) { 105 | 106 | log(`签到失败,今日已签到`) 107 | msg += `\n签到失败,今日已签到` 108 | 109 | } else { 110 | 111 | log(`签到失败,原因是:${result.message}`) 112 | msg += `\n签到失败,原因是:${result.message}` 113 | 114 | } 115 | 116 | } catch (e) { 117 | log(e) 118 | } finally { 119 | resolve(); 120 | } 121 | }, timeout) 122 | }) 123 | } 124 | 125 | 126 | // ============================================变量检查============================================ \\ 127 | async function Envs() { 128 | if (appShare) { 129 | if (appShare.indexOf("@") != -1) { 130 | appShare.split("@").forEach((item) => { 131 | appShareArr.push(item); 132 | }); 133 | } else if (appShare.indexOf("\n") != -1) { 134 | appShare.split("\n").forEach((item) => { 135 | appShareArr.push(item); 136 | }); 137 | } else { 138 | appShareArr.push(appShare); 139 | } 140 | } else { 141 | log(`\n 【${$.name}】:未填写变量 appShare`) 142 | return; 143 | } 144 | 145 | return true; 146 | } 147 | 148 | // ============================================发送消息============================================ \\ 149 | async function SendMsg(message) { 150 | if (!message) 151 | return; 152 | 153 | if (Notify > 0) { 154 | if ($.isNode()) { 155 | var notify = require('./sendNotify'); 156 | await notify.sendNotify($.name, message); 157 | } else { 158 | $.msg(message); 159 | } 160 | } else { 161 | log(message); 162 | } 163 | } 164 | 165 | /** 166 | * 随机数生成 167 | */ 168 | function randomString(e) { 169 | e = e || 32; 170 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 171 | a = t.length, 172 | n = ""; 173 | for (i = 0; i < e; i++) 174 | n += t.charAt(Math.floor(Math.random() * a)); 175 | return n 176 | } 177 | 178 | /** 179 | * 随机整数生成 180 | */ 181 | function randomInt(min, max) { 182 | return Math.round(Math.random() * (max - min) + min) 183 | } 184 | 185 | /** 186 | * 获取毫秒时间戳 187 | */ 188 | function timestampMs(){ 189 | return new Date().getTime(); 190 | } 191 | 192 | /** 193 | * 获取秒时间戳 194 | */ 195 | function timestampS(){ 196 | return Date.parse(new Date())/1000; 197 | } 198 | 199 | /** 200 | * 获取随机诗词 201 | */ 202 | function poem(timeout = 3 * 1000) { 203 | return new Promise((resolve) => { 204 | let url = { 205 | url: `https://v1.jinrishici.com/all.json` 206 | } 207 | $.get(url, async (err, resp, data) => { 208 | try { 209 | data = JSON.parse(data) 210 | log(`${data.content} \n————《${data.origin}》${data.author}`); 211 | } catch (e) { 212 | log(e, resp); 213 | } finally { 214 | resolve() 215 | } 216 | }, timeout) 217 | }) 218 | } 219 | 220 | /** 221 | * 修改配置文件 222 | */ 223 | function modify() { 224 | 225 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 226 | if(err){ 227 | return log('读取文件失败!'+err) 228 | } 229 | else { 230 | var result = dataStr.replace(/regular/g,string); 231 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 232 | if (err) {return log(err);} 233 | }); 234 | } 235 | }) 236 | } 237 | 238 | 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) } 239 | -------------------------------------------------------------------------------- /dmGetActivity.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ 临渊 3 | * 软件;到梦空间 4 | * 功能:到梦空间获取指定活动 5 | * 抓取: 6 | * appdmkj.5idream.net 7 | * 域名请求体的body 8 | * 变量格式:export dmtk=' xxxx & xxx @ xxxx & xxx ' 多个账号用 @分割 9 | */ 10 | 11 | const jsname = "到梦空间获取活动"; 12 | const $ = Env(jsname); 13 | const notify = $.isNode() ? require('./sendNotify') : ''; 14 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 15 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 16 | ////////////////////// 17 | let dmtk = process.env.dmtk; 18 | let dmtkArr = []; 19 | let data = ''; 20 | let msg = ''; 21 | 22 | 23 | !(async () => { 24 | 25 | if (!(await Envs())) 26 | return; 27 | else { 28 | 29 | console.log(`开始获取活动`); 30 | 31 | 32 | console.log(`\n\n========================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 33 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 34 | 8 * 60 * 60 * 1000).toLocaleString()} \n=========================================\n`); 35 | 36 | console.log(`\n=================== 共找到 ${dmtkArr.length} 页的参数 ===================`) 37 | 38 | if (debug) { 39 | console.log(`【debug】 这是你的全部参数数组:\n ${dmtkArr}`); 40 | } 41 | 42 | 43 | for (let index = 0; index < dmtkArr.length; index++) { 44 | 45 | 46 | let num = index + 1 47 | console.log(`\n========= 开始【第 ${num} 个参数】=========\n`) 48 | 49 | data = dmtkArr[index].split('&'); 50 | 51 | if (debug) { 52 | console.log(`\n 【debug】 这是你第 ${num} 页的参数信息:\n ${data}\n`); 53 | } 54 | 55 | 56 | console.log('开始获取活动'); 57 | await signin(); 58 | if (msg != ""){ 59 | msg+=`\n作者:临渊` 60 | } 61 | await $.wait(2 * 1000); 62 | } 63 | 64 | await SendMsg(msg); 65 | } 66 | 67 | })() 68 | .catch((e) => console.log(e)) 69 | .finally(() => $.done()) 70 | 71 | 72 | 73 | 74 | 75 | 76 | /** 77 | * 下面我们来看看函数需要注意的东西吧 78 | */ 79 | function signin(timeout = 5 * 1000) { 80 | return new Promise((resolve) => { 81 | let url = { 82 | url: `https://appdmkj.5idream.net/v2/activity/activities`, 83 | headers: { 84 | "standardUA": `{"channelName":"dmkj_Android","countryCode":"CN","createTime":1638856432189,"device":"Xiaomi MI 8","hardware":"qcom","jPushId":"","modifyTime":1650851382947,"operator":"%E4%B8%AD%E5%9B%BD%E8%81%94%E9%80%9A","screenResolution":"1080-2029","startTime":1651055246155,"sysVersion":"Android 29 10","system":"android","uuid":"9487E0211CF7","version":"4.4.4"}`, 85 | "Content-Type": "application/x-www-form-urlencoded", 86 | "Content-Length": "940", 87 | "Host": "appdmkj.5idream.net", 88 | "Accept-Encoding": "gzip", 89 | "Connection": "keep-alive", 90 | "User-Agent": "okhttp/3.11.0" 91 | }, 92 | body: `${data}` 93 | 94 | } 95 | 96 | if (debug) { 97 | console.log(`\n【debug】=============== 这是请求 url ===============`); 98 | console.log(JSON.stringify(url)); 99 | } 100 | 101 | $.post(url, async (error, response, data) => { 102 | try { 103 | if (debug) { 104 | console.log(`\n\n【debug】===============这是返回data==============`); 105 | console.log(data) 106 | } 107 | 108 | let result = JSON.parse(data); 109 | var obj = eval(result.data); 110 | if (result.code == 100) { 111 | for(var i=0;i<40;i++){ 112 | if(obj.list[i].catalog2name == "创新创业"){ 113 | if(obj.list[i].status != 6 && obj.list[i].name.indexOf("补发") == -1){ 114 | console.log(`创新创业活动ID为:${obj.list[i].activityId} `) 115 | msg += `\n创新创业活动ID为:${obj.list[i].activityId}` 116 | console.log(`创新创业活动名称为:${obj.list[i].name} `) 117 | msg += `\n创新创业活动名称为:${obj.list[i].name}` 118 | console.log(`创新创业活动时间为:${obj.list[i].activitytime} `) 119 | msg += `\n创新创业活动名称为:${obj.list[i].activitytime}` 120 | console.log(`创新创业活动状态为:${obj.list[i].statusText} `) 121 | msg += `\n创新创业活动状态为:${obj.list[i].statusText}` 122 | msg +=`\n` 123 | } 124 | } 125 | else if(obj.list[i].catalog2name == "实践实习"){ 126 | if(obj.list[i].status != 6 && obj.list[i].name.indexOf("补发") == -1){ 127 | console.log(`实践实习活动ID为:${obj.list[i].activityId} `) 128 | msg += `\n实践实习活动ID为:${obj.list[i].activityId}` 129 | console.log(`实践实习活动名称为:${obj.list[i].name} `) 130 | msg += `\n实践实习活动名称为:${obj.list[i].name}` 131 | console.log(`实践实习活动时间为:${obj.list[i].activitytime} `) 132 | msg += `\n实践实习活动名称为:${obj.list[i].activitytime}` 133 | console.log(`实践实习活动状态为:${obj.list[i].statusText} `) 134 | msg += `\n实践实习活动状态为:${obj.list[i].statusText}` 135 | msg +=`\n` 136 | } 137 | } 138 | else if(obj.list[i].catalog2name == "志愿公益"){ 139 | if(obj.list[i].status != 6 && obj.list[i].name.indexOf("补发") == -1){ 140 | console.log(`志愿公益活动ID为:${obj.list[i].activityId} `) 141 | msg += `\n志愿公益活动ID为:${obj.list[i].activityId}` 142 | console.log(`志愿公益活动名称为:${obj.list[i].name} `) 143 | msg += `\n志愿公益活动名称为:${obj.list[i].name}` 144 | console.log(`志愿公益活动时间为:${obj.list[i].activitytime} `) 145 | msg += `\n志愿公益活动名称为:${obj.list[i].activitytime}` 146 | console.log(`志愿公益活动状态为:${obj.list[i].statusText} `) 147 | msg += `\n志愿公益活动状态为:${obj.list[i].statusText}` 148 | msg +=`\n` 149 | } 150 | } 151 | } 152 | 153 | } else { 154 | 155 | console.log(`\n获取失败,可能是参数过期,请重抓!\n `) 156 | msg +=`\n获取失败,可能是参数过期,请重抓!\n ` 157 | } 158 | 159 | } catch (e) { 160 | console.log(e) 161 | } finally { 162 | resolve(); 163 | } 164 | }, timeout) 165 | }) 166 | } 167 | 168 | 169 | 170 | //#region 固定代码 可以不管他 171 | // ============================================变量检查============================================ \\ 172 | async function Envs() { 173 | if (dmtk) { 174 | if (dmtk.indexOf("@") != -1) { 175 | dmtk.split("@").forEach((item) => { 176 | dmtkArr.push(item); 177 | }); 178 | } else { 179 | dmtkArr.push(dmtk); 180 | } 181 | } else { 182 | console.log(`\n 【${$.name}】:未填写变量 dmtk`) 183 | return; 184 | } 185 | 186 | return true; 187 | } 188 | 189 | // ============================================发送消息============================================ \\ 190 | async function SendMsg(message) { 191 | if (!message) 192 | return; 193 | 194 | if (Notify > 0) { 195 | if ($.isNode()) { 196 | var notify = require('./sendNotify'); 197 | await notify.sendNotify($.name, message); 198 | } else { 199 | $.msg(message); 200 | } 201 | } else { 202 | console.log(message); 203 | } 204 | } 205 | 206 | /** 207 | * 随机数生成 208 | */ 209 | function randomString(e) { 210 | e = e || 32; 211 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 212 | a = t.length, 213 | n = ""; 214 | for (i = 0; i < e; i++) 215 | n += t.charAt(Math.floor(Math.random() * a)); 216 | return n 217 | } 218 | 219 | /** 220 | * 随机整数生成 221 | */ 222 | function randomInt(min, max) { 223 | return Math.round(Math.random() * (max - min) + min) 224 | } 225 | 226 | 227 | 228 | 229 | // prettier-ignore 固定代码 不用管他 230 | 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) } 231 | -------------------------------------------------------------------------------- /dt.js: -------------------------------------------------------------------------------- 1 | /* 2 | 作者:临渊 3 | 日期:6-28 4 | 软件:读特 5 | 功能:全部 6 | 抓包:开着抓包软件登录,抓 https://api.dutenews.com/api-uaa/client/token 这条链接里请求体的body部分 7 | 示例:password=xxx&device_id=xxx&grantType=custom_pwd&account=xxx 8 | 变量格式:export dt='body1@body2' 多个账号用 @ 或者 换行 分割 9 | 定时:一天一次 10 | cron:32 10 * * * 11 | 12 | [task_local] 13 | #读特 14 | 32 10 * * * https://raw.githubusercontent.com/LinYuanovo/scripts/main/dt.js, tag=读特, enabled=false 15 | [rewrite_local] 16 | https://api.dutenews.com/api-uaa/client/token url script-request-header https://raw.githubusercontent.com/LinYuanovo/scripts/main/dt.js 17 | [MITM] 18 | hostname = api.dutenews.com 19 | 20 | */ 21 | 22 | const $ = new Env('读特'); 23 | const notify = $.isNode() ? require('./sendNotify') : ''; 24 | const {log} = console; 25 | const crypto = require('crypto-js'); 26 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 27 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 28 | ////////////////////// 29 | let scriptVersion = "1.0.0"; 30 | let scriptVersionLatest = ''; 31 | let dt = ($.isNode() ? process.env.dt : $.getdata("dt")) || ""; 32 | let dtArr = []; 33 | let ck = ''; 34 | let data = ''; 35 | let msg = ''; 36 | let dtTK = ''; 37 | let userId = ''; 38 | let name = ''; 39 | let deviceId = ''; 40 | let balance = 0; 41 | let afterBalance = 0; 42 | let beforeBalance = 0; 43 | let flyCardBack = 0; 44 | let contentidArr = []; 45 | let taskType = ["CUSTOM_QIANDAO","SYS_LOGIN","SYS_READ","SYS_LIKE","SYS_COMMENT","SYS_SHARE","SYS_COLLECT","CUSTOM_WATCH_VIDEO","CUSTOM_READ_CARD_NEWS","CUSTOM_PLUS_FEED"]; 46 | //签到 2-8*1 登录1*1 阅读1*1 点赞1*6 评论2*1 分享3*3 收藏1*1 视频1*1 飞卡1*10 动态5*1 47 | 48 | 49 | !(async () => { 50 | if (typeof $request !== "undefined") { 51 | await GetRewrite(); 52 | } else { 53 | if (!(await Envs())) 54 | return; 55 | else { 56 | 57 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 58 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 59 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 60 | 61 | await poem(); 62 | await getVersion(); 63 | log(`\n============ 当前版本:${scriptVersion},最新版本:${scriptVersionLatest} ============`) 64 | log(`\n=================== 共找到 ${dtArr.length} 个账号 ===================`) 65 | if (debug) { 66 | log(`【debug】 这是你的全部账号数组:\n ${dtArr}`); 67 | } 68 | 69 | 70 | for (let index = 0; index < dtArr.length; index++) { 71 | 72 | let num = index + 1 73 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 74 | 75 | dt = dtArr[index]; 76 | deviceId = dt.match(/device_id=[-\w]{0,100}/); 77 | 78 | if (debug) { 79 | log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 80 | } 81 | 82 | msg += `\n第${num}个账号运行结果:` 83 | log('【开始登录】'); 84 | await login(); 85 | await $.wait(2000); 86 | 87 | log('【开始查询积分余额】'); 88 | await getInfo(); 89 | await $.wait(2000); 90 | beforeBalance =+ balance; 91 | 92 | log('【开始做任务】'); 93 | for (let i = 0; i < taskType.length; i++) { 94 | if (i == 3) { 95 | for (let j = 0; j < 6; j++) { 96 | await doTask(i); 97 | await $.wait(2000); 98 | } 99 | } else if (i == 5) { 100 | for (let j = 0; j < 3; j++) { 101 | await doTask(i); 102 | await $.wait(2000); 103 | } 104 | } else if (i == 8) { 105 | for (let j = 0; j < 10; j++) { 106 | await doTask(i); 107 | await $.wait(2000); 108 | } 109 | } else { 110 | await doTask(i); 111 | await $.wait(2000); 112 | } 113 | } 114 | 115 | log('【开始查询积分余额】'); 116 | await getInfo(); 117 | await $.wait(2000); 118 | afterBalance =+ balance; 119 | balance = afterBalance-beforeBalance; 120 | 121 | msg += `\n账号[${name}]本次运行获得:${balance}积分,总积分:${afterBalance}` 122 | 123 | } 124 | await SendMsg(msg); 125 | } 126 | } 127 | })() 128 | .catch((e) => log(e)) 129 | .finally(() => $.done()) 130 | 131 | /** 132 | * 登录 133 | */ 134 | function login(timeout = 2000) { 135 | let url = { 136 | url : `https://api.dutenews.com/api-uaa/client/token?clientid=1&${deviceId}&app_version=7.1.0.1&ip=100.100.100.100&system_name=android&sign=adaffff685042eac86ad34f46e99c364&siteid=10001&time=${timestampMs()}&type=android&modules=cloudlogin:1`, 137 | headers : {"Content-Type":"application/x-www-form-urlencoded","Host":"api.dutenews.com","Connection":"Keep-Alive","Accept-Encoding":"gzip","User-Agent":"okhttp/3.12.1"}, 138 | body : `${dt}` 139 | } 140 | return new Promise((resolve) => { 141 | 142 | if (debug) { 143 | log(`\n【debug】=============== 这是 登录 请求 url ===============`); 144 | log(JSON.stringify(url)); 145 | } 146 | 147 | $.post(url, async (error, response, data) => { 148 | try { 149 | if (debug) { 150 | log(`\n\n【debug】===============这是 登录 返回data==============`); 151 | log(data) 152 | } 153 | let result = JSON.parse(data); 154 | if (result.resp_code == 000000) { 155 | log(`登录获取Token成功`) 156 | dtTK = result.data.login.auth.accessToken; 157 | dtTK = "Bearer " + dtTK; 158 | userId = result.data.login.loginInfo.encodeInfo.userid; 159 | name = result.data.login.loginInfo.nickname; 160 | } else { 161 | log(`登录失败,原因是:${result.resp_msg}`) 162 | } 163 | } catch (e) { 164 | log(e) 165 | } finally { 166 | resolve(); 167 | } 168 | },timeout) 169 | }) 170 | } 171 | 172 | /** 173 | * 做任务 174 | */ 175 | function doTask(num) { 176 | return new Promise((resolve) => { 177 | let ms1 = timestampMs() 178 | let key1 = `app_version=7.1.0.1&clientid=1&contentId=${userId}_${ms1}&creditType=${taskType[num]}&${deviceId}&ip=100.100.100.100&memberId=${userId}&memberid=${userId}&modules=common%3A1&siteid=10001&system_name=android&type=android` 179 | let fv = '01ff984b3118a8ec815058f03025b6ac' 180 | let key2 = crypto.MD5(key1).toString() 181 | let ms2 = timestampMs() 182 | let key3 = key2 + fv + ms2 183 | let sign = crypto.MD5(key3).toString() 184 | let url = { 185 | url: `https://api.dutenews.com/gateway/pgc/v2/credit?clientid=1&app_version=7.1.0.1&${deviceId}&ip=100.100.100.100&system_name=android&contentId=${userId}_${ms1}&sign=${sign}&type=android&modules=common%3A1&creditType=${taskType[num]}&siteid=10001&time=${ms2}&memberid=${userId}&memberId=${userId}`, 186 | headers: {"Authorization":`${dtTK}`,"Host":"api.dutenews.com","Connection":"Keep-Alive","Accept-Encoding":"gzip","User-Agent":"okhttp/3.12.1"}, 187 | } 188 | 189 | if (debug) { 190 | log(`\n【debug】=============== 这是 做任务 请求 url ===============`); 191 | log(JSON.stringify(url)); 192 | } 193 | 194 | $.get(url, async (error, response, data) => { 195 | try { 196 | if (debug) { 197 | log(`\n\n【debug】===============这是 做任务 返回data==============`); 198 | log(data) 199 | } 200 | 201 | let result = JSON.parse(data); 202 | if (result.state == true) { 203 | if (result.data.common.hasOwnProperty("message")) { 204 | if (result.data.common.message == '完成飞卡阅读,积分+1') { 205 | pushCardBack += 1; 206 | } 207 | log(`账号[${name}]完成${result.data.common.message}`) 208 | } 209 | } else { 210 | log(`任务失败`) 211 | } 212 | 213 | } catch (e) { 214 | log(e) 215 | } finally { 216 | resolve(); 217 | } 218 | }) 219 | }) 220 | } 221 | 222 | /** 223 | * 查询积分余额 224 | */ 225 | function getInfo(timeout = 3 * 1000) { 226 | return new Promise((resolve) => { 227 | let ms1 = timestampMs() 228 | let key1 = `app_version=7.1.0.1&bind_id=${userId}&clientid=1&${deviceId}&ip=100.100.100.100&modules=integral%3A1&siteid=10001&system_name=android&type=android` 229 | let fv = '01ff984b3118a8ec815058f03025b6ac' 230 | let key2 = crypto.MD5(key1).toString() 231 | let ms2 = timestampMs() 232 | let key3 = key2 + fv + ms2 233 | let sign = crypto.MD5(key3).toString() 234 | let url = { 235 | url: `https://api.dutenews.com/gateway/pgc/v2/app/mall?bind_id=${userId}&clientid=1&app_version=7.1.0.1&${deviceId}&ip=100.100.100.100&system_name=android&sign=${sign}&siteid=10001&time=${ms2}&type=android&modules=integral%3A1`, 236 | headers: {"Authorization":`${dtTK}`,"Host":"api.dutenews.com","Connection":"Keep-Alive","Accept-Encoding":"gzip","User-Agent":"okhttp/3.12.1"}, 237 | } 238 | 239 | if (debug) { 240 | log(`\n【debug】=============== 这是 查询积分余额 请求 url ===============`); 241 | log(JSON.stringify(url)); 242 | } 243 | 244 | $.get(url, async (error, response, data) => { 245 | try { 246 | if (debug) { 247 | log(`\n\n【debug】===============这是 查询积分余额 返回data==============`); 248 | log(data) 249 | } 250 | 251 | let result = JSON.parse(data); 252 | if (result.state == true) { 253 | balance =+ result.data.integral.integral 254 | log(`账号[${name}]积分余额:${balance}`) 255 | } else { 256 | log(`账号[${name}]查询积分余额失败`) 257 | } 258 | 259 | } catch (e) { 260 | log(e) 261 | } finally { 262 | resolve(); 263 | } 264 | }, timeout) 265 | }) 266 | } 267 | 268 | // ============================================重写============================================ \\ 269 | async function GetRewrite() { 270 | if ($request.url.indexOf("api-uaa/client/token?") > -1) { 271 | const ck = $request.body; 272 | if (dt) { 273 | if (dt.indexOf(ck) == -1) { 274 | dt = dt + "@" + ck; 275 | $.setdata(dt, "dt"); 276 | List = dt.split("@"); 277 | $.msg(`【${$.name}】` + ` 获取第${dt.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 278 | } 279 | } else { 280 | $.setdata(ck, "dt"); 281 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 282 | } 283 | } 284 | } 285 | // ============================================变量检查============================================ \\ 286 | async function Envs() { 287 | if (dt) { 288 | if (dt.indexOf("@") != -1) { 289 | dt.split("@").forEach((item) => { 290 | dtArr.push(item); 291 | }); 292 | } else if (dt.indexOf("\n") != -1) { 293 | dt.split("\n").forEach((item) => { 294 | dtArr.push(item); 295 | }); 296 | } else { 297 | dtArr.push(dt); 298 | } 299 | } else { 300 | log(`\n 【${$.name}】:未填写变量 dt`) 301 | return; 302 | } 303 | 304 | return true; 305 | } 306 | 307 | // ============================================发送消息============================================ \\ 308 | async function SendMsg(message) { 309 | if (!message) 310 | return; 311 | 312 | if (Notify > 0) { 313 | if ($.isNode()) { 314 | var notify = require('./sendNotify'); 315 | await notify.sendNotify($.name, message); 316 | } else { 317 | $.msg(message); 318 | } 319 | } else { 320 | log(message); 321 | } 322 | } 323 | 324 | /** 325 | * 随机数生成 326 | */ 327 | function randomString(e) { 328 | e = e || 32; 329 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 330 | a = t.length, 331 | n = ""; 332 | for (i = 0; i < e; i++) 333 | n += t.charAt(Math.floor(Math.random() * a)); 334 | return n 335 | } 336 | 337 | /** 338 | * 随机整数生成 339 | */ 340 | function randomInt(min, max) { 341 | return Math.round(Math.random() * (max - min) + min) 342 | } 343 | 344 | /** 345 | * 获取毫秒时间戳 346 | */ 347 | function timestampMs(){ 348 | return new Date().getTime(); 349 | } 350 | 351 | /** 352 | * 获取秒时间戳 353 | */ 354 | function timestampS(){ 355 | return Date.parse(new Date())/1000; 356 | } 357 | 358 | /** 359 | * 获取随机诗词 360 | */ 361 | function poem(timeout = 3 * 1000) { 362 | return new Promise((resolve) => { 363 | let url = { 364 | url: `https://v1.jinrishici.com/all.json` 365 | } 366 | $.get(url, async (err, resp, data) => { 367 | try { 368 | data = JSON.parse(data) 369 | log(`${data.content} \n————《${data.origin}》${data.author}`); 370 | } catch (e) { 371 | log(e, resp); 372 | } finally { 373 | resolve() 374 | } 375 | }, timeout) 376 | }) 377 | } 378 | 379 | /** 380 | * 修改配置文件 381 | */ 382 | function modify() { 383 | 384 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 385 | if(err){ 386 | return log('读取文件失败!'+err) 387 | } 388 | else { 389 | var result = dataStr.replace(/regular/g,string); 390 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 391 | if (err) {return log(err);} 392 | }); 393 | } 394 | }) 395 | } 396 | 397 | /** 398 | * 获取远程版本 399 | */ 400 | function getVersion(timeout = 3 * 1000) { 401 | return new Promise((resolve) => { 402 | let url = { 403 | url: `https://raw.gh.fakev.cn/LinYuanovo/scripts/main/dt.js`, 404 | } 405 | $.get(url, async (err, resp, data) => { 406 | try { 407 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 408 | } catch (e) { 409 | $.logErr(e, resp); 410 | } finally { 411 | resolve() 412 | } 413 | }, timeout) 414 | }) 415 | } 416 | 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) } 417 | -------------------------------------------------------------------------------- /fmp.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ 临渊 3 | * 软件:飞猫盘及橘猫众包 4 | * 功能:飞猫盘及橘猫众包每日签到获取福利点,可加速下载使用 5 | * 抓取域名: 6 | * mapi.fmapp.com 7 | * mapi.tgy123.com 8 | * 里面的token即可 9 | * 变量格式:export fmtoken=' xxxx@xxxx ' 多个账号用 @分割 10 | */ 11 | 12 | const jsname = "飞猫盘+橘猫众包每日签到"; 13 | const $ = Env(jsname); 14 | const notify = $.isNode() ? require('./sendNotify') : ''; 15 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 16 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 17 | ////////////////////// 18 | let fmtoken = process.env.fmtoken; 19 | let fmtokenArr = []; 20 | let data = ''; 21 | let msg = ''; 22 | let back = ''; 23 | 24 | !(async () => { 25 | 26 | if (!(await Envs())) 27 | return; 28 | else { 29 | 30 | console.log(`===================作者:临渊===================`); 31 | console.log(`\n\n========================================= \n脚本执行 - 北京时间:${new Date( 32 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 33 | 8 * 60 * 60 * 1000).toLocaleString()} \n=========================================\n`); 34 | 35 | 36 | console.log(`\n=================== 共找到 ${fmtokenArr.length} 个账号 ===================`) 37 | 38 | if (debug) { 39 | console.log(`【debug】 这是你的全部账号数组:\n ${fmtokenArr}`); 40 | } 41 | 42 | 43 | for (let index = 0; index < fmtokenArr.length; index++) { 44 | 45 | fmtoken = fmtokenArr[index] 46 | let num = index + 1 47 | console.log(`\n========= 开始【第 ${num} 个账号】=========\n`) 48 | 49 | 50 | 51 | if (debug) { 52 | console.log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 53 | } 54 | msg+=`第${num}个账号签到结果:\n` 55 | console.log('开始飞猫盘APP签到'); 56 | await signin1(); 57 | await $.wait(2 * 1000); 58 | while (back == "undefined"){ 59 | await signin1(); 60 | await $.wait(2 * 1000); 61 | } 62 | 63 | console.log('开始飞猫盘连签10天奖励'); 64 | await getBonus10(); 65 | await $.wait(2 * 1000); 66 | while (back == "undefined"){ 67 | await getBonus10(); 68 | await $.wait(2 * 1000); 69 | } 70 | 71 | console.log('开始飞猫盘连签30天奖励'); 72 | await getBonus30(); 73 | await $.wait(2 * 1000); 74 | while (back == "undefined"){ 75 | await getBonus30(); 76 | await $.wait(2 * 1000); 77 | } 78 | 79 | console.log('开始橘猫众包APP签到'); 80 | await signin2(); 81 | await $.wait(2 * 1000); 82 | while (back == "undefined"){ 83 | await signin2(); 84 | await $.wait(2 * 1000); 85 | } 86 | } 87 | await SendMsg(msg); 88 | } 89 | 90 | })() 91 | .catch((e) => console.logErr(e)) 92 | .finally(() => $.done()) 93 | 94 | /** 95 | *飞猫盘签到 96 | */ 97 | function signin1(timeout = 3 * 1000) { 98 | return new Promise((resolve) => { 99 | let url = { 100 | url: `https://mapi.fmapp.com/tgy/tosign`, 101 | headers: { 102 | "Host": "mapi.fmapp.com", 103 | "fmver": "55", 104 | "token": `${fmtoken}`, 105 | "plat": "feemoo", 106 | "os": "android", 107 | "content-length": "0", 108 | "accept-encoding": "gzip", 109 | "user-agent": "okhttp/3.14.9" 110 | }, 111 | body: '' //虽然是post请求,但是body为空 112 | 113 | } 114 | 115 | if (debug) { 116 | console.log(`\n【debug】=============== 这是 签到 请求 url ===============`); 117 | console.log(JSON.stringify(url)); 118 | } 119 | $.post(url, async (error, response, data) => { 120 | try { 121 | if (debug) { 122 | console.log(`\n\n【debug】===============这是 签到 返回data==============`); 123 | console.log(data) 124 | } 125 | back = eval("(" + data + ")"); 126 | let result = eval("(" + data + ")"); 127 | if (result.status == 1) { 128 | console.log(`【签到成功】🎉`) 129 | msg += `\n【飞猫签到成功】🎉\n您的福利点点数为:${result.data.point}` 130 | msg += `\n您的连续签到天数为:${result.data.sigcount}` 131 | 132 | } else { 133 | console.log(`\n【签到失败】,原因是:${result.msg}!\n `) 134 | msg += `【飞猫签到失败】,原因是:${result.msg}!\n` 135 | } 136 | 137 | } catch (e) { 138 | console.log(e) 139 | } finally { 140 | resolve(); 141 | } 142 | }, timeout) 143 | }) 144 | } 145 | 146 | /** 147 | *飞猫盘领取额外10天签到奖励 148 | */ 149 | function getBonus10(timeout = 3 * 1000) { 150 | return new Promise((resolve) => { 151 | let url = { 152 | url: `https://mapi.fmapp.com/tgy/getpoint`, 153 | headers: { 154 | "Host": "mapi.fmapp.com", 155 | "fmver": "57", 156 | "token": `${fmtoken}`, 157 | "plat": "xiaomi", 158 | "os": "android", 159 | "content-type": "application/x-www-form-urlencoded", 160 | "content-length": "5", 161 | "accept-encoding": "gzip", 162 | "user-agent": "okhttp/3.14.9" 163 | }, 164 | body: 'tid=7' 165 | 166 | } 167 | 168 | if (debug) { 169 | console.log(`\n【debug】=============== 这是 领取连签10天奖励 请求 url ===============`); 170 | console.log(JSON.stringify(url)); 171 | } 172 | $.post(url, async (error, response, data) => { 173 | try { 174 | if (debug) { 175 | console.log(`\n\n【debug】===============这是 领取连签10天奖励 返回data==============`); 176 | console.log(data) 177 | } 178 | back = eval("(" + data + ")"); 179 | let result = eval("(" + data + ")"); 180 | if (result.status == 1) { 181 | console.log(`领取连签10天奖励成功`) 182 | msg += `\n领取连签10天奖励成功` 183 | } else if(result.status == 0){ 184 | console.log(`\n领取连签10天奖励失败,原因是:已领取!\n `) 185 | } else{ 186 | console.log(`领取失败`) 187 | } 188 | } catch (e) { 189 | console.log(e) 190 | } finally { 191 | resolve(); 192 | } 193 | }, timeout) 194 | }) 195 | } 196 | 197 | /** 198 | *飞猫盘领取额外30天签到奖励 199 | */ 200 | function getBonus30(timeout = 3 * 1000) { 201 | return new Promise((resolve) => { 202 | let url = { 203 | url: `https://mapi.fmapp.com/tgy/getpoint`, 204 | headers: { 205 | "Host": "mapi.fmapp.com", 206 | "fmver": "57", 207 | "token": `${fmtoken}`, 208 | "plat": "xiaomi", 209 | "os": "android", 210 | "content-type": "application/x-www-form-urlencoded", 211 | "content-length": "5", 212 | "accept-encoding": "gzip", 213 | "user-agent": "okhttp/3.14.9" 214 | }, 215 | body: 'tid=8' 216 | 217 | } 218 | 219 | if (debug) { 220 | console.log(`\n【debug】=============== 这是 领取连签30天奖励 请求 url ===============`); 221 | console.log(JSON.stringify(url)); 222 | } 223 | $.post(url, async (error, response, data) => { 224 | try { 225 | if (debug) { 226 | console.log(`\n\n【debug】===============这是 领取连签30天奖励 返回data==============`); 227 | console.log(data) 228 | } 229 | back = eval("(" + data + ")"); 230 | let result = eval("(" + data + ")"); 231 | if (result.status == 1) { 232 | console.log(`领取连签30天奖励成功🎉`) 233 | msg += `\n领取连签30天奖励成功` 234 | } else if(result.status == 0){ 235 | console.log(`\n领取连签30天奖励失败,原因是:已领取!\n `) 236 | } else{ 237 | console.log(`领取失败`) 238 | } 239 | 240 | } catch (e) { 241 | console.log(e) 242 | } finally { 243 | resolve(); 244 | } 245 | }, timeout) 246 | }) 247 | } 248 | 249 | /** 250 | *橘猫众包签到 251 | */ 252 | function signin2(timeout = 3 * 1000) { 253 | return new Promise((resolve) => { 254 | let url = { 255 | url: `https://mapi.tgy123.com/index.php/marketing/signIn`, 256 | headers: { 257 | "Host": "mapi.tgy123.com", 258 | "os": "android", 259 | "version": "14", 260 | "token": `${fmtoken}`, 261 | "channel": "jmzb", 262 | "content-type": "application/x-www-form-urlencoded", 263 | "content-length": "5", 264 | "accept-encoding": "gzip", 265 | "user-agent": "okhttp/3.10.0" 266 | }, 267 | body: 'flag=' 268 | } 269 | 270 | if (debug) { 271 | console.log(`\n【debug】=============== 这是 签到 请求 url ===============`); 272 | console.log(JSON.stringify(url)); 273 | } 274 | 275 | $.post(url, async (error, response, data) => { 276 | try { 277 | if (debug) { 278 | console.log(`\n\n【debug】===============这是 签到 返回data==============`); 279 | console.log(data) 280 | } 281 | back = eval("(" + data + ")"); 282 | let result = eval("(" + data + ")"); 283 | if (result.status == 1) { 284 | console.log(`【签到成功】🎉`) 285 | msg += `\n【橘猫签到成功】🎉\n您的福利点点数为:${result.data.point}` 286 | msg += `\n您的连续签到天数为:${result.data.sigcount}\n` 287 | 288 | } else { 289 | console.log(`\n【签到失败】,原因是:${result.msg}!\n `) 290 | msg += `【橘猫签到失败】,原因是:${result.msg}!\n` 291 | } 292 | 293 | } catch (e) { 294 | console.log(e) 295 | } finally { 296 | resolve(); 297 | } 298 | }, timeout) 299 | }) 300 | } 301 | // ============================================变量检查============================================ \\ 302 | async function Envs() { 303 | if (fmtoken) { 304 | if (fmtoken.indexOf("@") != -1) { 305 | fmtoken.split("@").forEach((item) => { 306 | fmtokenArr.push(item); 307 | }); 308 | } else { 309 | fmtokenArr.push(fmtoken); 310 | } 311 | } else { 312 | console.log(`\n 【${$.name}】:未填写变量 fmtoken`) 313 | return; 314 | } 315 | 316 | return true; 317 | } 318 | 319 | // ============================================发送消息============================================ \\ 320 | async function SendMsg(message) { 321 | if (!message) 322 | return; 323 | 324 | if (Notify > 0) { 325 | if ($.isNode()) { 326 | var notify = require('./sendNotify'); 327 | await notify.sendNotify($.name, message); 328 | } else { 329 | $.msg(message); 330 | } 331 | } else { 332 | console.log(message); 333 | } 334 | } 335 | 336 | /** 337 | * 随机数生成 338 | */ 339 | function randomString(e) { 340 | e = e || 32; 341 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 342 | a = t.length, 343 | n = ""; 344 | for (i = 0; i < e; i++) 345 | n += t.charAt(Math.floor(Math.random() * a)); 346 | return n 347 | } 348 | 349 | /** 350 | * 随机整数生成 351 | */ 352 | function randomInt(min, max) { 353 | return Math.round(Math.random() * (max - min) + min) 354 | } 355 | 356 | 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) } 357 | -------------------------------------------------------------------------------- /glados.js: -------------------------------------------------------------------------------- 1 | /* 2 | 作者:临渊 3 | 日期:2022-12-19 4 | 入口:https://glados.rocks/ 5 | 抓包:抓取域名下的Cookie填入 6 | 示例:koa:sess=xxx;koa:sess.sig=xxx 7 | 变量:gladosCK 多个账号用 @ 或者 换行 分割 8 | 定时一天一次 9 | cron: 11 11 * * * 10 | */ 11 | 12 | const $ = new Env('GLaDOS签到'); 13 | const notify = $.isNode() ? require('./sendNotify') : ''; 14 | const {log} = console; 15 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 16 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 17 | let scriptVersion = "1.0.0"; 18 | ////////////////////// 19 | let scriptVersionLatest = ''; 20 | let gladosCK = ($.isNode() ? process.env.gladosCK : $.getdata("gladosCK")) || ""; 21 | let gladosCKArr = []; 22 | let data = ''; 23 | let msg = ''; 24 | 25 | !(async () => { 26 | if (typeof $request !== "undefined") { 27 | // await GetRewrite(); 28 | } else { 29 | if (!(await Envs())) 30 | return; 31 | else { 32 | 33 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 34 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 35 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 36 | log(`作者:临渊`) 37 | log(`库地址:https://github.com/LinYuanovo/scripts.git`) 38 | await getVersion(); 39 | log(`\n============ 当前版本:${scriptVersion},最新版本:${scriptVersionLatest} ============`) 40 | log(`\n=================== 共找到 ${gladosCKArr.length} 个账号 ===================`) 41 | 42 | if (debug) { 43 | log(`【debug】 这是你的全部账号数组:\n ${gladosCKArr}`); 44 | } 45 | 46 | for (let index = 0; index < gladosCKArr.length; index++) { 47 | 48 | let num = index + 1 49 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 50 | data = gladosCKArr[index]; 51 | if (debug) { 52 | log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 53 | } 54 | 55 | msg += `\n第${num}个账号运行结果:` 56 | log('开始签到'); 57 | await signin(); 58 | await $.wait(2 * 1000); 59 | 60 | } 61 | await SendMsg(msg); 62 | } 63 | } 64 | 65 | })() 66 | .catch((e) => log(e)) 67 | .finally(() => $.done()) 68 | 69 | 70 | /** 71 | * 签到 72 | */ 73 | function signin(timeout = 3 * 1000) { 74 | return new Promise((resolve) => { 75 | let url = { 76 | url: `https://glados.rocks/api/user/checkin`, 77 | headers: { 78 | "Host": "glados.rocks", 79 | "accept": "application/json, text/plain, */*", 80 | "authorization": "87016523154466556216119167854561-873-393", 81 | "user-agent": "Mozilla/5.0 (Linux; Android 12; M2012K11AC Build/SKQ1.220303.001) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.129 Mobile Safari/537.36", 82 | "Content-Type": "application/json;charset=UTF-8", 83 | "origin": "https://glados.rocks", 84 | "accept-encoding": "gzip, deflate", 85 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 86 | "cookie": `${data}` 87 | }, 88 | body: `{"token":"glados.network"}`, 89 | } 90 | 91 | if (debug) { 92 | log(`\n【debug】=============== 这是 签到 请求 url ===============`); 93 | log(JSON.stringify(url)); 94 | } 95 | 96 | $.post(url, async (error, response, data) => { 97 | try { 98 | if (debug) { 99 | log(`\n\n【debug】===============这是 签到 返回data==============`); 100 | log(data) 101 | } 102 | 103 | let result = JSON.parse(data); 104 | if (result.code == 0) { 105 | log(`[${result.list[0].business.match(/[0-9\-]+/)}]签到成功`) 106 | msg += `\n[${result.list[0].business.match(/[0-9\-]+/)}]签到成功` 107 | } else if (result.code === 1) { 108 | log(`[${result.list[0].business.match(/[0-9\-]+/)}]签到失败,今日已签到`) 109 | msg += `\n[${result.list[0].business.match(/[0-9\-]+/)}]签到失败,今日已签到` 110 | } else { 111 | log(`签到失败,原因是:${result.message}`) 112 | msg += `\n签到失败,原因是:${result.message}` 113 | } 114 | 115 | } catch (e) { 116 | log(e) 117 | } finally { 118 | resolve(); 119 | } 120 | }, timeout) 121 | }) 122 | } 123 | 124 | // ============================================重写============================================ \\ 125 | async function GetRewrite() { 126 | if ($request.url.indexOf("console") > -1) { 127 | let ck = $request.body; 128 | if (gladosCK) { 129 | if (gladosCK.indexOf(ck) == -1) { 130 | gladosCK = gladosCK + "@" + ck; 131 | $.setdata(gladosCK, "gladosCK"); 132 | let List = gladosCK.split("@"); 133 | $.msg( 134 | $.name + 135 | ` 获取第${List.length}个 ck 成功: ${ck} ,不用请自行关闭重写!` 136 | ); 137 | } 138 | } else { 139 | $.setdata(ck, "gladosCK"); 140 | $.msg($.name + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 141 | } 142 | } 143 | } 144 | // ============================================变量检查============================================ \\ 145 | async function Envs() { 146 | if (gladosCK) { 147 | if (gladosCK.indexOf("@") != -1) { 148 | gladosCK.split("@").forEach((item) => { 149 | gladosCKArr.push(item); 150 | }); 151 | } else if (gladosCK.indexOf("\n") != -1) { 152 | gladosCK.split("\n").forEach((item) => { 153 | gladosCKArr.push(item); 154 | }); 155 | } else { 156 | gladosCKArr.push(gladosCK); 157 | } 158 | } else { 159 | log(`\n 【${$.name}】:未填写变量 gladosCK`) 160 | return; 161 | } 162 | 163 | return true; 164 | } 165 | 166 | // ============================================发送消息============================================ \\ 167 | async function SendMsg(message) { 168 | if (!message) 169 | return; 170 | 171 | if (Notify > 0) { 172 | if ($.isNode()) { 173 | var notify = require('./sendNotify'); 174 | await notify.sendNotify($.name, message); 175 | } else { 176 | $.msg(message); 177 | } 178 | } else { 179 | log(message); 180 | } 181 | } 182 | 183 | /** 184 | * 随机数生成 185 | */ 186 | function randomString(e) { 187 | e = e || 32; 188 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 189 | a = t.length, 190 | n = ""; 191 | for (i = 0; i < e; i++) 192 | n += t.charAt(Math.floor(Math.random() * a)); 193 | return n 194 | } 195 | 196 | /** 197 | * 随机整数生成 198 | */ 199 | function randomInt(min, max) { 200 | return Math.round(Math.random() * (max - min) + min) 201 | } 202 | 203 | /** 204 | * 获取毫秒时间戳 205 | */ 206 | function timestampMs(){ 207 | return new Date().getTime(); 208 | } 209 | 210 | /** 211 | * 获取秒时间戳 212 | */ 213 | function timestampS(){ 214 | return Date.parse(new Date())/1000; 215 | } 216 | 217 | /** 218 | * 获取随机诗词 219 | */ 220 | function poem(timeout = 3 * 1000) { 221 | return new Promise((resolve) => { 222 | let url = { 223 | url: `https://v1.jinrishici.com/all.json` 224 | } 225 | $.get(url, async (err, resp, data) => { 226 | try { 227 | data = JSON.parse(data) 228 | log(`${data.content} \n————《${data.origin}》${data.author}`); 229 | } catch (e) { 230 | log(e, resp); 231 | } finally { 232 | resolve() 233 | } 234 | }, timeout) 235 | }) 236 | } 237 | 238 | /** 239 | * 修改配置文件 240 | */ 241 | function modify() { 242 | 243 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 244 | if(err){ 245 | return log('读取文件失败!'+err) 246 | } 247 | else { 248 | var result = dataStr.replace(/regular/g,string); 249 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 250 | if (err) {return log(err);} 251 | }); 252 | } 253 | }) 254 | } 255 | 256 | /** 257 | * 获取远程版本 258 | */ 259 | function getVersion(timeout = 3 * 1000) { 260 | return new Promise((resolve) => { 261 | let url = { 262 | url: `https://raw.gh.fakev.cn/LinYuanovo/scripts/main/dt.js`, 263 | } 264 | $.get(url, async (err, resp, data) => { 265 | try { 266 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 267 | } catch (e) { 268 | $.logErr(e, resp); 269 | } finally { 270 | resolve() 271 | } 272 | }, timeout) 273 | }) 274 | } 275 | 276 | 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) } -------------------------------------------------------------------------------- /hdl.js: -------------------------------------------------------------------------------- 1 | /* 2 | 作者:临渊 3 | 日期:6-21 4 | 小程序:海底捞(活动入口:首页->每日签到) 5 | 功能:签到(积分可以兑换菜品、火锅) 6 | 抓包:superapp-public.kiwa-tech.com 此域名下的任意 _haidilao_app_token (TK有效期未知) 7 | 示例:TOKEN_APP_xx-xx-xx-xx-xx 8 | 变量格式:export hdlTk='xxx@xxx ' 多个账号用@或者换行分割 9 | 定时:一天一次 10 | cron:20 10 * * * 11 | */ 12 | 13 | const $ = new Env('海底捞'); 14 | const notify = $.isNode() ? require('./sendNotify') : ''; 15 | const {log} = console; 16 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 17 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 18 | ////////////////////// 19 | let hdlTk = process.env.hdlTk; 20 | let hdlTkArr = []; 21 | let data = ''; 22 | let msg = ''; 23 | let mobile = ''; 24 | let hdlBack = 0; 25 | 26 | 27 | !(async () => { 28 | 29 | if (!(await Envs())) 30 | return; 31 | else { 32 | 33 | 34 | 35 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 36 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 37 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 38 | 39 | await poem(); 40 | 41 | log(`\n=================== 共找到 ${hdlTkArr.length} 个账号 ===================`) 42 | 43 | if (debug) { 44 | log(`【debug】 这是你的全部账号数组:\n ${hdlTkArr}`); 45 | } 46 | 47 | 48 | for (let index = 0; index < hdlTkArr.length; index++) { 49 | 50 | let num = index + 1 51 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 52 | 53 | hdlTk = hdlTkArr[index]; 54 | 55 | if (debug) { 56 | log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${hdltk}\n`); 57 | } 58 | 59 | msg += `\n第${num}个账号运行结果:` 60 | log('开始获取信息'); 61 | await getInfo(); 62 | await $.wait(2 * 1000); 63 | 64 | if (hdlBack) { 65 | log('开始签到'); 66 | await doSignin(); 67 | await $.wait(2 * 1000); 68 | 69 | log('开始查询积分余额'); 70 | await getFragment(); 71 | await $.wait(2 * 1000); 72 | } 73 | 74 | } 75 | await SendMsg(msg); 76 | } 77 | 78 | })() 79 | .catch((e) => log(e)) 80 | .finally(() => $.done()) 81 | 82 | /** 83 | * 获取信息 84 | */ 85 | function getInfo(timeout = 3 * 1000) { 86 | return new Promise((resolve) => { 87 | let url = { 88 | url: `https://superapp-public.kiwa-tech.com/activity/wxapp/applet/queryGrowthInfo`, 89 | headers: {"Host":"superapp-public.kiwa-tech.com","content-type":"application/json","user-agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand2 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram/wx1ddeb67115f30d1a","reqtype":"APPH5","_haidilao_app_token":`${hdlTk}`}, 90 | body: '{}', 91 | } 92 | 93 | if (debug) { 94 | log(`\n【debug】=============== 这是 获取信息 请求 url ===============`); 95 | log(JSON.stringify(url)); 96 | } 97 | 98 | $.post(url, async (error, response, data) => { 99 | try { 100 | if (debug) { 101 | log(`\n\n【debug】===============这是 获取信息 返回data==============`); 102 | log(data) 103 | } 104 | 105 | let result = JSON.parse(data); 106 | if (result.success == true) { 107 | 108 | mobile = result.data.mobile; 109 | hdlBack = 1; 110 | 111 | } else if (result.success == false) { 112 | 113 | log(`获取账号信息失败,请检查变量`) 114 | msg += `\n获取账号信息失败,请检查变量` 115 | 116 | } else { 117 | 118 | log(`获取账号信息失败,原因是:${result.msg}`) 119 | msg += `\n获取账号信息失败,原因是:${result.msg}` 120 | 121 | } 122 | 123 | } catch (e) { 124 | log(e) 125 | } finally { 126 | resolve(); 127 | } 128 | }, timeout) 129 | }) 130 | } 131 | 132 | /** 133 | * 签到 134 | */ 135 | function doSignin(timeout = 3 * 1000) { 136 | return new Promise((resolve) => { 137 | let url = { 138 | url: `https://superapp-public.kiwa-tech.com/activity/wxapp/signin/signin`, 139 | headers: {"Host":"superapp-public.kiwa-tech.com","Content-Type":"application/json","user-agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand2 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram/wx1ddeb67115f30d1a","reqtype":"APPH5","_haidilao_app_token":`${hdlTk}`}, 140 | body: '{"signinSource":"MiniApp"}', 141 | } 142 | 143 | if (debug) { 144 | log(`\n【debug】=============== 这是 签到 请求 url ===============`); 145 | log(JSON.stringify(url)); 146 | } 147 | 148 | $.post(url, async (error, response, data) => { 149 | try { 150 | if (debug) { 151 | log(`\n\n【debug】===============这是 签到 返回data==============`); 152 | log(data) 153 | } 154 | 155 | let result = JSON.parse(data); 156 | let back = eval(result.data); 157 | if (result.success == true) { 158 | 159 | log(`账号[${mobile}]签到成功,获得:${back.signinQueryDetailList[0].fragment}积分`) 160 | msg += `\n账号[${mobile}]签到成功,获得:${back.signinQueryDetailList[0].fragment}积分` 161 | 162 | } else if (result.success == false) { 163 | 164 | log(`账号[${mobile}]签到失败,原因是:${result.msg}`) 165 | msg += `\n账号[${mobile}]签到失败,原因是:${result.msg}` 166 | 167 | } else { 168 | 169 | log(`账号[${mobile}]签到失败,原因是:${result.error}`) 170 | msg += `\n账号[${mobile}]签到失败,原因是:${result.error}` 171 | 172 | } 173 | 174 | } catch (e) { 175 | log(e) 176 | } finally { 177 | resolve(); 178 | } 179 | }, timeout) 180 | }) 181 | } 182 | 183 | /** 184 | * 查询积分余额 185 | */ 186 | function getFragment(timeout = 3 * 1000) { 187 | return new Promise((resolve) => { 188 | let url = { 189 | url: `https://superapp-public.kiwa-tech.com/activity/wxapp/signin/queryFragment`, 190 | headers: {"Host":"superapp-public.kiwa-tech.com","content-type":"application/json","user-agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand2 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 miniProgram/wx1ddeb67115f30d1a","reqtype":"APPH5","_haidilao_app_token":`${hdlTk}`}, 191 | body: '', 192 | } 193 | 194 | if (debug) { 195 | log(`\n【debug】=============== 这是 查询积分余额 请求 url ===============`); 196 | log(JSON.stringify(url)); 197 | } 198 | 199 | $.post(url, async (error, response, data) => { 200 | try { 201 | if (debug) { 202 | log(`\n\n【debug】===============这是 查询积分余额 返回data==============`); 203 | log(data) 204 | } 205 | 206 | let result = JSON.parse(data); 207 | if (result.success == true) { 208 | 209 | log(`账号[${mobile}]积分余额为:${result.data.total},最近一次过期时间为:${result.data.expireDate}`) 210 | msg += `\n账号[${mobile}]积分余额为:${result.data.total},最近一次过期时间为:${result.data.expireDate}` 211 | 212 | } else { 213 | 214 | log(`账号[${mobile}]查询积分余额失败,原因是:${result.msg}`) 215 | msg += `\n账号[${mobile}]查询积分余额失败,原因是:${result.msg}` 216 | 217 | } 218 | 219 | } catch (e) { 220 | log(e) 221 | } finally { 222 | resolve(); 223 | } 224 | }, timeout) 225 | }) 226 | } 227 | 228 | // ============================================变量检查============================================ \\ 229 | async function Envs() { 230 | if (hdlTk) { 231 | if (hdlTk.indexOf("@") != -1) { 232 | hdlTk.split("@").forEach((item) => { 233 | hdlTkArr.push(item); 234 | }); 235 | } else if (hdlTk.indexOf("\n") != -1) { 236 | hdlTk.split("\n").forEach((item) => { 237 | hdlTkArr.push(item); 238 | }); 239 | } else { 240 | hdlTkArr.push(hdlTk); 241 | } 242 | } else { 243 | log(`\n 【${$.name}】:未填写变量 hdlTk`) 244 | return; 245 | } 246 | 247 | return true; 248 | } 249 | 250 | // ============================================发送消息============================================ \\ 251 | async function SendMsg(message) { 252 | if (!message) 253 | return; 254 | 255 | if (Notify > 0) { 256 | if ($.isNode()) { 257 | var notify = require('./sendNotify'); 258 | await notify.sendNotify($.name, message); 259 | } else { 260 | $.msg(message); 261 | } 262 | } else { 263 | log(message); 264 | } 265 | } 266 | 267 | /** 268 | * 随机数生成 269 | */ 270 | function randomString(e) { 271 | e = e || 32; 272 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 273 | a = t.length, 274 | n = ""; 275 | for (i = 0; i < e; i++) 276 | n += t.charAt(Math.floor(Math.random() * a)); 277 | return n 278 | } 279 | 280 | /** 281 | * 随机整数生成 282 | */ 283 | function randomInt(min, max) { 284 | return Math.round(Math.random() * (max - min) + min) 285 | } 286 | 287 | /** 288 | * 获取毫秒时间戳 289 | */ 290 | function timestampMs(){ 291 | return new Date().getTime(); 292 | } 293 | 294 | /** 295 | * 获取秒时间戳 296 | */ 297 | function timestampS(){ 298 | return Date.parse(new Date())/1000; 299 | } 300 | 301 | /** 302 | * 获取随机诗词 303 | */ 304 | function poem(timeout = 3 * 1000) { 305 | return new Promise((resolve) => { 306 | let url = { 307 | url: `https://v1.jinrishici.com/all.json` 308 | } 309 | $.get(url, async (err, resp, data) => { 310 | try { 311 | data = JSON.parse(data) 312 | log(`${data.content} \n————《${data.origin}》${data.author}`); 313 | } catch (e) { 314 | log(e, resp); 315 | } finally { 316 | resolve() 317 | } 318 | }, timeout) 319 | }) 320 | } 321 | 322 | /** 323 | * 修改配置文件 324 | */ 325 | function modify() { 326 | 327 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 328 | if(err){ 329 | return log('读取文件失败!'+err) 330 | } 331 | else { 332 | var result = dataStr.replace(/regular/g,string); 333 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 334 | if (err) {return log(err);} 335 | }); 336 | } 337 | }) 338 | } 339 | 340 | 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) } 341 | -------------------------------------------------------------------------------- /hkl.js: -------------------------------------------------------------------------------- 1 | /* 2 | 作者:临渊 3 | 日期:6-15 4 | 小程序:豪客来会员商城 5 | 功能:签到 6 | 抓包:登陆后点击豪友圈 shop.zhaixiaoniu.com/8765/api/crmOpenApiV1/getHbsSignInfo 请求体里面的 body 部分全部 7 | 示例:appId=x&siteCode=x&channelCode=x¬DevelopedFlag=&terNo=x¶m=%7B%22memberId%22%3A%22x%22%7D 8 | 变量:hklbody='xxx@xxx ' 多个账号用@或者换行分割 9 | 定时一天一次 10 | cron:20 10 * * * 11 | */ 12 | 13 | const $ = new Env('豪客来'); 14 | const notify = $.isNode() ? require('./sendNotify') : ''; 15 | const {log} = console; 16 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 17 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 18 | ////////////////////// 19 | let hklbody = process.env.hklbody; 20 | let hklbodyArr = []; 21 | let data = ''; 22 | let msg = ''; 23 | 24 | 25 | !(async () => { 26 | 27 | if (!(await Envs())) 28 | return; 29 | else { 30 | 31 | 32 | 33 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 34 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 35 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 36 | 37 | await poem(); 38 | 39 | log(`\n=================== 共找到 ${hklbodyArr.length} 个账号 ===================`) 40 | 41 | if (debug) { 42 | log(`【debug】 这是你的全部账号数组:\n ${hklbodyArr}`); 43 | } 44 | 45 | 46 | for (let index = 0; index < hklbodyArr.length; index++) { 47 | 48 | 49 | let num = index + 1 50 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 51 | 52 | hklbody = hklbodyArr[index]; 53 | 54 | if (debug) { 55 | log(`\n 【debug】 这是你第 ${num} 个账号信息:\n ${hklbody}\n`); 56 | } 57 | 58 | msg += `\n第${num}个账号运行结果:` 59 | log('开始签到'); 60 | await signin(); 61 | await $.wait(2 * 1000); 62 | 63 | log('开始查询信息'); 64 | await getInfo(); 65 | await $.wait(2 * 1000); 66 | 67 | } 68 | await SendMsg(msg); 69 | } 70 | 71 | })() 72 | .catch((e) => log(e)) 73 | .finally(() => $.done()) 74 | 75 | 76 | /** 77 | * 签到 78 | */ 79 | function signin(timeout = 3 * 1000) { 80 | return new Promise((resolve) => { 81 | let url = { 82 | url: `https://shop.zhaixiaoniu.com/8765/api/crmOpenApiV1/hbsSign`, 83 | headers: { 84 | "Host": "shop.zhaixiaoniu.com", 85 | "Connection": "keep-alive", 86 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand0 WeChat/arm64 Weixin NetType/4G Language/zh_CN ABI/arm64 MiniProgramEnv/android", 87 | "content-type": "application/x-www-form-urlencoded" 88 | }, 89 | body: `${hklbody}`, 90 | } 91 | 92 | if (debug) { 93 | log(`\n【debug】=============== 这是 签到 请求 url ===============`); 94 | log(JSON.stringify(url)); 95 | } 96 | 97 | $.post(url, async (error, response, data) => { 98 | try { 99 | if (debug) { 100 | log(`\n\n【debug】===============这是 签到 返回data==============`); 101 | log(data) 102 | } 103 | 104 | let result = JSON.parse(data); 105 | if (result.soaStateBean.code == 1) { 106 | 107 | log(`【签到成功】 连续签到:${result.data.continueSignDays}天,获得:${result.data.receiveHbsNum}豪币`) 108 | msg += `\n【签到成功】 连续签到:${result.data.continueSignDays}天,获得:${result.data.receiveHbsNum}豪币` 109 | 110 | } else if (result.soaStateBean.code == 0) { 111 | 112 | log(`【签到失败】${result.soaStateBean.message}`) 113 | msg += `\n【签到失败】${result.soaStateBean.message}` 114 | 115 | } else if (result.soaStateBean.code == 403) { 116 | 117 | log(`【签到失败】Body错误`) 118 | msg += `\n【签到失败】Body错误` 119 | 120 | } else { 121 | 122 | log(`【签到失败】原因是:${result.soaStateBean.message}`) 123 | msg += `\n【签到失败】原因是:${result.soaStateBean.message}` 124 | 125 | } 126 | 127 | } catch (e) { 128 | log(e) 129 | } finally { 130 | resolve(); 131 | } 132 | }, timeout) 133 | }) 134 | } 135 | 136 | /** 137 | * 查询信息 138 | */ 139 | function getInfo(timeout = 3 * 1000) { 140 | return new Promise((resolve) => { 141 | let url = { 142 | url: `https://shop.zhaixiaoniu.com/8765/api/user/getUserRealTimeInfo.do`, 143 | headers: { 144 | "Host": "shop.zhaixiaoniu.com", 145 | "Connection": "keep-alive", 146 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3235 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/appbrand0 WeChat/arm64 Weixin NetType/4G Language/zh_CN ABI/arm64 MiniProgramEnv/android", 147 | "content-type": "application/x-www-form-urlencoded" 148 | }, 149 | body: `${hklbody}`, 150 | } 151 | 152 | if (debug) { 153 | log(`\n【debug】=============== 这是 查询信息 请求 url ===============`); 154 | log(JSON.stringify(url)); 155 | } 156 | 157 | $.post(url, async (error, response, data) => { 158 | try { 159 | if (debug) { 160 | log(`\n\n【debug】===============这是 查询信息 返回data==============`); 161 | log(data) 162 | } 163 | 164 | let result = JSON.parse(data); 165 | if (result.soaStateBean.code == 1) { 166 | 167 | log(`【账号信息】豪币余额:${result.data.hbNum}`) 168 | msg += `\n【账号信息】豪币余额:${result.data.hbNum}` 169 | 170 | } else if (result.soaStateBean.code == 403) { 171 | 172 | log(`【查询信息失败】Body错误`) 173 | msg += `\n【查询信息失败】Body错误` 174 | 175 | } else { 176 | 177 | log(`【查询信息失败】原因是:${result.soaStateBean.message}`) 178 | msg += `\n【查询信息失败】原因是:${result.soaStateBean.message}` 179 | 180 | } 181 | 182 | } catch (e) { 183 | log(e) 184 | } finally { 185 | resolve(); 186 | } 187 | }, timeout) 188 | }) 189 | } 190 | 191 | // ============================================变量检查============================================ \\ 192 | async function Envs() { 193 | if (hklbody) { 194 | if (hklbody.indexOf("@") != -1) { 195 | hklbody.split("@").forEach((item) => { 196 | hklbodyArr.push(item); 197 | }); 198 | } else if (hklbody.indexOf("\n") != -1) { 199 | hklbody.split("\n").forEach((item) => { 200 | hklbodyArr.push(item); 201 | }); 202 | } else { 203 | hklbodyArr.push(hklbody); 204 | } 205 | 206 | } else { 207 | log(`\n 【${$.name}】:未填写变量 hklbody`) 208 | return; 209 | } 210 | 211 | return true; 212 | } 213 | 214 | // ============================================发送消息============================================ \\ 215 | async function SendMsg(message) { 216 | if (!message) 217 | return; 218 | 219 | if (Notify > 0) { 220 | if ($.isNode()) { 221 | var notify = require('./sendNotify'); 222 | await notify.sendNotify($.name, message); 223 | } else { 224 | $.msg(message); 225 | } 226 | } else { 227 | log(message); 228 | } 229 | } 230 | 231 | /** 232 | * 随机数生成 233 | */ 234 | function randomString(e) { 235 | e = e || 32; 236 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 237 | a = t.length, 238 | n = ""; 239 | for (i = 0; i < e; i++) 240 | n += t.charAt(Math.floor(Math.random() * a)); 241 | return n 242 | } 243 | 244 | /** 245 | * 随机整数生成 246 | */ 247 | function randomInt(min, max) { 248 | return Math.round(Math.random() * (max - min) + min) 249 | } 250 | 251 | /** 252 | * 获取毫秒时间戳 253 | */ 254 | function timestampMs(){ 255 | return new Date().getTime(); 256 | } 257 | 258 | /** 259 | * 获取秒时间戳 260 | */ 261 | function timestampS(){ 262 | return Date.parse(new Date())/1000; 263 | } 264 | 265 | /** 266 | * 获取随机诗词 267 | */ 268 | function poem(timeout = 3 * 1000) { 269 | return new Promise((resolve) => { 270 | let url = { 271 | url: `https://v1.jinrishici.com/all.json` 272 | } 273 | $.get(url, async (err, resp, data) => { 274 | try { 275 | data = JSON.parse(data) 276 | log(`${data.content} \n————《${data.origin}》${data.author}`); 277 | } catch (e) { 278 | log(e, resp); 279 | } finally { 280 | resolve() 281 | } 282 | }, timeout) 283 | }) 284 | } 285 | 286 | /** 287 | * 修改配置文件 288 | */ 289 | function modify() { 290 | 291 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 292 | if(err){ 293 | return log('读取文件失败!'+err) 294 | } 295 | else { 296 | var result = dataStr.replace(/regular/g,string); 297 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 298 | if (err) {return log(err);} 299 | }); 300 | } 301 | }) 302 | } 303 | 304 | 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) } -------------------------------------------------------------------------------- /kjwj.js: -------------------------------------------------------------------------------- 1 | /** 2 | 作者:临渊 3 | 日期:6-15 4 | 网站:科技玩家 5 | 功能:签到、关注 6 | 变量:kjwj='账号&密码' 多个账号用换行分割 7 | 定时:一天一次 8 | cron:10 10 * * * 9 | 因为用Leaf大佬的会莫名其妙报错,所以就用Leaf大佬的源码改了一下,感谢Leaf大佬的源码(大佬的代码真优雅) 10 | 11 | 6-29 增加了关注,但可能会被风控取消 12 | */ 13 | 14 | const $ = new Env('科技玩家'); 15 | const notify = $.isNode() ? require('./sendNotify') : ''; 16 | const {log} = console; 17 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 18 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 19 | ////////////////////// 20 | let kjwj = process.env.kjwj; 21 | let kjwjArr = []; 22 | let data = ''; 23 | let msg = ''; 24 | let loginBack = 0; 25 | let token = ''; 26 | let name = ''; 27 | 28 | 29 | !(async () => { 30 | 31 | if (!(await Envs())) 32 | return; 33 | else { 34 | 35 | 36 | 37 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 38 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 39 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 40 | 41 | await poem(); 42 | 43 | log(`\n=================== 共找到 ${kjwjArr.length} 个账号 ===================`) 44 | 45 | if (debug) { 46 | log(`【debug】 这是你的全部账号数组:\n ${kjwjArr}`); 47 | } 48 | 49 | 50 | for (let index = 0; index < kjwjArr.length; index++) { 51 | 52 | 53 | let num = index + 1 54 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 55 | 56 | kjwj = kjwjArr[index].split('&'); 57 | 58 | if (debug) { 59 | log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 60 | } 61 | 62 | msg += `\n第${num}个账号运行结果:` 63 | 64 | log('【开始登录】'); 65 | await login(); 66 | await $.wait(2 * 1000); 67 | 68 | if (loginBack != 1){ 69 | 70 | log('【开始查询签到状态】'); 71 | await getSign(); 72 | await $.wait(2 * 1000); 73 | 74 | for (let i = 0; i < 5; i++) { 75 | log(`【开始第${i+1}次关注】`); 76 | await doFollow(); 77 | await $.wait(randomInt(15000,25000)); 78 | } 79 | } 80 | 81 | } 82 | await SendMsg(msg); 83 | } 84 | 85 | })() 86 | .catch((e) => log(e)) 87 | .finally(() => $.done()) 88 | 89 | /** 90 | * 登录 91 | */ 92 | function login(timeout = 3 * 1000) { 93 | return new Promise((resolve) => { 94 | let url = { 95 | url: `https://www.kejiwanjia.com/wp-json/jwt-auth/v1/token`, 96 | headers: { 97 | "Host": "www.kejiwanjia.com", 98 | "Connection": "keep-alive", 99 | "Accept": "application/json, text/plain, */*", 100 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36", 101 | "Content-Type": "application/x-www-form-urlencoded" 102 | }, 103 | body: `nickname=&username=${kjwj[0]}&password=${kjwj[1]}&code=&img_code=&invitation_code=&token=&smsToken=&luoToken=&confirmPassword=&loginType=`, 104 | } 105 | 106 | if (debug) { 107 | log(`\n【debug】=============== 这是 登录 请求 url ===============`); 108 | log(JSON.stringify(url)); 109 | } 110 | 111 | $.post(url, async (error, response, data) => { 112 | try { 113 | if (debug) { 114 | log(`\n\n【debug】===============这是 登录 返回data==============`); 115 | log(data) 116 | } 117 | 118 | let result = JSON.parse(data); 119 | if (result.code == 1) { 120 | 121 | loginBack = 1; 122 | log(`【登录失败】${result.message} `) 123 | msg += `\n【登陆失败】${result.message}` 124 | 125 | } else { 126 | 127 | log(`\n账号[${result.name}]登录成功,现有积分:${result.credit}`) 128 | token = result.token; 129 | name = result.name; 130 | 131 | } 132 | 133 | } catch (e) { 134 | log(e) 135 | } finally { 136 | resolve(); 137 | } 138 | }, timeout) 139 | }) 140 | } 141 | 142 | /** 143 | * 查询签到状态 144 | */ 145 | function getSign(timeout = 3 * 1000) { 146 | return new Promise((resolve) => { 147 | let url = { 148 | url: `https://www.kejiwanjia.com/wp-json/b2/v1/getUserMission`, 149 | headers: { 150 | "Host": "www.kejiwanjia.com", 151 | "Connection": "keep-alive", 152 | "Accept": "application/json, text/plain, */*", 153 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36", 154 | "Content-Type": "application/x-www-form-urlencoded", 155 | "Authorization": `Bearer ${token}`, 156 | "Cookie": `b2_token=${token};` 157 | }, 158 | body: 'count=5&paged=1', 159 | } 160 | 161 | if (debug) { 162 | log(`\n【debug】=============== 这是 查询签到状态 请求 url ===============`); 163 | log(JSON.stringify(url)); 164 | } 165 | 166 | $.post(url, async (error, response, data) => { 167 | try { 168 | if (debug) { 169 | log(`\n\n【debug】===============这是 查询签到状态 返回data==============`); 170 | log(data) 171 | } 172 | 173 | let result = JSON.parse(data); 174 | if (result.code == 1) { 175 | 176 | log(`查询签到状态失败`) 177 | 178 | } else { 179 | 180 | if(result.mission.credit == 0) { 181 | await $.wait(1000); 182 | await signin(); 183 | } else { 184 | log(`账号[${name}]今天已签到,获得了${result.mission.credit}积分`) 185 | msg += `账号[${name}]今天已签到,获得了${result.mission.credit}积分` 186 | } 187 | 188 | } 189 | 190 | } catch (e) { 191 | log(e) 192 | } finally { 193 | resolve(); 194 | } 195 | }, timeout) 196 | }) 197 | } 198 | 199 | /** 200 | * 签到 201 | */ 202 | function signin(timeout = 3 * 1000) { 203 | return new Promise((resolve) => { 204 | let url = { 205 | url: `https://www.kejiwanjia.com/wp-json/b2/v1/userMission`, 206 | headers: { 207 | "Host": "www.kejiwanjia.com", 208 | "Connection": "keep-alive", 209 | "Accept": "application/json, text/plain, */*", 210 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36", 211 | "Content-Type": "application/x-www-form-urlencoded", 212 | "Authorization": `Bearer ${token}`, 213 | "Cookie": `b2_token=${token};` 214 | }, 215 | body: ``, 216 | } 217 | 218 | if (debug) { 219 | log(`\n【debug】=============== 这是 签到 请求 url ===============`); 220 | log(JSON.stringify(url)); 221 | } 222 | 223 | $.post(url, async (error, response, data) => { 224 | try { 225 | if (debug) { 226 | log(`\n\n【debug】===============这是 签到 返回data==============`); 227 | log(data) 228 | } 229 | 230 | let result = JSON.parse(data); 231 | if (result.code == 1) { 232 | 233 | log(`账号[${name}]签到失败:${result}`) 234 | msg += `账号[${name}]签到失败:${result}` 235 | 236 | } else { 237 | 238 | if(result.credit) { 239 | log(`账号[${name}]签到成功,获得${result.credit}积分,现有积分:${result.mission.my_credit}`) 240 | msg += `\n账号[${name}]签到成功,获得${result.credit}积分,现有积分:${result.mission.my_credit}` 241 | } 242 | 243 | } 244 | 245 | } catch (e) { 246 | log(e) 247 | } finally { 248 | resolve(); 249 | } 250 | }, timeout) 251 | }) 252 | } 253 | 254 | /** 255 | * 关注 256 | */ 257 | function doFollow(timeout = 3 * 1000) { 258 | return new Promise((resolve) => { 259 | let user_id = randomInt(0,1000) 260 | let url = { 261 | url: `https://www.kejiwanjia.com/wp-json/b2/v1/AuthorFollow`, 262 | headers: { 263 | "Host": "www.kejiwanjia.com", 264 | "Connection": "keep-alive", 265 | "Accept": "application/json, text/plain, */*", 266 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36", 267 | "Content-Type": "application/x-www-form-urlencoded", 268 | "Authorization": `Bearer ${token}`, 269 | "Cookie": `b2_token=${token};` 270 | }, 271 | body: `user_id=${user_id}`, 272 | } 273 | 274 | if (debug) { 275 | log(`\n【debug】=============== 这是 关注 请求 url ===============`); 276 | log(JSON.stringify(url)); 277 | } 278 | 279 | $.post(url, async (error, response, data) => { 280 | try { 281 | if (debug) { 282 | log(`\n\n【debug】===============这是 关注 返回data==============`); 283 | log(data) 284 | } 285 | 286 | if (data == "true") { 287 | 288 | log(`账号[${name}]关注id[${user_id}]用户成功`) 289 | msg += `\n账号[${name}]关注id[${user_id}]用户成功` 290 | 291 | } else { 292 | 293 | log(`账号[${name}]关注id[${user_id}]用户失败`) 294 | msg += `\n账号[${name}]关注id[${user_id}]用户失败` 295 | 296 | } 297 | 298 | } catch (e) { 299 | log(e) 300 | } finally { 301 | resolve(); 302 | } 303 | }, timeout) 304 | }) 305 | } 306 | // ============================================变量检查============================================ \\ 307 | async function Envs() { 308 | if (kjwj) { 309 | if (kjwj.indexOf("\n") != -1) { 310 | kjwj.split("\n").forEach((item) => { 311 | kjwjArr.push(item); 312 | }); 313 | } else { 314 | kjwjArr.push(kjwj); 315 | } 316 | } else { 317 | log(`\n 【${$.name}】:未填写变量 kjwj`) 318 | return; 319 | } 320 | 321 | return true; 322 | } 323 | 324 | // ============================================发送消息============================================ \\ 325 | async function SendMsg(message) { 326 | if (!message) 327 | return; 328 | 329 | if (Notify > 0) { 330 | if ($.isNode()) { 331 | var notify = require('./sendNotify'); 332 | await notify.sendNotify($.name, message); 333 | } else { 334 | $.msg(message); 335 | } 336 | } else { 337 | log(message); 338 | } 339 | } 340 | 341 | /** 342 | * 随机数生成 343 | */ 344 | function randomString(e) { 345 | e = e || 32; 346 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 347 | a = t.length, 348 | n = ""; 349 | for (i = 0; i < e; i++) 350 | n += t.charAt(Math.floor(Math.random() * a)); 351 | return n 352 | } 353 | 354 | /** 355 | * 随机整数生成 356 | */ 357 | function randomInt(min, max) { 358 | return Math.round(Math.random() * (max - min) + min) 359 | } 360 | 361 | /** 362 | * 获取毫秒时间戳 363 | */ 364 | function timestampMs(){ 365 | return new Date().getTime(); 366 | } 367 | 368 | /** 369 | * 获取秒时间戳 370 | */ 371 | function timestampS(){ 372 | return Date.parse(new Date())/1000; 373 | } 374 | 375 | /** 376 | * 获取随机诗词 377 | */ 378 | function poem(timeout = 3 * 1000) { 379 | return new Promise((resolve) => { 380 | let url = { 381 | url: `https://v1.jinrishici.com/all.json` 382 | } 383 | $.get(url, async (err, resp, data) => { 384 | try { 385 | data = JSON.parse(data) 386 | log(`${data.content} \n————《${data.origin}》${data.author}`); 387 | } catch (e) { 388 | log(e, resp); 389 | } finally { 390 | resolve() 391 | } 392 | }, timeout) 393 | }) 394 | } 395 | 396 | /** 397 | * 修改配置文件 398 | */ 399 | function modify() { 400 | 401 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 402 | if(err){ 403 | return log('读取文件失败!'+err) 404 | } 405 | else { 406 | var result = dataStr.replace(/regular/g,string); 407 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 408 | if (err) {return log(err);} 409 | }); 410 | } 411 | }) 412 | } 413 | 414 | 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) } 415 | -------------------------------------------------------------------------------- /lxly.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ 临渊 3 | * 日期: 5-26 4 | * 软件: 联想乐云 5 | * 功能: 签到领取云盘容量 6 | * 抓取 7 | * pim.lenovo.com 域名下的任意Authorization 或者 x-lenovows-authorization 8 | * 变量格式:export lxlyapp='Authorization@xxx ' 多个账号用@分割 9 | */ 10 | 11 | const $ = new Env('联想乐云'); 12 | const notify = $.isNode() ? require('./sendNotify') : ''; 13 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 14 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 15 | ////////////////////// 16 | let lxlyapp = process.env.lxlyapp; 17 | let lxlyappArr = []; 18 | let data = ''; 19 | let msg = ''; 20 | 21 | 22 | !(async () => { 23 | 24 | if (!(await Envs())) 25 | return; 26 | else { 27 | 28 | 29 | 30 | console.log(`\n\n========================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 31 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 32 | 8 * 60 * 60 * 1000).toLocaleString()} \n=========================================\n`); 33 | 34 | 35 | console.log(`\n=================== 共找到 ${lxlyappArr.length} 个账号 ===================`) 36 | 37 | if (debug) { 38 | console.log(`【debug】 这是你的全部账号数组:\n ${lxlyappArr}`); 39 | } 40 | 41 | 42 | for (let index = 0; index < lxlyappArr.length; index++) { 43 | 44 | 45 | let num = index + 1 46 | console.log(`\n========= 开始【第 ${num} 个账号】=========\n`) 47 | 48 | lxlyapp = lxlyappArr[index]; 49 | 50 | if (debug) { 51 | console.log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 52 | } 53 | 54 | msg += `\n第${num}个账号运行结果:` 55 | console.log('开始签到'); 56 | await signin(); 57 | await $.wait(2 * 1000); 58 | } 59 | await SendMsg(msg); 60 | } 61 | 62 | })() 63 | .catch((e) => console.logErr(e)) 64 | .finally(() => $.done()) 65 | 66 | 67 | 68 | 69 | 70 | 71 | /** 72 | * 签到 73 | */ 74 | function signin(timeout = 3 * 1000) { 75 | return new Promise((resolve) => { 76 | let url = { 77 | url: `https://pim.lenovo.com/lesynch5/userspaceapi/v4/addspace?type=1&imei=${randomString(16)}&cvern=6.8.0.99&cverc=99060801&cpkg=com.lenovo.leos.cloud.sync&chid=PimWebPortal&version=v4`, 78 | headers: { 79 | "Host": "pim.lenovo.com", 80 | "user-agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36 com.lenovo.leos.cloud.sync/6.8.0.99", 81 | "x-lenovows-authorization":`${lxlyapp}`, 82 | "content-type": "application/json;charset=UTF-8" 83 | }, 84 | //body: '', 85 | } 86 | 87 | if (debug) { 88 | console.log(`\n【debug】=============== 这是 签到 请求 url ===============`); 89 | console.log(JSON.stringify(url)); 90 | } 91 | 92 | $.get(url, async (error, response, data) => { 93 | try { 94 | if (debug) { 95 | console.log(`\n\n【debug】===============这是 签到 返回data==============`); 96 | console.log(data) 97 | } 98 | 99 | let result = JSON.parse(data); 100 | if (result.result == 0 && result.spaceadd != 0) { 101 | 102 | console.log(`签到成功,获得:${result.spaceadd}MB`) 103 | msg += `\n签到成功,获得:${result.spaceadd}MB` 104 | 105 | } else if (result.result == 0 && result.spaceadd == 0) { 106 | 107 | console.log(`\n签到失败,可能是签到过,上次签到获得:${result.lastspaceadd}MB`) 108 | msg += `\n签到失败,可能是签到过,上次签到获得:${result.lastspaceadd}MB` 109 | 110 | } else { 111 | 112 | console.log(`\n签到失败 ,原因是:${result.error}!`) 113 | msg += `\n签到失败 ,原因是:${result.error}!` 114 | } 115 | } catch (e) { 116 | console.log(e) 117 | } finally { 118 | resolve(); 119 | } 120 | }, timeout) 121 | }) 122 | } 123 | 124 | // ============================================变量检查============================================ \\ 125 | async function Envs() { 126 | if (lxlyapp) { 127 | if (lxlyapp.indexOf("@") != -1) { 128 | lxlyapp.split("@").forEach((item) => { 129 | lxlyappArr.push(item); 130 | }); 131 | } else { 132 | lxlyappArr.push(lxlyapp); 133 | } 134 | } else { 135 | console.log(`\n 【${$.name}】:未填写变量 lxlyapp`) 136 | return; 137 | } 138 | 139 | return true; 140 | } 141 | 142 | // ============================================发送消息============================================ \\ 143 | async function SendMsg(message) { 144 | if (!message) 145 | return; 146 | 147 | if (Notify > 0) { 148 | if ($.isNode()) { 149 | var notify = require('./sendNotify'); 150 | await notify.sendNotify($.name, message); 151 | } else { 152 | $.msg(message); 153 | } 154 | } else { 155 | console.log(message); 156 | } 157 | } 158 | 159 | /** 160 | * 随机数生成 161 | */ 162 | function randomString(e) { 163 | e = e || 32; 164 | var t = "1234567890", 165 | a = t.length, 166 | n = ""; 167 | for (i = 0; i < e; i++) 168 | n += t.charAt(Math.floor(Math.random() * a)); 169 | return n 170 | } 171 | 172 | /** 173 | * 随机整数生成 174 | */ 175 | function randomInt(min, max) { 176 | return Math.round(Math.random() * (max - min) + min) 177 | } 178 | 179 | 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) } -------------------------------------------------------------------------------- /wyx.js: -------------------------------------------------------------------------------- 1 | /** 2 | 作者:临渊 3 | 日期:7-7 4 | 微信公众号:联通沃邮箱 (福利中心 -> 签到得好礼) (第一个登录任务做不了,需要真的登录好像) 5 | 抓包:开着抓包软件进活动,抓 club.soyu.cn 这个域名下链接请求体的 Cookie 里面的 SESSION (不知道CK有效期多长) 6 | 示例:SESSION=xx-xx-xx-xx-xx 7 | 变量格式:export wyxCk='SESSION=xx-xx-xx-xx-xx' 多账户 换行 或者 @ 分割 8 | Cron:15 9 * * * 9 | 10 | [task_local] 11 | #联通沃邮箱 12 | 15 9 * * * https://raw.githubusercontent.com/LinYuanovo/scripts/main/wyx.js, tag=联通沃邮箱, enabled=false 13 | [rewrite_local] 14 | https://club.soyu.cn/clubwebservice/growth/get-person-centre url script-request-headers https://raw.githubusercontent.com/LinYuanovo/scripts/main/wyx.js 15 | [MITM] 16 | hostname = club.soyu.cn 17 | */ 18 | 19 | const $ = new Env('沃邮箱'); 20 | const notify = $.isNode() ? require('./sendNotify') : ''; 21 | const {log} = console; 22 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 23 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 24 | ////////////////////// 25 | let scriptVersion = "1.0.0"; 26 | let scriptVersionLatest = ''; 27 | let wyxCk = ($.isNode() ? process.env.wyxCk : $.getdata("wyxCk")) || ""; 28 | let wyxCkArr = []; 29 | let data = ''; 30 | let msg = ''; 31 | let resourceTypeArr = []; 32 | let taskListBack = 0; 33 | 34 | 35 | !(async () => { 36 | if (typeof $request !== "undefined") { 37 | await GetRewrite(); 38 | } else { 39 | if (!(await Envs())) 40 | return; 41 | else { 42 | 43 | log(`\n\n============================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 44 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 45 | 8 * 60 * 60 * 1000).toLocaleString()} \n=============================================\n`); 46 | 47 | await poem(); 48 | await getVersion(); 49 | log(`\n============ 当前版本:${scriptVersion},最新版本:${scriptVersionLatest} ============`) 50 | log(`\n=================== 共找到 ${wyxCkArr.length} 个账号 ===================`) 51 | 52 | if (debug) { 53 | log(`【debug】 这是你的全部账号数组:\n ${wyxCkArr}`); 54 | } 55 | 56 | 57 | for (let index = 0; index < wyxCkArr.length; index++) { 58 | 59 | 60 | let num = index + 1 61 | log(`\n========= 开始【第 ${num} 个账号】=========\n`) 62 | 63 | wyxCk = wyxCkArr[index]; 64 | 65 | if (debug) { 66 | log(`\n 【debug】 这是你第 ${num} 账号信息:\n ${data}\n`); 67 | } 68 | 69 | msg += `\n\n第${num}个账号运行结果:` 70 | 71 | log('【开始获取任务列表】'); 72 | taskListBack = 0;//置零,避免影响下个号 73 | await getTaskList(); 74 | await $.wait(randomInt(3000,6000)); 75 | 76 | if (taskListBack) { 77 | log('【开始签到】'); 78 | await doSignin(); 79 | await $.wait(randomInt(3000,6000)); 80 | 81 | log('【开始做任务】'); 82 | for (let i in resourceTypeArr) { 83 | await doTask(i); 84 | await $.wait(randomInt(3000,6000)); 85 | } 86 | 87 | log('【开始查询积分余额】'); 88 | await getInfo(); 89 | await $.wait(randomInt(3000,6000)); 90 | } 91 | 92 | } 93 | await SendMsg(msg); 94 | } 95 | 96 | } 97 | 98 | })() 99 | .catch((e) => log(e)) 100 | .finally(() => $.done()) 101 | 102 | /** 103 | * 获取任务列表 104 | */ 105 | function getTaskList() { 106 | return new Promise((resolve) => { 107 | let url = { 108 | url: `https://club.soyu.cn/clubwebservice/growth/queryIntegralTask?channelId=wo-wx`, 109 | headers: {"Host":"club.soyu.cn","Connection":"keep-alive","Accept":"application/json, text/javascript, */*; q=0.01","User-Agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3247 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/toolsmp WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64","X-Requested-With":"XMLHttpRequest","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://club.soyu.cn/clubwebservice/club-user/user-info/mine-task?currentPage=signScope&channelId=wo-wx&mobile=tdC17TJ8eqD%2Ftqc9mCGv%2BQ%3D%3D&userName=&openId=7VPTOxKdXOrwC33Mus17G9na0NUvfr26t%2FSAS4twX%2B4%3D","Accept-Encoding":"gzip, deflate","Accept-Language":"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7","Cookie":`${wyxCk}; Hm_lvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()-20}; Hm_lpvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()}`}, 110 | } 111 | 112 | if (debug) { 113 | log(`\n【debug】=============== 这是 获取任务列表 请求 url ===============`); 114 | log(JSON.stringify(url)); 115 | } 116 | 117 | $.get(url, async (error, response, data) => { 118 | try { 119 | if (debug) { 120 | log(`\n\n【debug】===============这是 获取任务列表 返回data==============`); 121 | log(data) 122 | } 123 | 124 | let result = JSON.parse(data); 125 | if (result.status == "SUCCESS") { 126 | log(`[获取任务列表]${result.status}`) 127 | taskListBack = 1; 128 | for (let i in result.data) { 129 | let resourceFlag = result.data[i].resourceFlag; 130 | resourceTypeArr[i] = resourceFlag; 131 | } 132 | } 133 | } catch (e) { 134 | log(e) 135 | log(data) 136 | } finally { 137 | resolve(); 138 | } 139 | }) 140 | }) 141 | } 142 | 143 | /** 144 | * 做任务 145 | */ 146 | function doTask(num) { 147 | return new Promise((resolve) => { 148 | let url = { 149 | url: `https://club.soyu.cn/clubwebservice/growth/saveTask?resourceType=${resourceTypeArr[num]}`, 150 | headers: {"Host":"club.soyu.cn","Connection":"keep-alive","Accept":"application/json, text/javascript, */*; q=0.01","User-Agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3247 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/toolsmp WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64","X-Requested-With":"XMLHttpRequest","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://club.soyu.cn/clubwebservice/club-user/user-info/mine-task?currentPage=signScope&channelId=wo-wx&mobile=tdC17TJ8eqD%2Ftqc9mCGv%2BQ%3D%3D&userName=&openId=7VPTOxKdXOrwC33Mus17G9na0NUvfr26t%2FSAS4twX%2B4%3D","Accept-Encoding":"gzip, deflate","Accept-Language":"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7","Cookie":`${wyxCk}; Hm_lvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()-20}; Hm_lpvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()}`}, 151 | } 152 | 153 | if (debug) { 154 | log(`\n【debug】=============== 这是 做任务 请求 url ===============`); 155 | log(JSON.stringify(url)); 156 | } 157 | 158 | $.get(url, async (error, response, data) => { 159 | try { 160 | if (debug) { 161 | log(`\n\n【debug】===============这是 做任务 返回data==============`); 162 | log(data) 163 | } 164 | 165 | let result = JSON.parse(data); 166 | log(`[第${++num}个任务]${result.description}`) 167 | msg += `\n[第${num}个任务]${result.description}` 168 | } catch (e) { 169 | log(e) 170 | log(data) 171 | } finally { 172 | resolve(); 173 | } 174 | }) 175 | }) 176 | } 177 | 178 | /** 179 | * 签到 180 | */ 181 | function doSignin() { 182 | return new Promise((resolve) => { 183 | let url = { 184 | url: `https://club.soyu.cn/clubwebservice/club-user/user-sign/create?channelId=wo-wx`, 185 | headers: {"Host":"club.soyu.cn","Connection":"keep-alive","Accept":"application/json, text/javascript, */*; q=0.01","User-Agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3247 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/toolsmp WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64","X-Requested-With":"XMLHttpRequest","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://club.soyu.cn/clubwebservice/club-user/user-info/mine-task?currentPage=signScope&channelId=wo-wx&mobile=tdC17TJ8eqD%2Ftqc9mCGv%2BQ%3D%3D&userName=&openId=7VPTOxKdXOrwC33Mus17G9na0NUvfr26t%2FSAS4twX%2B4%3D","Accept-Encoding":"gzip, deflate","Accept-Language":"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7","Cookie":`${wyxCk}; Hm_lvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()-20}; Hm_lpvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()}`}, 186 | } 187 | 188 | if (debug) { 189 | log(`\n【debug】=============== 这是 签到 请求 url ===============`); 190 | log(JSON.stringify(url)); 191 | } 192 | 193 | $.get(url, async (error, response, data) => { 194 | try { 195 | if (debug) { 196 | log(`\n\n【debug】===============这是 签到 返回data==============`); 197 | log(data) 198 | } 199 | 200 | let result = JSON.parse(data); 201 | log(`[签到]${result.description}`) 202 | msg += `\n[签到]${result.description}` 203 | } catch (e) { 204 | log(e) 205 | log(data) 206 | } finally { 207 | resolve(); 208 | } 209 | }) 210 | }) 211 | } 212 | 213 | /** 214 | * 查询积分余额 215 | */ 216 | function getInfo() { 217 | return new Promise((resolve) => { 218 | let url = { 219 | url: `https://club.soyu.cn/clubwebservice/growth/get-person-centre?time=${timestampMs()}`, 220 | headers: {"Host":"club.soyu.cn","Connection":"keep-alive","Accept":"application/json, text/javascript, */*; q=0.01","User-Agent":"Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3247 MMWEBSDK/20220204 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.20.2080(0x28001435) Process/toolsmp WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64","X-Requested-With":"XMLHttpRequest","Sec-Fetch-Site":"same-origin","Sec-Fetch-Mode":"cors","Sec-Fetch-Dest":"empty","Referer":"https://club.soyu.cn/clubwebservice/club-user/user-info/mine-task?currentPage=signScope&channelId=wo-wx&mobile=tdC17TJ8eqD%2Ftqc9mCGv%2BQ%3D%3D&userName=&openId=7VPTOxKdXOrwC33Mus17G9na0NUvfr26t%2FSAS4twX%2B4%3D","Accept-Encoding":"gzip, deflate","Accept-Language":"zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7","Cookie":`${wyxCk}; Hm_lvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()-20}; Hm_lpvt_ae8c182e471b2da55e7452b2ed27f15e=${timestampS()}`}, 221 | } 222 | 223 | if (debug) { 224 | log(`\n【debug】=============== 这是 查询积分余额 请求 url ===============`); 225 | log(JSON.stringify(url)); 226 | } 227 | 228 | $.get(url, async (error, response, data) => { 229 | try { 230 | if (debug) { 231 | log(`\n\n【debug】===============这是 查询积分余额 返回data==============`); 232 | log(data) 233 | } 234 | 235 | let result = JSON.parse(data); 236 | if (result.status == 200) { 237 | log(`账号[${result.data.memberUser.phoneNum}]积分余额为:${result.data.score}`) 238 | msg += `\n账号[${result.data.memberUser.phoneNum}]积分余额为:${result.data.score}` 239 | } 240 | } catch (e) { 241 | log(e) 242 | log(data) 243 | } finally { 244 | resolve(); 245 | } 246 | }) 247 | }) 248 | } 249 | 250 | // ============================================重写============================================ \\ 251 | async function GetRewrite() { 252 | if ($request.url.indexOf("growth/get-person-centre") > -1) { 253 | const ck = $request.headers.Cookie; 254 | ck = ck.match(/SESSION=[\w-]+/) 255 | if (wyxCk) { 256 | if (wyxCk.indexOf(ck) == -1) { 257 | wyxCk = wyxCk + "@" + ck; 258 | $.setdata(wyxCk, "wyxCk"); 259 | let List = wyxCk.split("@"); 260 | $.msg(`【${$.name}】` + ` 获取第${List.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 261 | } 262 | } else { 263 | $.setdata(ck, "wyxCk"); 264 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 265 | } 266 | } 267 | } 268 | // ============================================变量检查============================================ \\ 269 | async function Envs() { 270 | if (wyxCk) { 271 | if (wyxCk.indexOf("@") != -1) { 272 | wyxCk.split("@").forEach((item) => { 273 | wyxCkArr.push(item); 274 | }); 275 | } else if (wyxCk.indexOf("\n") != -1) { 276 | wyxCk.split("\n").forEach((item) => { 277 | wyxCkArr.push(item); 278 | }); 279 | } else { 280 | wyxCkArr.push(wyxCk); 281 | } 282 | } else { 283 | log(`\n 【${$.name}】:未填写变量 wyxCk`) 284 | return; 285 | } 286 | 287 | return true; 288 | } 289 | 290 | // ============================================发送消息============================================ \\ 291 | async function SendMsg(message) { 292 | if (!message) 293 | return; 294 | 295 | if (Notify > 0) { 296 | if ($.isNode()) { 297 | var notify = require('./sendNotify'); 298 | await notify.sendNotify($.name, message); 299 | } else { 300 | $.msg(message); 301 | } 302 | } else { 303 | log(message); 304 | } 305 | } 306 | 307 | /** 308 | * 随机数生成 309 | */ 310 | function randomString(e) { 311 | e = e || 32; 312 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 313 | a = t.length, 314 | n = ""; 315 | for (i = 0; i < e; i++) 316 | n += t.charAt(Math.floor(Math.random() * a)); 317 | return n 318 | } 319 | 320 | /** 321 | * 随机整数生成 322 | */ 323 | function randomInt(min, max) { 324 | return Math.round(Math.random() * (max - min) + min) 325 | } 326 | 327 | /** 328 | * 获取毫秒时间戳 329 | */ 330 | function timestampMs(){ 331 | return new Date().getTime(); 332 | } 333 | 334 | /** 335 | * 获取秒时间戳 336 | */ 337 | function timestampS(){ 338 | return Date.parse(new Date())/1000; 339 | } 340 | 341 | /** 342 | * 获取随机诗词 343 | */ 344 | function poem(timeout = 3 * 1000) { 345 | return new Promise((resolve) => { 346 | let url = { 347 | url: `https://v1.jinrishici.com/all.json` 348 | } 349 | $.get(url, async (err, resp, data) => { 350 | try { 351 | data = JSON.parse(data) 352 | log(`${data.content} \n————《${data.origin}》${data.author}`); 353 | } catch (e) { 354 | log(e, resp); 355 | } finally { 356 | resolve() 357 | } 358 | }, timeout) 359 | }) 360 | } 361 | 362 | /** 363 | * 修改配置文件 364 | */ 365 | function modify() { 366 | 367 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 368 | if(err){ 369 | return log('读取文件失败!'+err) 370 | } 371 | else { 372 | var result = dataStr.replace(/regular/g,string); 373 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 374 | if (err) {return log(err);} 375 | }); 376 | } 377 | }) 378 | } 379 | 380 | /** 381 | * 获取远程版本 382 | */ 383 | function getVersion(timeout = 3 * 1000) { 384 | return new Promise((resolve) => { 385 | let url = { 386 | url: `https://raw.gh.fakev.cn/LinYuanovo/scripts/main/wyx.js`, 387 | } 388 | $.get(url, async (err, resp, data) => { 389 | try { 390 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 391 | } catch (e) { 392 | $.logErr(e, resp); 393 | } finally { 394 | resolve() 395 | } 396 | }, timeout) 397 | }) 398 | } 399 | 400 | 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) } -------------------------------------------------------------------------------- /xmbs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ 临渊 3 | * 功能:小米运动刷步数 4 | * 日期:6-6 5 | * 变量格式:export xmbs='小米运动&密码&步数@xxx ' 多个账号用@分割 6 | * 定时一天一次 7 | * 更新成换行登录 8 | */ 9 | 10 | const $ = new Env('小米步数'); 11 | const notify = $.isNode() ? require('./sendNotify') : ''; 12 | const Notify = 1; //0为关闭通知,1为打开通知,默认为1 13 | const debug = 0; //0为关闭调试,1为打开调试,默认为0 14 | ////////////////////// 15 | let xmbs = ($.isNode() ? process.env.xmbs : $.getdata("xmbs")) || ""; 16 | let xmbsArr = []; 17 | let data = ''; 18 | let msg = ''; 19 | let back = 0; 20 | 21 | 22 | !(async () => { 23 | 24 | if (!(await Envs())) 25 | return; 26 | else { 27 | 28 | 29 | 30 | console.log(`\n\n========================================= \n脚本执行 - 北京时间(UTC+8):${new Date( 31 | new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 32 | 8 * 60 * 60 * 1000).toLocaleString()} \n=========================================\n`); 33 | 34 | 35 | console.log(`\n=================== 共找到 ${xmbsArr.length} 个账号 ===================`) 36 | 37 | if (debug) { 38 | console.log(`【debug】 这是你的全部账号数组:\n ${xmbsArr}`); 39 | } 40 | 41 | 42 | for (let index = 0; index < xmbsArr.length; index++) { 43 | 44 | 45 | let num = index + 1 46 | console.log(`\n========= 开始【第 ${num} 个账号】=========\n`) 47 | 48 | bs = xmbsArr[index].split('&'); 49 | bs[2] =+ bs[2]; 50 | bs[2] += randomInt(0,1000); 51 | 52 | if (debug) { 53 | console.log(`\n 【debug】 这是你第 ${num} 个账号信息:\n ${bs}\n`); 54 | } 55 | 56 | if (bs[2] > 80000){ 57 | console.log("请输入小于8w的步数,否则会封号") 58 | msg += `请输入小于8w的步数,否则会封号` 59 | break; 60 | } 61 | 62 | msg += `\n第${num}个账号运行结果:` 63 | 64 | console.log('开始刷步'); 65 | await addStep1(); 66 | await $.wait(2 * 1000); 67 | 68 | } 69 | await SendMsg(msg); 70 | } 71 | 72 | })() 73 | .catch((e) => console.logErr(e)) 74 | .finally(() => $.done()) 75 | 76 | /** 77 | * 步数接口1 78 | */ 79 | function addStep1(timeout = 3 * 1000) { 80 | return new Promise((resolve) => { 81 | let url = { 82 | url: `https://apis.jxcxin.cn/api/mi?user=${bs[0]}&password=${bs[1]}&step=${bs[2]}&ver=cxydzsv3`, 83 | headers: { 84 | "Host": "apis.jxcxin.cn", 85 | "accept": "application/json, text/javascript, */*; q=0.01", 86 | "user-agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002;) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.101 Mobile Safari/537.36", 87 | "origin": "http://apk.52dun.cn", 88 | "referer": "http://apk.52dun.cn/", 89 | "accept-encoding": "gzip, deflate", 90 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7" 91 | }, 92 | } 93 | 94 | if (debug) { 95 | console.log(`\n【debug】=============== 这是 步数接口1 请求 url ===============`); 96 | console.log(JSON.stringify(url)); 97 | } 98 | 99 | $.get(url, async (error, response, data) => { 100 | try { 101 | if (debug) { 102 | console.log(`\n\n【debug】===============这是 步数接口1 返回data==============`); 103 | console.log(data) 104 | } 105 | 106 | let result = JSON.parse(data); 107 | if (result.code == 200) { 108 | 109 | console.log(`刷步成功,本次刷了${bs[2]}步`) 110 | msg += `\n刷步成功,本次刷了${bs[2]}步` 111 | 112 | } else { 113 | 114 | console.log(`\n刷步失败`) 115 | back = 1; 116 | 117 | } 118 | 119 | } catch (e) { 120 | console.log(e) 121 | } finally { 122 | resolve(); 123 | } 124 | }, timeout) 125 | }) 126 | } 127 | 128 | /** 129 | * 步数接口2 130 | */ 131 | function addStep2(timeout = 3 * 1000) { 132 | return new Promise((resolve) => { 133 | let url = { 134 | url: `https://yd.sdbgi.com/step.php?phone=${bs[0]}&password=${bs[1]}&steps=${bs[2]}`, 135 | headers: { 136 | "Host": "yd.sdbgi.com", 137 | "Connection": "keep-alive", 138 | "User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Build/QKQ1.190828.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/86.0.4240.99 XWEB/3225 MMWEBSDK/20211001 Mobile Safari/537.36 MMWEBID/6242 MicroMessenger/8.0.16.2040(0x28001037) Process/appbrand0 WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android", 139 | "content-type": "application/json", 140 | "Accept-Encoding": "gzip,compress,br,deflate", 141 | "Referer": "https://servicewechat.com/wxbf7d07eb77d51b09/44/page-frame.html" 142 | }, 143 | } 144 | 145 | if (debug) { 146 | console.log(`\n【debug】=============== 这是 步数接口2 请求 url ===============`); 147 | console.log(JSON.stringify(url)); 148 | } 149 | 150 | $.get(url, async (error, response, data) => { 151 | try { 152 | if (debug) { 153 | console.log(`\n\n【debug】===============这是 步数接口2 返回data==============`); 154 | console.log(data) 155 | } 156 | 157 | let result = JSON.parse(data); 158 | if (result.code == 200) { 159 | 160 | console.log(`刷步成功,本次刷了${bs[2]}步`) 161 | msg += `\n刷步成功,本次刷了${bs[2]}步` 162 | 163 | } else { 164 | 165 | console.log(`\n刷步失败`) 166 | back = 1; 167 | 168 | } 169 | 170 | } catch (e) { 171 | console.log(e) 172 | } finally { 173 | resolve(); 174 | } 175 | }, timeout) 176 | }) 177 | } 178 | 179 | // ============================================变量检查============================================ \\ 180 | async function Envs() { 181 | if (xmbs) { 182 | if (xmbs.indexOf("\n") != -1) { 183 | xmbs.split("\n").forEach((item) => { 184 | xmbsArr.push(item); 185 | }); 186 | } else { 187 | xmbsArr.push(xmbs); 188 | } 189 | } else { 190 | console.log(`\n 【${$.name}】:未填写变量 xmbs`) 191 | return; 192 | } 193 | 194 | return true; 195 | } 196 | 197 | // ============================================发送消息============================================ \\ 198 | async function SendMsg(message) { 199 | if (!message) 200 | return; 201 | 202 | if (Notify > 0) { 203 | if ($.isNode()) { 204 | var notify = require('./sendNotify'); 205 | await notify.sendNotify($.name, message); 206 | } else { 207 | $.msg(message); 208 | } 209 | } else { 210 | console.log(message); 211 | } 212 | } 213 | 214 | /** 215 | * 随机数生成 216 | */ 217 | function randomString(e) { 218 | e = e || 32; 219 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 220 | a = t.length, 221 | n = ""; 222 | for (i = 0; i < e; i++) 223 | n += t.charAt(Math.floor(Math.random() * a)); 224 | return n 225 | } 226 | 227 | /** 228 | * 随机整数生成 229 | */ 230 | function randomInt(min, max) { 231 | return Math.round(Math.random() * (max - min) + min) 232 | } 233 | 234 | /** 235 | * 获取毫秒时间戳 236 | */ 237 | function timestampMs(){ 238 | return new Date().getTime(); 239 | } 240 | 241 | /** 242 | * 获取秒时间戳 243 | */ 244 | function timestampS(){ 245 | return Date.parse(new Date())/1000; 246 | } 247 | 248 | 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) } 249 | --------------------------------------------------------------------------------