├── sendNotify.py ├── env.js ├── lekebo_gqcqwx.js ├── lekebo_tpyqc.js ├── lekebo_bsly.js ├── lekebo_gjjjhyjlb.js ├── lekebo_hqcsh.js ├── lekebo_rdxk.js └── lekebo_gmjk.js /sendNotify.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # _*_ coding:utf-8 _*_ 3 | 4 | import sys 5 | import os, re 6 | cur_path = os.path.abspath(os.path.dirname(__file__)) 7 | root_path = os.path.split(cur_path)[0] 8 | sys.path.append(root_path) 9 | import requests 10 | import json 11 | import time 12 | import hmac 13 | import hashlib 14 | import base64 15 | import urllib.parse 16 | from requests.adapters import HTTPAdapter 17 | from urllib3.util import Retry 18 | 19 | # 通知服务 20 | BARK = '' # bark服务,自行搜索; secrets可填; 21 | SCKEY = '' # Server酱的SCKEY; secrets可填 22 | TG_BOT_TOKEN = '' # tg机器人的TG_BOT_TOKEN; secrets可填1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ 23 | TG_USER_ID = '' # tg机器人的TG_USER_ID; secrets可填 1434078534 24 | TG_API_HOST='' # tg 代理api 25 | TG_PROXY_IP = '' # tg机器人的TG_PROXY_IP; secrets可填 26 | TG_PROXY_PORT = '' # tg机器人的TG_PROXY_PORT; secrets可填 27 | DD_BOT_ACCESS_TOKEN = '' # 钉钉机器人的DD_BOT_ACCESS_TOKEN; secrets可填 28 | DD_BOT_SECRET = '' # 钉钉机器人的DD_BOT_SECRET; secrets可填 29 | QQ_SKEY = '' # qq机器人的QQ_SKEY; secrets可填 30 | QQ_MODE = '' # qq机器人的QQ_MODE; secrets可填 31 | QYWX_AM = '' # 企业微信 32 | PUSH_PLUS_TOKEN = '' # 微信推送Plus+ 33 | 34 | notify_mode = [] 35 | 36 | message_info = '''''' 37 | 38 | # GitHub action运行需要填写对应的secrets 39 | if "BARK" in os.environ and os.environ["BARK"]: 40 | BARK = os.environ["BARK"] 41 | if "SCKEY" in os.environ and os.environ["SCKEY"]: 42 | SCKEY = os.environ["SCKEY"] 43 | if "TG_BOT_TOKEN" in os.environ and os.environ["TG_BOT_TOKEN"] and "TG_USER_ID" in os.environ and os.environ["TG_USER_ID"]: 44 | TG_BOT_TOKEN = os.environ["TG_BOT_TOKEN"] 45 | TG_USER_ID = os.environ["TG_USER_ID"] 46 | if "TG_API_HOST" in os.environ and os.environ["TG_API_HOST"]: 47 | TG_API_HOST = os.environ["TG_API_HOST"] 48 | if "DD_BOT_ACCESS_TOKEN" in os.environ and os.environ["DD_BOT_ACCESS_TOKEN"] and "DD_BOT_SECRET" in os.environ and os.environ["DD_BOT_SECRET"]: 49 | DD_BOT_ACCESS_TOKEN = os.environ["DD_BOT_ACCESS_TOKEN"] 50 | DD_BOT_SECRET = os.environ["DD_BOT_SECRET"] 51 | if "QQ_SKEY" in os.environ and os.environ["QQ_SKEY"] and "QQ_MODE" in os.environ and os.environ["QQ_MODE"]: 52 | QQ_SKEY = os.environ["QQ_SKEY"] 53 | QQ_MODE = os.environ["QQ_MODE"] 54 | # 获取pushplus+ PUSH_PLUS_TOKEN 55 | if "PUSH_PLUS_TOKEN" in os.environ: 56 | if len(os.environ["PUSH_PLUS_TOKEN"]) > 1: 57 | PUSH_PLUS_TOKEN = os.environ["PUSH_PLUS_TOKEN"] 58 | # print("已获取并使用Env环境 PUSH_PLUS_TOKEN") 59 | # 获取企业微信应用推送 QYWX_AM 60 | if "QYWX_AM" in os.environ: 61 | if len(os.environ["QYWX_AM"]) > 1: 62 | QYWX_AM = os.environ["QYWX_AM"] 63 | # print("已获取并使用Env环境 QYWX_AM") 64 | 65 | if BARK: 66 | notify_mode.append('bark') 67 | # print("BARK 推送打开") 68 | if SCKEY: 69 | notify_mode.append('sc_key') 70 | # print("Server酱 推送打开") 71 | if TG_BOT_TOKEN and TG_USER_ID: 72 | notify_mode.append('telegram_bot') 73 | # print("Telegram 推送打开") 74 | if DD_BOT_ACCESS_TOKEN and DD_BOT_SECRET: 75 | notify_mode.append('dingding_bot') 76 | # print("钉钉机器人 推送打开") 77 | if QQ_SKEY and QQ_MODE: 78 | notify_mode.append('coolpush_bot') 79 | # print("QQ机器人 推送打开") 80 | 81 | if PUSH_PLUS_TOKEN: 82 | notify_mode.append('pushplus_bot') 83 | # print("微信推送Plus机器人 推送打开") 84 | if QYWX_AM: 85 | notify_mode.append('wecom_app') 86 | # print("企业微信机器人 推送打开") 87 | 88 | 89 | def message(str_msg): 90 | global message_info 91 | print(str_msg) 92 | message_info = "{}\n{}".format(message_info, str_msg) 93 | sys.stdout.flush() 94 | 95 | def bark(title, content): 96 | print("\n") 97 | if not BARK: 98 | print("bark服务的bark_token未设置!!\n取消推送") 99 | return 100 | print("bark服务启动") 101 | try: 102 | response = requests.get( 103 | f"""https://api.day.app/{BARK}/{title}/{urllib.parse.quote_plus(content)}""").json() 104 | if response['code'] == 200: 105 | print('推送成功!') 106 | else: 107 | print('推送失败!') 108 | except: 109 | print('推送失败!') 110 | 111 | def serverJ(title, content): 112 | print("\n") 113 | if not SCKEY: 114 | print("server酱服务的SCKEY未设置!!\n取消推送") 115 | return 116 | print("serverJ服务启动") 117 | data = { 118 | "text": title, 119 | "desp": content.replace("\n", "\n\n") 120 | } 121 | response = requests.post(f"https://sc.ftqq.com/{SCKEY}.send", data=data).json() 122 | if response['errno'] == 0: 123 | print('推送成功!') 124 | else: 125 | print('推送失败!') 126 | 127 | # tg通知 128 | def telegram_bot(title, content): 129 | try: 130 | print("\n") 131 | bot_token = TG_BOT_TOKEN 132 | user_id = TG_USER_ID 133 | if not bot_token or not user_id: 134 | print("tg服务的bot_token或者user_id未设置!!\n取消推送") 135 | return 136 | print("tg服务启动") 137 | if TG_API_HOST: 138 | if 'http' in TG_API_HOST: 139 | url = f"{TG_API_HOST}/bot{TG_BOT_TOKEN}/sendMessage" 140 | else: 141 | url = f"https://{TG_API_HOST}/bot{TG_BOT_TOKEN}/sendMessage" 142 | else: 143 | url = f"https://api.telegram.org/bot{TG_BOT_TOKEN}/sendMessage" 144 | 145 | headers = {'Content-Type': 'application/x-www-form-urlencoded'} 146 | payload = {'chat_id': str(TG_USER_ID), 'text': f'{title}\n\n{content}', 'disable_web_page_preview': 'true'} 147 | proxies = None 148 | if TG_PROXY_IP and TG_PROXY_PORT: 149 | proxyStr = "http://{}:{}".format(TG_PROXY_IP, TG_PROXY_PORT) 150 | proxies = {"http": proxyStr, "https": proxyStr} 151 | try: 152 | response = requests.post(url=url, headers=headers, params=payload, proxies=proxies).json() 153 | except: 154 | print('推送失败!') 155 | if response['ok']: 156 | print('推送成功!') 157 | else: 158 | print('推送失败!') 159 | except Exception as e: 160 | print(e) 161 | 162 | def dingding_bot(title, content): 163 | timestamp = str(round(time.time() * 1000)) # 时间戳 164 | secret_enc = DD_BOT_SECRET.encode('utf-8') 165 | string_to_sign = '{}\n{}'.format(timestamp, DD_BOT_SECRET) 166 | string_to_sign_enc = string_to_sign.encode('utf-8') 167 | hmac_code = hmac.new(secret_enc, string_to_sign_enc, digestmod=hashlib.sha256).digest() 168 | sign = urllib.parse.quote_plus(base64.b64encode(hmac_code)) # 签名 169 | print('开始使用 钉钉机器人 推送消息...', end='') 170 | url = f'https://oapi.dingtalk.com/robot/send?access_token={DD_BOT_ACCESS_TOKEN}×tamp={timestamp}&sign={sign}' 171 | headers = {'Content-Type': 'application/json;charset=utf-8'} 172 | data = { 173 | 'msgtype': 'text', 174 | 'text': {'content': f'{title}\n\n{content}'} 175 | } 176 | response = requests.post(url=url, data=json.dumps(data), headers=headers, timeout=15).json() 177 | if not response['errcode']: 178 | print('推送成功!') 179 | else: 180 | print('推送失败!') 181 | 182 | def coolpush_bot(title, content): 183 | print("\n") 184 | if not QQ_SKEY or not QQ_MODE: 185 | print("qq服务的QQ_SKEY或者QQ_MODE未设置!!\n取消推送") 186 | return 187 | print("qq服务启动") 188 | url=f"https://qmsg.zendee.cn/{QQ_MODE}/{QQ_SKEY}" 189 | payload = {'msg': f"{title}\n\n{content}".encode('utf-8')} 190 | response = requests.post(url=url, params=payload).json() 191 | if response['code'] == 0: 192 | print('推送成功!') 193 | else: 194 | print('推送失败!') 195 | # push推送 196 | def pushplus_bot(title, content): 197 | try: 198 | print("\n") 199 | if not PUSH_PLUS_TOKEN: 200 | print("PUSHPLUS服务的token未设置!!\n取消推送") 201 | return 202 | print("PUSHPLUS服务启动") 203 | url = 'http://www.pushplus.plus/send' 204 | data = { 205 | "token": PUSH_PLUS_TOKEN, 206 | "title": title, 207 | "content": content 208 | } 209 | body = json.dumps(data).encode(encoding='utf-8') 210 | headers = {'Content-Type': 'application/json'} 211 | response = requests.post(url=url, data=body, headers=headers).json() 212 | if response['code'] == 200: 213 | print('推送成功!') 214 | else: 215 | print('推送失败!') 216 | except Exception as e: 217 | print(e) 218 | # 企业微信 APP 推送 219 | def wecom_app(title, content): 220 | try: 221 | if not QYWX_AM: 222 | print("QYWX_AM 并未设置!!\n取消推送") 223 | return 224 | QYWX_AM_AY = re.split(',', QYWX_AM) 225 | if 4 < len(QYWX_AM_AY) > 5: 226 | print("QYWX_AM 设置错误!!\n取消推送") 227 | return 228 | corpid = QYWX_AM_AY[0] 229 | corpsecret = QYWX_AM_AY[1] 230 | touser = QYWX_AM_AY[2] 231 | agentid = QYWX_AM_AY[3] 232 | try: 233 | media_id = QYWX_AM_AY[4] 234 | except: 235 | media_id = '' 236 | wx = WeCom(corpid, corpsecret, agentid) 237 | # 如果没有配置 media_id 默认就以 text 方式发送 238 | if not media_id: 239 | message = title + '\n\n' + content 240 | response = wx.send_text(message, touser) 241 | else: 242 | response = wx.send_mpnews(title, content, media_id, touser) 243 | if response == 'ok': 244 | print('推送成功!') 245 | else: 246 | print('推送失败!错误信息如下:\n', response) 247 | except Exception as e: 248 | print(e) 249 | 250 | class WeCom: 251 | def __init__(self, corpid, corpsecret, agentid): 252 | self.CORPID = corpid 253 | self.CORPSECRET = corpsecret 254 | self.AGENTID = agentid 255 | 256 | def get_access_token(self): 257 | url = 'https://qyapi.weixin.qq.com/cgi-bin/gettoken' 258 | values = {'corpid': self.CORPID, 259 | 'corpsecret': self.CORPSECRET, 260 | } 261 | req = requests.post(url, params=values) 262 | data = json.loads(req.text) 263 | return data["access_token"] 264 | 265 | def send_text(self, message, touser="@all"): 266 | send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token() 267 | send_values = { 268 | "touser": touser, 269 | "msgtype": "text", 270 | "agentid": self.AGENTID, 271 | "text": { 272 | "content": message 273 | }, 274 | "safe": "0" 275 | } 276 | send_msges = (bytes(json.dumps(send_values), 'utf-8')) 277 | respone = requests.post(send_url, send_msges) 278 | respone = respone.json() 279 | return respone["errmsg"] 280 | 281 | def send_mpnews(self, title, message, media_id, touser="@all"): 282 | send_url = 'https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=' + self.get_access_token() 283 | send_values = { 284 | "touser": touser, 285 | "msgtype": "mpnews", 286 | "agentid": self.AGENTID, 287 | "mpnews": { 288 | "articles": [ 289 | { 290 | "title": title, 291 | "thumb_media_id": media_id, 292 | "author": "Author", 293 | "content_source_url": "", 294 | "content": message.replace('\n', '
'), 295 | "digest": message 296 | } 297 | ] 298 | } 299 | } 300 | send_msges = (bytes(json.dumps(send_values), 'utf-8')) 301 | respone = requests.post(send_url, send_msges) 302 | respone = respone.json() 303 | return respone["errmsg"] 304 | 305 | def send(title, content): 306 | """ 307 | 使用 bark, telegram bot, dingding bot, serverJ 发送手机推送 308 | :param title: 309 | :param content: 310 | :return: 311 | """ 312 | content += '\n\n开源免费By: https://github.com/curtinlv/JD-Script' 313 | for i in notify_mode: 314 | if i == 'bark': 315 | if BARK: 316 | bark(title=title, content=content) 317 | else: 318 | print('未启用 bark') 319 | continue 320 | if i == 'sc_key': 321 | if SCKEY: 322 | serverJ(title=title, content=content) 323 | else: 324 | print('未启用 Server酱') 325 | continue 326 | elif i == 'dingding_bot': 327 | if DD_BOT_ACCESS_TOKEN and DD_BOT_SECRET: 328 | dingding_bot(title=title, content=content) 329 | else: 330 | print('未启用 钉钉机器人') 331 | continue 332 | elif i == 'telegram_bot': 333 | if TG_BOT_TOKEN and TG_USER_ID: 334 | telegram_bot(title=title, content=content) 335 | else: 336 | print('未启用 telegram机器人') 337 | continue 338 | elif i == 'coolpush_bot': 339 | if QQ_SKEY and QQ_MODE: 340 | coolpush_bot(title=title, content=content) 341 | else: 342 | print('未启用 QQ机器人') 343 | continue 344 | elif i == 'pushplus_bot': 345 | if PUSH_PLUS_TOKEN: 346 | pushplus_bot(title=title, content=content) 347 | else: 348 | print('未启用 PUSHPLUS机器人') 349 | continue 350 | elif i == 'wecom_app': 351 | if QYWX_AM: 352 | wecom_app(title=title, content=content) 353 | else: 354 | print('未启用企业微信应用消息推送') 355 | continue 356 | else: 357 | print('此类推送方式不存在') 358 | 359 | 360 | def main(): 361 | send('title', 'content') 362 | 363 | 364 | if __name__ == '__main__': 365 | main() 366 | -------------------------------------------------------------------------------- /env.js: -------------------------------------------------------------------------------- 1 | function Env(t, e) { 2 | "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); 3 | 4 | class s { 5 | constructor(t) { 6 | this.env = t 7 | } 8 | send(t, e = "GET") { 9 | t = "string" == typeof t ? { 10 | url: t 11 | } : 12 | t; 13 | let s = this.get; 14 | return "POST" === e && (s = this.post), 15 | new Promise((e, i) => { 16 | s.call(this, t, (t, s) => { 17 | t ? i(t) : e(s) 18 | }) 19 | }) 20 | } 21 | get(t) { 22 | return this.send.call(this.env, t) 23 | } 24 | post(t) { 25 | return this.send.call(this.env, t, "POST") 26 | } 27 | } 28 | 29 | return new class { 30 | constructor(t, e) { 31 | this.name = t, 32 | this.http = new s(this), 33 | this.data = null, 34 | this.dataFile = "box.dat", 35 | this.logs = [], 36 | this.isMute = !1, 37 | this.isNeedRewrite = !1, 38 | this.logSeparator = "\n", 39 | this.startTime = (new Date).getTime(), 40 | Object.assign(this, e), 41 | this.log("", `🔔${this.name}, 开始!`) 42 | } 43 | isNode() { 44 | return "undefined" != typeof module && !!module.exports 45 | } 46 | isQuanX() { 47 | return "undefined" != typeof $task 48 | } 49 | isSurge() { 50 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon 51 | } 52 | isLoon() { 53 | return "undefined" != typeof $loon 54 | } 55 | toObj(t, e = null) { 56 | try { 57 | return JSON.parse(t) 58 | } 59 | catch { 60 | return e 61 | } 62 | } 63 | toStr(t, e = null) { 64 | try { 65 | return JSON.stringify(t) 66 | } 67 | catch { 68 | return e 69 | } 70 | } 71 | getjson(t, e) { 72 | let s = e; 73 | const i = this.getdata(t); 74 | if (i) { 75 | try { 76 | s = JSON.parse(this.getdata(t)) 77 | } 78 | catch {} 79 | } 80 | return s 81 | } 82 | setjson(t, e) { 83 | try { 84 | return this.setdata(JSON.stringify(t), e) 85 | } 86 | catch { 87 | return !1 88 | } 89 | } 90 | getScript(t) { 91 | return new Promise(e => { 92 | this.get({ 93 | url: t 94 | }, (t, s, i) => e(i)) 95 | }) 96 | } 97 | runScript(t, e) { 98 | return new Promise(s => { 99 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 100 | i = i ? i.replace(/\n/g, "").trim() : i; 101 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 102 | r = r ? 1 * r : 20, 103 | r = e && e.timeout ? e.timeout : r; 104 | const [o, h] = i.split("@"), 105 | n = { 106 | url: `http://${h}/v1/scripting/evaluate`, 107 | body: { 108 | script_text: t, 109 | mock_type: "cron", 110 | timeout: r 111 | }, 112 | headers: { 113 | "X-Key": o, 114 | Accept: "*/*" 115 | } 116 | }; 117 | this.post(n, (t, e, i) => s(i)) 118 | }).catch(t => this.logErr(t)) 119 | } 120 | loaddata() { 121 | if (!this.isNode()) {return {};} { 122 | this.fs = this.fs ? this.fs : require("fs"), 123 | this.path = this.path ? this.path : require("path"); 124 | const t = this.path.resolve(this.dataFile), 125 | e = this.path.resolve(process.cwd(), this.dataFile), 126 | s = this.fs.existsSync(t), 127 | i = !s && this.fs.existsSync(e); 128 | if (!s && !i) {return {};} { 129 | const i = s ? t : e; 130 | try { 131 | return JSON.parse(this.fs.readFileSync(i)) 132 | } 133 | catch (t) { 134 | return {} 135 | } 136 | } 137 | } 138 | } 139 | writedata() { 140 | if (this.isNode()) { 141 | this.fs = this.fs ? this.fs : require("fs"), 142 | this.path = this.path ? this.path : require("path"); 143 | const t = this.path.resolve(this.dataFile), 144 | e = this.path.resolve(process.cwd(), this.dataFile), 145 | s = this.fs.existsSync(t), 146 | i = !s && this.fs.existsSync(e), 147 | r = JSON.stringify(this.data); 148 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) 149 | } 150 | } 151 | lodash_get(t, e, s) { 152 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 153 | let r = t; 154 | for (const t of i) { 155 | if (r = Object(r)[t], void 0 === r) {return s;} 156 | } 157 | return r 158 | } 159 | lodash_set(t, e, s) { 160 | 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) 161 | } 162 | getdata(t) { 163 | let e = this.getval(t); 164 | if (/^@/.test(t)) { 165 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), 166 | r = s ? this.getval(s) : ""; 167 | if (r) { 168 | try { 169 | const t = JSON.parse(r); 170 | e = t ? this.lodash_get(t, i, "") : e 171 | } 172 | catch (t) { 173 | e = "" 174 | } 175 | } 176 | } 177 | return e 178 | } 179 | setdata(t, e) { 180 | let s = !1; 181 | if (/^@/.test(e)) { 182 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), 183 | o = this.getval(i), 184 | h = i ? "null" === o ? null : o || "{}" : "{}"; 185 | try { 186 | const e = JSON.parse(h); 187 | this.lodash_set(e, r, t), 188 | s = this.setval(JSON.stringify(e), i) 189 | } 190 | catch (e) { 191 | const o = {}; 192 | this.lodash_set(o, r, t), 193 | s = this.setval(JSON.stringify(o), i) 194 | } 195 | } 196 | else {s = this.setval(t, e);} 197 | return s 198 | } 199 | getval(t) { 200 | 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 201 | } 202 | setval(t, e) { 203 | 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 204 | } 205 | initGotEnv(t) { 206 | this.got = this.got ? this.got : require("got"), 207 | this.cktough = this.cktough ? this.cktough : require("tough-cookie"), 208 | this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, 209 | t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) 210 | } 211 | get(t, e = (() => {})) { 212 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), 213 | this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 214 | "X-Surge-Skip-Scripting": !1 215 | })), $httpClient.get(t, (t, s, i) => { 216 | !t && s && (s.body = i, s.statusCode = s.status), 217 | e(t, s, i) 218 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 219 | hints: !1 220 | })), $task.fetch(t).then(t => { 221 | const { 222 | statusCode: s, 223 | statusCode: i, 224 | headers: r, 225 | body: o 226 | } = t; 227 | e(null, { 228 | status: s, 229 | statusCode: i, 230 | headers: r, 231 | body: o 232 | }, o) 233 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 234 | try { 235 | if (t.headers["set-cookie"]) { 236 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 237 | s && this.ckjar.setCookieSync(s, null), 238 | e.cookieJar = this.ckjar 239 | } 240 | } 241 | catch (t) { 242 | this.logErr(t) 243 | } 244 | }).then(t => { 245 | const { 246 | statusCode: s, 247 | statusCode: i, 248 | headers: r, 249 | body: o 250 | } = t; 251 | e(null, { 252 | status: s, 253 | statusCode: i, 254 | headers: r, 255 | body: o 256 | }, o) 257 | }, t => { 258 | const { 259 | message: s, 260 | response: i 261 | } = t; 262 | e(s, i, i && i.body) 263 | })) 264 | } 265 | post(t, e = (() => {})) { 266 | 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()) { 267 | this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 268 | "X-Surge-Skip-Scripting": !1 269 | })), $httpClient.post(t, (t, s, i) => { 270 | !t && s && (s.body = i, s.statusCode = s.status), 271 | e(t, s, i) 272 | }); 273 | } 274 | else if (this.isQuanX()) { 275 | t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 276 | hints: !1 277 | })), $task.fetch(t).then(t => { 278 | const { 279 | statusCode: s, 280 | statusCode: i, 281 | headers: r, 282 | body: o 283 | } = t; 284 | e(null, { 285 | status: s, 286 | statusCode: i, 287 | headers: r, 288 | body: o 289 | }, o) 290 | }, t => e(t)); 291 | } 292 | else if (this.isNode()) { 293 | this.initGotEnv(t); 294 | const { 295 | url: s, 296 | ...i 297 | } = t; 298 | this.got.post(s, i).then(t => { 299 | const { 300 | statusCode: s, 301 | statusCode: i, 302 | headers: r, 303 | body: o 304 | } = t; 305 | e(null, { 306 | status: s, 307 | statusCode: i, 308 | headers: r, 309 | body: o 310 | }, o) 311 | }, t => { 312 | const { 313 | message: s, 314 | response: i 315 | } = t; 316 | e(s, i, i && i.body) 317 | }) 318 | } 319 | } 320 | time(t, e = null) { 321 | const s = e ? new Date(e) : new Date; 322 | const i = { 323 | "M+": s.getMonth() + 1, 324 | "d+": s.getDate(), 325 | "H+": s.getHours(), 326 | "m+": s.getMinutes(), 327 | "s+": s.getSeconds(), 328 | "q+": Math.floor((s.getMonth() + 3) / 3), 329 | S: s.getMilliseconds() 330 | }; 331 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); 332 | for (const 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)));} 333 | return t 334 | } 335 | msg(e = t, s = "", i = "", r) { 336 | const o = t => { 337 | if (!t) {return t;} 338 | if ("string" == typeof t) { 339 | return this.isLoon() ? t : this.isQuanX() ? { 340 | "open-url": t 341 | } : 342 | this.isSurge() ? { 343 | url: t 344 | } : 345 | void 0; 346 | } 347 | if ("object" == typeof t) { 348 | if (this.isLoon()) { 349 | const e = t.openUrl || t.url || t["open-url"], 350 | s = t.mediaUrl || t["media-url"]; 351 | return { 352 | openUrl: e, 353 | mediaUrl: s 354 | } 355 | } 356 | if (this.isQuanX()) { 357 | const e = t["open-url"] || t.url || t.openUrl, 358 | s = t["media-url"] || t.mediaUrl; 359 | return { 360 | "open-url": e, 361 | "media-url": s 362 | } 363 | } 364 | if (this.isSurge()) { 365 | const e = t.url || t.openUrl || t["open-url"]; 366 | return { 367 | url: e 368 | } 369 | } 370 | } 371 | }; 372 | if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { 373 | const t = ["", "==============📣系统通知📣=============="]; 374 | t.push(e), 375 | s && t.push(s), 376 | i && t.push(i), 377 | console.log(t.join("\n")), 378 | this.logs = this.logs.concat(t) 379 | } 380 | } 381 | log(...t) { 382 | t.length > 0 && (this.logs = [...this.logs, ...t]), 383 | console.log(t.join(this.logSeparator)) 384 | } 385 | logErr(t) { 386 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 387 | s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) 388 | } 389 | wait(t) { 390 | return new Promise(e => setTimeout(e, t)) 391 | } 392 | done(t = {}) { 393 | const e = (new Date).getTime(), 394 | s = (e - this.startTime) / 1e3; 395 | this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), 396 | this.log(), 397 | (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) 398 | } 399 | }(t, e); 400 | } 401 | 402 | module.exports = Env; 403 | -------------------------------------------------------------------------------- /lekebo_gqcqwx.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * 项目类型:微信小程序 5 | * 项目名称:广汽传祺 6 | * 项目抓包:抓mall.gacmotor.com下的token填入变量 7 | * 项目变量:lekebo_gqcqwx_Cookie 8 | * 项目定时:每40分钟运行一次 9 | * cron: 0 0,7 * * * 10 | * github仓库:https://github.com/ 11 | * 12 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 13 | */ 14 | 15 | 16 | //===============脚本版本=================// 17 | let scriptVersion = "1.0.1"; 18 | let update_data = "完成签到"; 19 | //=======================================// 20 | const $ = new Env('广汽传祺'); 21 | const notify = $.isNode() ? require('./sendNotify') : ''; 22 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 23 | const {log} = console; 24 | let scriptVersionLatest = ""; 25 | let UserCookie = ($.isNode() ? process.env.lekebo_gqcqwx_Cookie : $.getdata('lekebo_gqcqwx_Cookie')) || ''; 26 | let UserCookieArr = []; 27 | let data = ''; 28 | let msg =``; 29 | let isSign = false; 30 | let host = 'mall.gacmotor.com'; 31 | let hostname = 'https://' + host; 32 | //=======================================// 33 | !(async () => { 34 | if (typeof $request !== "undefined") { 35 | await GetRewrite(); 36 | } else { 37 | if (!(await Envs())){ 38 | return; 39 | } else { 40 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 41 | await getVersion(); 42 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 43 | if (scriptVersionLatest != scriptVersion) { 44 | DoubleLog(`\n 当前版本:${scriptVersion}`) 45 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 46 | DoubleLog(`\n 更新信息:${update_data}`) 47 | } else { 48 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 49 | } 50 | for (let index = 0; index < UserCookieArr.length; index++) { 51 | let num = index + 1 52 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 53 | ck = UserCookieArr[index].split("&"); 54 | taskBeforeScore = 0; 55 | await start(); 56 | } 57 | await SendMsg(msg); 58 | } 59 | } 60 | 61 | })() 62 | .catch((e) => log(e)) 63 | .finally(() => $.done()) 64 | 65 | /** 66 | * 获取基础信息 67 | * @returns {Promise} 68 | */ 69 | async function start() { 70 | await getMemberInfo(1,2 * 1000); 71 | await $.wait(2000); 72 | await getMemberScore(2 * 1000); 73 | await $.wait(2000); 74 | await getMemberInfo(2,2 * 1000); 75 | await $.wait(2000); 76 | return true; 77 | } 78 | /** 79 | * 查询会员信息 80 | * @param timeout 81 | * @returns {Promise} 82 | */ 83 | function getMemberInfo(task,timeout = 2000) { 84 | return new Promise((resolve) => { 85 | let url = { 86 | url: `${hostname}/center-current-app/fronted/myHomePage/myInfo`, 87 | headers: { 88 | Host: host, 89 | 'Connection': 'keep-alive', 90 | 'Content-Type': 'application/json', 91 | 'version': '3.1.2', 92 | 'token': ck[0], 93 | 'User-Agent': getUA(), 94 | 'Referer': 'https://servicewechat.com/wx86a1eb5a53a6973b/244/page-frame.html', 95 | 'Content-Length': '2', 96 | }, 97 | body: `{}`, 98 | } 99 | $.post(url, async (error, response, data) => { 100 | try { 101 | let result = JSON.parse(data); 102 | if (result.code == 0000) { 103 | if (task == 1) { 104 | DoubleLog(`\n 用户信息: ✅ ,当前拥有 ${result.data.gDou} 积分`) 105 | } else if (task == 2) { 106 | DoubleLog(`\n 积分查询: ✅ ,任务后拥有 ${result.data.gDou} 积分`); 107 | } else { 108 | DoubleLog(`\n 查询失败: ❌ ,原因是:${data}`) 109 | } 110 | } else { 111 | DoubleLog(`\n 查询失败: ❌ ,原因是:${result.msg}`) 112 | } 113 | } catch (e) { 114 | DoubleLog(`\n 查询异常: ❌ ,${response}`) 115 | } finally { 116 | resolve(); 117 | } 118 | }, timeout) 119 | }) 120 | } 121 | /** 122 | * 登录签到 123 | * @param timeout 124 | * @returns {Promise} 125 | */ 126 | function getMemberScore(timeout = 2000) { 127 | return new Promise((resolve) => { 128 | let url = { 129 | url: `${hostname}/center-current-app/fronted/myHomePage/checkLoginSendGdou`, 130 | headers: { 131 | Host: host, 132 | 'Connection': 'keep-alive', 133 | 'Content-Type': 'application/json', 134 | 'version': '3.1.2', 135 | 'token': ck[0], 136 | 'User-Agent': getUA(), 137 | 'Referer': 'https://servicewechat.com/wx86a1eb5a53a6973b/244/page-frame.html', 138 | 'Content-Length': '2', 139 | }, 140 | body: `{}`, 141 | } 142 | $.post(url, async (error, response, data) => { 143 | try { 144 | let result = JSON.parse(data); 145 | if (result.code == 0000) { 146 | if (result.data.gdouNum == 0) { 147 | DoubleLog(`\n 登录签到: ✅ ,原因是:今天已经领取过奖励`) 148 | } else { 149 | DoubleLog(`\n 登录签到: ✅ ,获得 ${result.data.gdouNum} 积分`) 150 | } 151 | } else { 152 | DoubleLog(`\n 登录失败: ❌ ,原因是:${result.msg}`) 153 | } 154 | } catch (e) { 155 | DoubleLog(`\n 登录异常: ❌ ,${response}`) 156 | } finally { 157 | resolve(); 158 | } 159 | }, timeout) 160 | }) 161 | } 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | // ============================================重写============================================ \\ 189 | async function GetRewrite() { 190 | if ($request.url.indexOf("member/api/info/?userKeys=v1.0&pageName=member-info-index-search&formName=searchForm&kwwMember.memberId") > -1) { 191 | let ck = ''; 192 | let theRequest = new Object(); 193 | if ($request.url.indexOf("?") != -1) { 194 | let info = $request.url.split('?'); 195 | let strs = info[1].split("&"); 196 | for (var i = 0; i < strs.length; i++) { 197 | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 198 | } 199 | ck = theRequest.memberId; 200 | } 201 | if (kwwUid) { 202 | if (memberId.indexOf(ck) == -1) { 203 | memberId = memberId + "@" + ck; 204 | $.setdata(memberId, "kwwUid"); 205 | List = memberId.split("@"); 206 | $.msg(`【${$.name}】` + ` 获取第${memberId.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 207 | } 208 | } else { 209 | $.setdata(ck, "memberId"); 210 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 211 | } 212 | } 213 | } 214 | 215 | 216 | // ============================================变量检查============================================ \\ 217 | async function Envs() { 218 | if (UserCookie) { 219 | if (UserCookie.indexOf("@") != -1) { 220 | UserCookie.split("@").forEach((item) => { 221 | UserCookieArr.push(item); 222 | }); 223 | } else if (UserCookie.indexOf("\n") != -1) { 224 | UserCookie.split("\n").forEach((item) => { 225 | UserCookieArr.push(item); 226 | }); 227 | } else { 228 | UserCookieArr.push(UserCookie); 229 | } 230 | } else { 231 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_xfkd_Cookie`) 232 | return; 233 | } 234 | return true; 235 | } 236 | // ============================================发送消息============================================ \\ 237 | async function SendMsg(message) { 238 | if (!message) 239 | return; 240 | 241 | if (Notify > 0) { 242 | if ($.isNode()) { 243 | var notify = require('./sendNotify'); 244 | await notify.sendNotify($.name, message); 245 | } else { 246 | $.msg(message); 247 | } 248 | } else { 249 | log(message); 250 | } 251 | } 252 | /** 253 | * 添加消息 254 | * @param str 255 | * @param is_log 256 | */ 257 | function addNotifyStr(str, is_log = true) { 258 | if (is_log) { 259 | log(`${str}\n`) 260 | } 261 | msg += `${str}\n` 262 | } 263 | /** 264 | * 双平台log输出 265 | */ 266 | function DoubleLog(data) { 267 | if ($.isNode()) { 268 | if (data) { 269 | console.log(`${data}`); 270 | msg += `${data}`; 271 | } 272 | } else { 273 | console.log(`${data}`); 274 | msg += `${data}`; 275 | } 276 | } 277 | function randomNum(min, max) { 278 | if (arguments.length === 0) return Math.random() 279 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 280 | return Math.floor(Math.random() * (max - min + 1) + min); 281 | } 282 | function DealScriptStr(str) { 283 | str = str.replace(/\/\*.*?\*\//g, ' '); 284 | str = str.replace(/\b0(\d+)/g, '0o$1'); 285 | return str; 286 | } 287 | /** 288 | * 随机UA 289 | * @param inputString 290 | * @returns {*} 291 | */ 292 | function getUA() { 293 | $.UUID = randomString(40) 294 | const buildMap = { 295 | "167814": `10.1.4`, 296 | "167841": `10.1.6`, 297 | "167853": `10.2.0` 298 | } 299 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 300 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 301 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 302 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 303 | $.appVersion = buildMap[$.build] 304 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 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 modify() { 324 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 325 | if(err){ 326 | return log('读取文件失败!'+err) 327 | } 328 | else { 329 | var result = dataStr.replace(/regular/g,string); 330 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 331 | if (err) {return log(err);} 332 | }); 333 | } 334 | }) 335 | } 336 | 337 | /** 338 | * 获取远程版本 339 | */ 340 | function getVersion(timeout = 3 * 1000) { 341 | return new Promise((resolve) => { 342 | let url = { 343 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_gqcqwx.js`, 344 | } 345 | $.get(url, async (err, resp, data) => { 346 | try { 347 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 348 | update_data = data.match(/update_data = "(.*?)"/)[1] 349 | } catch (e) { 350 | $.logErr(e, resp); 351 | } finally { 352 | resolve() 353 | } 354 | }, timeout) 355 | }) 356 | } 357 | 358 | // md5 359 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 360 | // 完整 Env 361 | 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) } 362 | -------------------------------------------------------------------------------- /lekebo_tpyqc.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * 项目类型:APP 5 | * 项目名称:太平洋汽车 6 | * 项目抓包:手机号 & 密码 7 | * 项目变量:lekebo_tpyqc_Cookie 8 | * 项目定时:每天运行一次 9 | * cron: 10 8 * * * 10 | * github仓库:https://github.com/ 11 | * 12 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 13 | */ 14 | 15 | 16 | //===============脚本版本=================// 17 | let scriptVersion = "1.0.1"; 18 | let update_data = "完成签到,七天签到 3 元红包 , 14 天 2 元红包"; 19 | //=======================================// 20 | const $ = new Env('太平洋汽车'); 21 | const notify = $.isNode() ? require('./sendNotify') : ''; 22 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 23 | const {log} = console; 24 | let scriptVersionLatest = ""; 25 | let UserCookie = ($.isNode() ? process.env.lekebo_tpyqc_Cookie : $.getdata('lekebo_tpyqc_Cookie')) || ''; 26 | let UserCookieArr = []; 27 | let data = ''; 28 | let msg =``; 29 | let isSign = false; 30 | var timestamp = Math.round(new Date().getTime()).toString(); 31 | let host = 'mrobot.pcauto.com.cn'; 32 | let hostname = 'https://' + host; 33 | //=======================================// 34 | !(async () => { 35 | if (typeof $request !== "undefined") { 36 | await GetRewrite(); 37 | } else { 38 | if (!(await Envs())){ 39 | return; 40 | } else { 41 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 42 | await getVersion(); 43 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 44 | if (scriptVersionLatest != scriptVersion) { 45 | DoubleLog(`\n 当前版本:${scriptVersion}`) 46 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 47 | DoubleLog(`\n 更新信息:${update_data}`) 48 | } else { 49 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 50 | } 51 | for (let index = 0; index < UserCookieArr.length; index++) { 52 | let num = index + 1 53 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 54 | ck = UserCookieArr[index].split("&"); 55 | taskBeforeScore = 0; 56 | await start(); 57 | } 58 | await SendMsg(msg); 59 | } 60 | } 61 | 62 | })() 63 | .catch((e) => log(e)) 64 | .finally(() => $.done()) 65 | 66 | /** 67 | * 获取基础信息 68 | * @returns {Promise} 69 | */ 70 | async function start() { 71 | await login(2 * 1000); 72 | await $.wait(2000); 73 | await getMemberInfo(1,2 * 1000); 74 | await $.wait(2000); 75 | await signin(2 * 1000); 76 | await $.wait(2000); 77 | await getMemberInfo(2,2 * 1000); 78 | await $.wait(2000); 79 | return true; 80 | } 81 | /** 82 | * 查询会员信息 83 | * @param timeout 84 | * @returns {Promise} 85 | */ 86 | function login(timeout = 2000) { 87 | return new Promise((resolve) => { 88 | let url = { 89 | url: `${hostname}/auto_passport3_back_intf/passport3/rest/login_new.jsp`, 90 | headers: { 91 | Host: host, 92 | 'Content-Type': 'application/x-www-form-urlencoded', 93 | }, 94 | body: `password=${ck[1]}&username=${ck[0]}`, 95 | } 96 | $.post(url, async (error, response, data) => { 97 | try { 98 | let result = JSON.parse(data); 99 | if (result.status == 0) { 100 | ck = result.common_session_id; 101 | DoubleLog(`\n 账号登录: ✅ ,${result.message}`) 102 | } else { 103 | DoubleLog(`\n 账号登录: ❌ ,原因是:${result.msg}`) 104 | } 105 | } catch (e) { 106 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 107 | } finally { 108 | resolve(); 109 | } 110 | }, timeout) 111 | }) 112 | } 113 | /** 114 | * 查询会员信息 115 | * @param timeout 116 | * @returns {Promise} 117 | */ 118 | function getMemberInfo(task,timeout = 2000) { 119 | return new Promise((resolve) => { 120 | let url = { 121 | url: `${hostname}/xsp/s/auto/info/nocache/task/getLoginUserInfo.xsp`, 122 | headers: { 123 | 'Host': host, 124 | 'Cookie': `common_session_id=${ck}`, 125 | }, 126 | } 127 | $.post(url, async (error, response, data) => { 128 | try { 129 | let result = JSON.parse(data); 130 | if (task == 1) { 131 | DoubleLog(`\n 会员信息: ✅ ,会员:${result.userName},当前 ${result.goldCount} 积分`) 132 | } else if (task == 2) { 133 | DoubleLog(`\n 积分查询: ✅ ,签到后有积分 ${result.goldCount}`); 134 | } else { 135 | DoubleLog(`\n 积分查询: ❌ ,原因是:${data}`) 136 | } 137 | } catch (e) { 138 | DoubleLog(`查询会员信息异常:${data},原因:${e}`) 139 | } finally { 140 | resolve(); 141 | } 142 | }, timeout) 143 | }) 144 | } 145 | /** 146 | * 签到 147 | * @param timeout 148 | * @returns {Promise} 149 | */ 150 | function signin(timeout = 2000) { 151 | return new Promise((resolve) => { 152 | let url = { 153 | url: `https://app-server.pcauto.com.cn/api/info/sign/register`, 154 | headers: { 155 | 'Content-Type': 'text/plain', 156 | 'Cookie': `common_session_id=${ck}`, 157 | }, 158 | body: '{}', 159 | } 160 | $.post(url, async (error, response, data) => { 161 | try { 162 | let result = JSON.parse(data); 163 | if (result.code == 200) { 164 | DoubleLog(`\n 签到成功: ✅ ,签到${result.message}`) 165 | } else { 166 | DoubleLog(`\n 签到失败: ❌ ,原因是:${result.message}`) 167 | } 168 | } catch (e) { 169 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 170 | } finally { 171 | resolve(); 172 | } 173 | }, timeout) 174 | }) 175 | } 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | // ============================================重写============================================ \\ 201 | async function GetRewrite() { 202 | if ($request.url.indexOf("member/api/info/?userKeys=v1.0&pageName=member-info-index-search&formName=searchForm&kwwMember.memberId") > -1) { 203 | let ck = ''; 204 | let theRequest = new Object(); 205 | if ($request.url.indexOf("?") != -1) { 206 | let info = $request.url.split('?'); 207 | let strs = info[1].split("&"); 208 | for (var i = 0; i < strs.length; i++) { 209 | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 210 | } 211 | ck = theRequest.memberId; 212 | } 213 | if (kwwUid) { 214 | if (memberId.indexOf(ck) == -1) { 215 | memberId = memberId + "@" + ck; 216 | $.setdata(memberId, "kwwUid"); 217 | List = memberId.split("@"); 218 | $.msg(`【${$.name}】` + ` 获取第${memberId.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 219 | } 220 | } else { 221 | $.setdata(ck, "memberId"); 222 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 223 | } 224 | } 225 | } 226 | 227 | 228 | // ============================================变量检查============================================ \\ 229 | async function Envs() { 230 | if (UserCookie) { 231 | if (UserCookie.indexOf("@") != -1) { 232 | UserCookie.split("@").forEach((item) => { 233 | UserCookieArr.push(item); 234 | }); 235 | } else if (UserCookie.indexOf("\n") != -1) { 236 | UserCookie.split("\n").forEach((item) => { 237 | UserCookieArr.push(item); 238 | }); 239 | } else { 240 | UserCookieArr.push(UserCookie); 241 | } 242 | } else { 243 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_tpyqc_Cookie`) 244 | return; 245 | } 246 | return true; 247 | } 248 | // ============================================发送消息============================================ \\ 249 | async function SendMsg(message) { 250 | if (!message) 251 | return; 252 | 253 | if (Notify > 0) { 254 | if ($.isNode()) { 255 | var notify = require('./sendNotify'); 256 | await notify.sendNotify($.name, message); 257 | } else { 258 | $.msg(message); 259 | } 260 | } else { 261 | log(message); 262 | } 263 | } 264 | /** 265 | * 添加消息 266 | * @param str 267 | * @param is_log 268 | */ 269 | function addNotifyStr(str, is_log = true) { 270 | if (is_log) { 271 | log(`${str}\n`) 272 | } 273 | msg += `${str}\n` 274 | } 275 | /** 276 | * 双平台log输出 277 | */ 278 | function DoubleLog(data) { 279 | if ($.isNode()) { 280 | if (data) { 281 | console.log(`${data}`); 282 | msg += `${data}`; 283 | } 284 | } else { 285 | console.log(`${data}`); 286 | msg += `${data}`; 287 | } 288 | } 289 | function randomNum(min, max) { 290 | if (arguments.length === 0) return Math.random() 291 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 292 | return Math.floor(Math.random() * (max - min + 1) + min); 293 | } 294 | 295 | function DealScriptStr(str) { 296 | str = str.replace(/\/\*.*?\*\//g, ' '); 297 | str = str.replace(/\b0(\d+)/g, '0o$1'); 298 | return str; 299 | } 300 | /** 301 | * 随机UA 302 | * @param inputString 303 | * @returns {*} 304 | */ 305 | function getUA() { 306 | $.UUID = randomString(40) 307 | const buildMap = { 308 | "167814": `10.1.4`, 309 | "167841": `10.1.6`, 310 | "167853": `10.2.0` 311 | } 312 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 313 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 314 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 315 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 316 | $.appVersion = buildMap[$.build] 317 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 318 | } 319 | 320 | /** 321 | * 随机数生成 322 | */ 323 | function randomString(e) { 324 | e = e || 32; 325 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 326 | a = t.length, 327 | n = ""; 328 | for (i = 0; i < e; i++) 329 | n += t.charAt(Math.floor(Math.random() * a)); 330 | return n 331 | } 332 | 333 | /** 334 | * 修改配置文件 335 | */ 336 | function modify() { 337 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 338 | if(err){ 339 | return log('读取文件失败!'+err) 340 | } 341 | else { 342 | var result = dataStr.replace(/regular/g,string); 343 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 344 | if (err) {return log(err);} 345 | }); 346 | } 347 | }) 348 | } 349 | 350 | /** 351 | * 获取远程版本 352 | */ 353 | function getVersion(timeout = 3 * 1000) { 354 | return new Promise((resolve) => { 355 | let url = { 356 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_tpyqc.js`, 357 | } 358 | $.get(url, async (err, resp, data) => { 359 | try { 360 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 361 | update_data = data.match(/update_data = "(.*?)"/)[1] 362 | } catch (e) { 363 | $.logErr(e, resp); 364 | } finally { 365 | resolve() 366 | } 367 | }, timeout) 368 | }) 369 | } 370 | 371 | // md5 372 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 373 | // 完整 Env 374 | 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) } 375 | -------------------------------------------------------------------------------- /lekebo_bsly.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * 项目类型:微信小程序 4 | * 项目名称:百事乐元 5 | * 项目抓包:抓pepcoinnew.pepcoinbypepsico.com.cn下的token填入变量 6 | * 项目变量:lekebo_bsly_Cookie 7 | * 项目定时:每40分钟运行一次 8 | * cron: 18 7 * * * 9 | * github仓库:https://github.com/ 10 | * 11 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 12 | */ 13 | 14 | //===============脚本版本=================// 15 | let scriptVersion = "1.0.1"; 16 | let update_data = "完成签到,浏览视频,二手市场,校园头条任务"; 17 | //=======================================// 18 | const $ = new Env('百事乐元'); 19 | const notify = $.isNode() ? require('./sendNotify') : ''; 20 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 21 | let UserCookie = ($.isNode() ? process.env.lekebo_bsly_Cookie : $.getdata('lekebo_bsly_Cookie')) || ''; 22 | let UserCookieArr = []; 23 | const {log} = console; 24 | let data = ''; 25 | let msg =``; 26 | var timestamp = Math.round(new Date().getTime()).toString(); 27 | let host = 'pepcoinnew.pepcoinbypepsico.com.cn'; 28 | let hostname = 'https://' + host; 29 | //=======================================// 30 | !(async () => { 31 | if (typeof $request !== "undefined") { 32 | await GetRewrite(); 33 | } else { 34 | if (!(await Envs())){ 35 | return; 36 | } else { 37 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 38 | await getVersion(); 39 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 40 | if (scriptVersionLatest != scriptVersion) { 41 | DoubleLog(`\n 当前版本:${scriptVersion}`) 42 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 43 | DoubleLog(`\n 更新信息:${update_data}`) 44 | } else { 45 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 46 | } 47 | for (let index = 0; index < UserCookieArr.length; index++) { 48 | let num = index + 1 49 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 50 | ck = UserCookieArr[index].split("&"); 51 | taskBeforeScore = 0; 52 | await start(); 53 | } 54 | await SendMsg(msg); 55 | } 56 | } 57 | 58 | })() 59 | .catch((e) => log(e)) 60 | .finally(() => $.done()) 61 | 62 | /** 63 | * 获取基础信息 64 | * @returns {Promise} 65 | */ 66 | async function start() { 67 | await login(2 * 1000); 68 | await $.wait(2000); 69 | await getMemberInfo(1,2 * 1000); 70 | await $.wait(2000); 71 | await signIn(2 * 1000); 72 | await $.wait(2000); 73 | await getMemberInfo(2,2 * 1000); 74 | await $.wait(2000); 75 | return true; 76 | } 77 | /** 78 | * 登录 79 | * @param timeout 80 | * @returns {Promise} 81 | */ 82 | function login(timeout = 2000) { 83 | return new Promise((resolve) => { 84 | let url = { 85 | url: `${hostname}/api/wxapp/doLaunch`, 86 | headers: { 87 | Host: host, 88 | 'Connection': 'keep-alive', 89 | 'Content-Type': 'application/json', 90 | 'User-Agent': getUA(), 91 | 'Referer': 'https://servicewechat.com/wx1a72addb7ee74f67/102/page-frame.html', 92 | 'Accept-Encoding': 'gzip, deflate', 93 | 'Content-Length': '932', 94 | }, 95 | body: `{"token":"${ck[0]}","system":{"albumAuthorized":true,"benchmarkLevel":-1,"bluetoothEnabled":false,"brand":"microsoft","cameraAuthorized":true,"fontSizeSetting":15,"language":"zh_CN","locationAuthorized":true,"locationEnabled":true,"microphoneAuthorized":true,"model":"microsoft","notificationAuthorized":true,"notificationSoundEnabled":true,"pixelRatio":1.5,"platform":"windows","power":100,"safeArea":{"bottom":736,"height":736,"left":0,"right":414,"top":0,"width":414},"screenHeight":736,"screenWidth":414,"statusBarHeight":20,"system":"Windows 11 x64","theme":"light","version":"3.6.0","wifiEnabled":true,"windowHeight":736,"windowWidth":414,"SDKVersion":"2.21.3","enableDebug":false,"devicePixelRatio":1.5,"host":{"env":"WMPF"}},"network":"wifi","shareTicket":null,"options":{"path":"pages/main/home/index","query":{},"scene":70,"referrerInfo":{},"apiCategory":"default"}}`, 96 | } 97 | $.post(url, async (error, response, data) => { 98 | try { 99 | let result = JSON.parse(data); 100 | if (result.code == 0) { 101 | DoubleLog(`\n 登录成功: ✅ ,${result.message}`) 102 | } else { 103 | DoubleLog(`\n 登录失败: ❌ ,原因是:${result.message}`) 104 | } 105 | } catch (e) { 106 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 107 | } finally { 108 | resolve(); 109 | } 110 | }, timeout) 111 | }) 112 | } 113 | /** 114 | * 查询会员信息 115 | * @param timeout 116 | * @returns {Promise} 117 | */ 118 | function getMemberInfo(task,timeout = 2000) { 119 | return new Promise((resolve) => { 120 | let url = { 121 | url: `${hostname}/api/wxapp/doGetUserInfo`, 122 | headers: { 123 | Host: host, 124 | 'Connection': 'keep-alive', 125 | 'Content-Type': 'application/json', 126 | 'User-Agent': getUA(), 127 | 'Referer': 'https://servicewechat.com/wx1a72addb7ee74f67/102/page-frame.html', 128 | 'Accept-Encoding': 'gzip, deflate', 129 | 'Content-Length': '76', 130 | }, 131 | body: `{"token":"${ck[0]}"}`, 132 | } 133 | $.post(url, async (error, response, data) => { 134 | try { 135 | let result = JSON.parse(data); 136 | if (task == 1) { 137 | DoubleLog(`\n 会员信息: ✅ ,用户:${result.data.mobile} 当前 ${result.data.coin} 积分`) 138 | } else if (task == 2) { 139 | DoubleLog(`\n 积分查询: ✅ ,签到后有积分 ${result.data.coin}`); 140 | } else { 141 | DoubleLog(`\n 会员信息: ❌ ,原因是:${result.message}`) 142 | } 143 | } catch (e) { 144 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 145 | } finally { 146 | resolve(); 147 | } 148 | }, timeout) 149 | }) 150 | } 151 | /** 152 | * 签到 153 | * @param timeout 154 | * @returns {Promise} 155 | */ 156 | function signIn(timeout = 2000) { 157 | return new Promise((resolve) => { 158 | let url = { 159 | url: `${hostname}/api/wxapp/doSignIn`, 160 | headers: { 161 | Host: host, 162 | 'Connection': 'keep-alive', 163 | 'Content-Type': 'application/json', 164 | 'User-Agent': getUA(), 165 | 'Referer': 'https://servicewechat.com/wx1a72addb7ee74f67/102/page-frame.html', 166 | 'Accept-Encoding': 'gzip, deflate', 167 | 'Content-Length': '88', 168 | }, 169 | body: `{"token":"${ck[0]}","ticket":""}`, 170 | } 171 | $.post(url, async (error, response, data) => { 172 | try { 173 | let result = JSON.parse(data); 174 | if (result.code == 0) { 175 | DoubleLog(`\n 签到成功: ✅ ,${result.message} 获取 5 积分`) 176 | } else { 177 | DoubleLog(`\n 签到失败: ❌ ,原因是:${result.message}`) 178 | } 179 | } catch (e) { 180 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 181 | } finally { 182 | resolve(); 183 | } 184 | }, timeout) 185 | }) 186 | } 187 | 188 | // ============================================重写============================================ \\ 189 | async function GetRewrite() { 190 | if ($request.url.indexOf("member/api/info/?userKeys=v1.0&pageName=member-info-index-search&formName=searchForm&kwwMember.memberId") > -1) { 191 | let ck = ''; 192 | let theRequest = new Object(); 193 | if ($request.url.indexOf("?") != -1) { 194 | let info = $request.url.split('?'); 195 | let strs = info[1].split("&"); 196 | for (var i = 0; i < strs.length; i++) { 197 | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 198 | } 199 | ck = theRequest.memberId; 200 | } 201 | if (kwwUid) { 202 | if (memberId.indexOf(ck) == -1) { 203 | memberId = memberId + "@" + ck; 204 | $.setdata(memberId, "kwwUid"); 205 | List = memberId.split("@"); 206 | $.msg(`【${$.name}】` + ` 获取第${memberId.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 207 | } 208 | } else { 209 | $.setdata(ck, "memberId"); 210 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 211 | } 212 | } 213 | } 214 | 215 | 216 | // ============================================变量检查============================================ \\ 217 | async function Envs() { 218 | if (UserCookie) { 219 | if (UserCookie.indexOf("@") != -1) { 220 | UserCookie.split("@").forEach((item) => { 221 | UserCookieArr.push(item); 222 | }); 223 | } else if (UserCookie.indexOf("\n") != -1) { 224 | UserCookie.split("\n").forEach((item) => { 225 | UserCookieArr.push(item); 226 | }); 227 | } else { 228 | UserCookieArr.push(UserCookie); 229 | } 230 | } else { 231 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_bsly_Cookie`) 232 | return; 233 | } 234 | return true; 235 | } 236 | // ============================================发送消息============================================ \\ 237 | async function SendMsg(message) { 238 | if (!message) 239 | return; 240 | 241 | if (Notify > 0) { 242 | if ($.isNode()) { 243 | var notify = require('./sendNotify'); 244 | await notify.sendNotify($.name, message); 245 | } else { 246 | $.msg(message); 247 | } 248 | } else { 249 | log(message); 250 | } 251 | } 252 | /** 253 | * 添加消息 254 | * @param str 255 | * @param is_log 256 | */ 257 | function addNotifyStr(str, is_log = true) { 258 | if (is_log) { 259 | log(`${str}\n`) 260 | } 261 | msg += `${str}\n` 262 | } 263 | /** 264 | * 双平台log输出 265 | */ 266 | function DoubleLog(data) { 267 | if ($.isNode()) { 268 | if (data) { 269 | console.log(`${data}`); 270 | msg += `${data}`; 271 | } 272 | } else { 273 | console.log(`${data}`); 274 | msg += `${data}`; 275 | } 276 | } 277 | function randomNum(min, max) { 278 | if (arguments.length === 0) return Math.random() 279 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 280 | return Math.floor(Math.random() * (max - min + 1) + min); 281 | } 282 | function DealScriptStr(str) { 283 | str = str.replace(/\/\*.*?\*\//g, ' '); 284 | str = str.replace(/\b0(\d+)/g, '0o$1'); 285 | return str; 286 | } 287 | /** 288 | * 随机UA 289 | * @param inputString 290 | * @returns {*} 291 | */ 292 | function getUA() { 293 | $.UUID = randomString(40) 294 | const buildMap = { 295 | "167814": `10.1.4`, 296 | "167841": `10.1.6`, 297 | "167853": `10.2.0` 298 | } 299 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 300 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 301 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 302 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 303 | $.appVersion = buildMap[$.build] 304 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 305 | } 306 | /** 307 | * 随机数生成 308 | */ 309 | function randomString(e) { 310 | e = e || 32; 311 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 312 | a = t.length, 313 | n = ""; 314 | for (i = 0; i < e; i++) 315 | n += t.charAt(Math.floor(Math.random() * a)); 316 | return n 317 | } 318 | /** 319 | * 修改配置文件 320 | */ 321 | function modify() { 322 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 323 | if(err){ 324 | return log('读取文件失败!'+err) 325 | } 326 | else { 327 | var result = dataStr.replace(/regular/g,string); 328 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 329 | if (err) {return log(err);} 330 | }); 331 | } 332 | }) 333 | } 334 | 335 | /** 336 | * 获取远程版本 337 | */ 338 | function getVersion(timeout = 3 * 1000) { 339 | return new Promise((resolve) => { 340 | let url = { 341 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_bsly.js`, 342 | } 343 | $.get(url, async (err, resp, data) => { 344 | try { 345 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 346 | update_data = data.match(/update_data = "(.*?)"/)[1] 347 | } catch (e) { 348 | $.logErr(e, resp); 349 | } finally { 350 | resolve() 351 | } 352 | }, timeout) 353 | }) 354 | } 355 | // md5 356 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 357 | // 完整 Env 358 | 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) } 359 | -------------------------------------------------------------------------------- /lekebo_gjjjhyjlb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * 项目类型:微信小程序 4 | * 项目名称:顾家家居会员俱乐部 5 | * 项目抓包:抓mc.kukahome.com下的X-Customer & authorization填入变量 6 | * 项目变量:lekebo_gjjjhyjlb_Cookie 7 | * 项目定时:每40分钟运行一次 8 | * cron: 0 40 0 * * * 9 | * github仓库:https://github.com/ 10 | * 11 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 12 | */ 13 | 14 | //===============脚本版本=================// 15 | let scriptVersion = "1.0.1"; 16 | let update_data = "完成签到,浏览视频,二手市场,校园头条任务"; 17 | //=======================================// 18 | const $ = new Env("顾家家居会员俱乐部"); 19 | const notify = $.isNode() ? require("./sendNotify") : ""; 20 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 21 | const debug = 0 //0为关闭调试,1为打开调试,默认为0 22 | //--------------------------------------------------------------------------------------------------------- 23 | const {log} = console; 24 | let scriptVersionLatest = ""; 25 | let UserCookie = ($.isNode() ? process.env.lekebo_gjjjhyjlb_Cookie : $.getdata('lekebo_gjjjhyjlb_Cookie')) || ''; 26 | let UserCookieArr = []; 27 | let data = ''; 28 | let msg =``; 29 | let ck, ck_status; 30 | var timestamp = Math.round(new Date().getTime()).toString(); 31 | let host = 'mc.kukahome.com'; 32 | let hostname = 'https://' + host; 33 | //=======================================// 34 | !(async () => { 35 | if (typeof $request !== "undefined") { 36 | await GetRewrite(); 37 | } else { 38 | if (!(await Envs())){ 39 | return; 40 | } else { 41 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 42 | await getVersion(); 43 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 44 | if (scriptVersionLatest != scriptVersion) { 45 | DoubleLog(`\n 当前版本:${scriptVersion}`) 46 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 47 | DoubleLog(`\n 更新信息:${update_data}`) 48 | } else { 49 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 50 | } 51 | for (let index = 0; index < UserCookieArr.length; index++) { 52 | let num = index + 1 53 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 54 | ck = UserCookieArr[index].split("&"); 55 | taskBeforeScore = 0; 56 | await start(); 57 | } 58 | await SendMsg(msg); 59 | } 60 | } 61 | 62 | })() 63 | .catch((e) => log(e)) 64 | .finally(() => $.done()) 65 | 66 | /** 67 | * 获取基础信息 68 | * @returns {Promise} 69 | */ 70 | async function start() { 71 | await getMemberInfo(1,2 * 1000); 72 | await $.wait(2000); 73 | await sign_info(2 * 1000); 74 | await $.wait(2000); 75 | await getMemberInfo(2,2 * 1000); 76 | await $.wait(2000); 77 | return true; 78 | } 79 | 80 | /** 81 | * 查询会员信息 82 | * @param timeout 83 | * @returns {Promise} 84 | */ 85 | function getMemberInfo(task ,timeout = 2000) { 86 | return new Promise((resolve) => { 87 | let url = { 88 | url: `${hostname}/club-server/front/member/personalCenter`, 89 | headers: { 90 | 'Host': host, 91 | 'X-Customer': ck[0], 92 | 'brandCode': 'K001', 93 | 'Content-Type': 'application/json' 94 | }, 95 | body: JSON.stringify({ "authorization": ck[1] }) 96 | } 97 | $.post(url, async (error, response, data) => { 98 | try { 99 | let result = JSON.parse(data); 100 | if (task == 1) { 101 | mobile = result.mobile 102 | DoubleLog(`\n 登录成功: ✅ ,会员:${result.mobile},当前 ${result.point} 积分`) 103 | } else if (task == 2) { 104 | DoubleLog(`\n 积分查询: ✅ ,签到后有积分 ${result.point}`); 105 | } else { 106 | DoubleLog(`\n 登录失败: ❌ ,原因是:${data}`) 107 | } 108 | } catch (e) { 109 | DoubleLog(`查询会员信息异常:${data},原因:${e}`) 110 | } finally { 111 | resolve(); 112 | } 113 | }, timeout) 114 | }) 115 | } 116 | 117 | 118 | /** 119 | * 签到信息 httpPost 120 | * https://mc.kukahome.com/club-server/front/member/calendar 121 | */ 122 | function sign_info(timeout = 2000) { 123 | return new Promise((resolve) => { 124 | let url = { 125 | url: `${hostname}/club-server/front/member/calendar`, 126 | headers: { 127 | 'Host': host, 128 | 'X-Customer': ck[0], 129 | 'brandCode': 'K001', 130 | 'appid': '667516', 131 | 'Content-Type': 'application/json' 132 | }, 133 | body: `{"t":${timestamp},"membershipId":${ck[0]}}`, 134 | } 135 | $.post(url, async (error, response, data) => { 136 | try { 137 | let result = JSON.parse(data); 138 | //console.log(result) 139 | if (result.isTodaySigned == true) { 140 | DoubleLog(`\n 签到失败: ❌ ,今天已经签到了 ,明天再来吧!`); 141 | } else { 142 | await signIn(2 * 1000); 143 | } 144 | } catch (e) { 145 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 146 | } finally { 147 | resolve(); 148 | } 149 | }, timeout) 150 | }) 151 | } 152 | 153 | 154 | /** 155 | * 签到 httpRequest 156 | * https://mc.kukahome.com/club-server/front/member/signIn 157 | */ 158 | function signIn(timeout = 2000) { 159 | return new Promise((resolve) => { 160 | let url = { 161 | url: `${hostname}/club-server/front/member/signIn`, 162 | headers: { 163 | 'Host': host, 164 | 'X-Customer': ck[0], 165 | 'brandCode': 'K001', 166 | 'Content-Type': 'application/json' 167 | }, 168 | body: `{"identityType":"mobile","identityValue":"${mobile}","membershipId":${ck[0]}}`, 169 | } 170 | $.post(url, async (error, response, data) => { 171 | try { 172 | let result = JSON.parse(data); 173 | if (result.status == 200) { 174 | DoubleLog(`\n 签到成功: ✅ ,${result.message}`); 175 | } else { 176 | DoubleLog(`\n 签到失败: ❌ ,失败原因是:${result.message}`) 177 | } 178 | } catch (e) { 179 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 180 | } finally { 181 | resolve(); 182 | } 183 | }, timeout) 184 | }) 185 | } 186 | 187 | 188 | // ============================================重写============================================ \\ 189 | async function GetRewrite() { 190 | if ($request.url.indexOf("club-server/front/member/home") > -1) { 191 | let ck_az = $request.headers.Authorization; 192 | let ck_id = $request.headers['X-Customer']; 193 | ck = `${ck_id}&${ck_az}`; 194 | if (ckStr) { 195 | if (ckStr.indexOf(ck_id) == -1) { // 找不到返回 -1 196 | ckStr = ckStr + "@" + ck; 197 | $.setdata(ckStr, "lekebo_gjjjhyjlb_Cookie"); 198 | ckList = ckStr.split("@"); 199 | $.msg($.name + ` 获取第${ckList.length}个 ck 成功: ${ck}`); 200 | } 201 | } else { 202 | $.setdata(ck, "lekebo_gjjjhyjlb_Cookie"); 203 | $.msg($.name + ` 获取第1个 ck 成功: ${ck}`); 204 | } 205 | } 206 | } 207 | 208 | 209 | // ============================================变量检查============================================ \\ 210 | async function Envs() { 211 | if (UserCookie) { 212 | if (UserCookie.indexOf("@") != -1) { 213 | UserCookie.split("@").forEach((item) => { 214 | UserCookieArr.push(item); 215 | }); 216 | } else if (UserCookie.indexOf("\n") != -1) { 217 | UserCookie.split("\n").forEach((item) => { 218 | UserCookieArr.push(item); 219 | }); 220 | } else { 221 | UserCookieArr.push(UserCookie); 222 | } 223 | } else { 224 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_gjjjhyjlb_Cookie`) 225 | return; 226 | } 227 | return true; 228 | } 229 | // ============================================发送消息============================================ \\ 230 | async function SendMsg(message) { 231 | if (!message) 232 | return; 233 | 234 | if (Notify > 0) { 235 | if ($.isNode()) { 236 | var notify = require('./sendNotify'); 237 | await notify.sendNotify($.name, message); 238 | } else { 239 | $.msg(message); 240 | } 241 | } else { 242 | log(message); 243 | } 244 | } 245 | /** 246 | * 添加消息 247 | * @param str 248 | * @param is_log 249 | */ 250 | function addNotifyStr(str, is_log = true) { 251 | if (is_log) { 252 | log(`${str}\n`) 253 | } 254 | msg += `${str}\n` 255 | } 256 | /** 257 | * 双平台log输出 258 | */ 259 | function DoubleLog(data) { 260 | if ($.isNode()) { 261 | if (data) { 262 | console.log(`${data}`); 263 | msg += `${data}`; 264 | } 265 | } else { 266 | console.log(`${data}`); 267 | msg += `${data}`; 268 | } 269 | } 270 | function randomNum(min, max) { 271 | if (arguments.length === 0) return Math.random() 272 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 273 | return Math.floor(Math.random() * (max - min + 1) + min); 274 | } 275 | /** 276 | * 随机延时1-30s,避免大家运行时间一样 277 | * @returns {*|number} 278 | */ 279 | function delay() { 280 | let time = parseInt(Math.random() * 100000); 281 | if (time > 30000) {// 大于30s重新生成 282 | return delay(); 283 | } else { 284 | console.log('随机延时:', `${time}ms, 避免大家运行时间一样`) 285 | return time;// 小于30s,返回 286 | } 287 | } 288 | function dealToken(tokenStr, tokenKeyStr) { 289 | let scriptToken, scriptKey; 290 | scriptToken = DealScriptStr(tokenStr); 291 | scriptKey = DealScriptStr(tokenKeyStr); 292 | let tdom = new JSDOM( 293 | ``, 294 | { 295 | runScripts: 'dangerously' 296 | } 297 | ) 298 | let str = scriptKey; 299 | var babelStr; 300 | str = str.replaceAll(/eval/g, 'var babelStr='); 301 | str = str.replaceAll(/\\u0065\\u0076\\u0061\\u006c/g, 'var babelStr=') 302 | eval(str); 303 | eval(babelStr); 304 | let ast = parser.parse(babelStr); 305 | let funcStr = ast.program.body[0].id.name; 306 | let res = tdom.window[funcStr](); 307 | tdom.window.close(); 308 | //console.log(window['pf8b6b']); 309 | return res; 310 | } 311 | function DealScriptStr(str) { 312 | str = str.replace(/\/\*.*?\*\//g, ' '); 313 | str = str.replace(/\b0(\d+)/g, '0o$1'); 314 | return str; 315 | } 316 | /** 317 | * 随机UA 318 | * @param inputString 319 | * @returns {*} 320 | */ 321 | function getUA() { 322 | $.UUID = randomString(40) 323 | const buildMap = { 324 | "167814": `10.1.4`, 325 | "167841": `10.1.6`, 326 | "167853": `10.2.0` 327 | } 328 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 329 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 330 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 331 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 332 | $.appVersion = buildMap[$.build] 333 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 334 | } 335 | 336 | /** 337 | * 获取当前小时数 338 | */ 339 | function local_hours() { 340 | let myDate = new Date(); 341 | let h = myDate.getHours(); 342 | return h; 343 | } 344 | 345 | /** 346 | * 获取当前分钟数 347 | */ 348 | function local_minutes() { 349 | let myDate = new Date(); 350 | let m = myDate.getMinutes(); 351 | return m; 352 | } 353 | 354 | /** 355 | * 随机数生成 356 | */ 357 | function randomString(e) { 358 | e = e || 32; 359 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 360 | a = t.length, 361 | n = ""; 362 | for (i = 0; i < e; i++) 363 | n += t.charAt(Math.floor(Math.random() * a)); 364 | return n 365 | } 366 | 367 | /** 368 | * 随机整数生成 369 | */ 370 | function randomInt(min, max) { 371 | return Math.round(Math.random() * (max - min) + min) 372 | } 373 | 374 | /** 375 | * 获取毫秒时间戳 376 | */ 377 | function timestampMs(){ 378 | return new Date().getTime(); 379 | } 380 | 381 | /** 382 | * 383 | * 获取秒时间戳 384 | */ 385 | function timestampS(){ 386 | return Date.parse(new Date())/1000; 387 | } 388 | 389 | 390 | /** 391 | * 修改配置文件 392 | */ 393 | function modify() { 394 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 395 | if(err){ 396 | return log('读取文件失败!'+err) 397 | } 398 | else { 399 | var result = dataStr.replace(/regular/g,string); 400 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 401 | if (err) {return log(err);} 402 | }); 403 | } 404 | }) 405 | } 406 | 407 | /** 408 | * 获取远程版本 409 | */ 410 | function getVersion(timeout = 3 * 1000) { 411 | return new Promise((resolve) => { 412 | let url = { 413 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_kww.js`, 414 | } 415 | $.get(url, async (err, resp, data) => { 416 | try { 417 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 418 | update_data = data.match(/update_data = "(.*?)"/)[1] 419 | } catch (e) { 420 | $.logErr(e, resp); 421 | } finally { 422 | resolve() 423 | } 424 | }, timeout) 425 | }) 426 | } 427 | 428 | /** 429 | * time 输出格式:1970-01-01 00:00:00 430 | */ 431 | function t() { 432 | var date = new Date(); 433 | // 获取当前月份 434 | var nowMonth = date.getMonth() + 1; 435 | // 获取当前是几号 436 | var strDate = date.getDate(); 437 | //获取当前小时(0-23) 438 | var nowhour = date.getHours() 439 | //获取当前分钟(0-59) 440 | var nowMinute = date.getMinutes() 441 | //获取当前秒数(0-59) 442 | var nowSecond = date.getSeconds(); 443 | // 添加分隔符“-” 444 | var seperator = "-"; 445 | // 添加分隔符“:” 446 | var seperator1 = ":"; 447 | // 对月份进行处理,1-9月在前面添加一个“0” 448 | if (nowMonth >= 1 && nowMonth <= 9) { 449 | nowMonth = "0" + nowMonth; 450 | } 451 | // 对月份进行处理,1-9号在前面添加一个“0” 452 | if (strDate >= 0 && strDate <= 9) { 453 | strDate = "0" + strDate; 454 | } 455 | // 对小时进行处理,0-9号在前面添加一个“0” 456 | if (nowhour >= 0 && nowhour <= 9) { 457 | nowhour = "0" + nowhour; 458 | } 459 | // 对分钟进行处理,0-9号在前面添加一个“0” 460 | if (nowMinute >= 0 && nowMinute <= 9) { 461 | nowMinute = "0" + nowMinute; 462 | } 463 | // 对秒数进行处理,0-9号在前面添加一个“0” 464 | if (nowSecond >= 0 && nowSecond <= 9) { 465 | nowSecond = "0" + nowSecond; 466 | } 467 | 468 | // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期 469 | var nowDate = date.getFullYear() + seperator + nowMonth + seperator + strDate + ` ` + nowhour + seperator1 + nowMinute + seperator1 + nowSecond 470 | return nowDate 471 | } 472 | 473 | 474 | // md5 475 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 476 | // 完整 Env 477 | 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) } 478 | -------------------------------------------------------------------------------- /lekebo_hqcsh.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * 项目类型:微信小程序 5 | * 项目名称:好奇车生活 6 | * 项目抓包:抓channel.cheryfs.cn下的openId & accountId填入变量 7 | * 项目变量:lekebo_hqcsh_Cookie 8 | * 项目定时:每天运行两次 9 | * cron: 0 9,18 * * * 10 | * github仓库:https://github.com/qq274023/lekebo 11 | * 12 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 13 | */ 14 | 15 | 16 | //===============脚本版本=================// 17 | let scriptVersion = "1.0.1"; 18 | let update_data = "完成签到,18点抢红包任务"; 19 | //=======================================// 20 | const $ = new Env('好奇车生活'); 21 | const notify = $.isNode() ? require('./sendNotify') : ''; 22 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 23 | const {log} = console; 24 | let scriptVersionLatest = ""; 25 | let UserCookie = ($.isNode() ? process.env.lekebo_hqcsh_Cookie : $.getdata('lekebo_hqcsh_Cookie')) || ''; 26 | let UserCookieArr = []; 27 | let data = ''; 28 | let msg =``; 29 | let isSign = false; 30 | var timestamp = Math.round(new Date().getTime()).toString(); 31 | let host = 'channel.cheryfs.cn'; 32 | let hostname = 'https://' + host; 33 | let q1 = '647894196522340352' // 188积分 1.08元 34 | let q2 = '622187839353806848' // 288积分 1.88元 35 | let q3 = '622187928306601984' // 588积分 3.88元 36 | let q4 = '622188100122075136' // 888积分 5.88元 37 | let qiang = q1 //指定抢哪个红包 38 | //=======================================// 39 | !(async () => { 40 | if (typeof $request !== "undefined") { 41 | await GetRewrite(); 42 | } else { 43 | if (!(await Envs())){ 44 | return; 45 | } else { 46 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 47 | await getVersion(); 48 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 49 | if (scriptVersionLatest != scriptVersion) { 50 | DoubleLog(`\n 当前版本:${scriptVersion}`) 51 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 52 | DoubleLog(`\n 更新信息:${update_data}`) 53 | } else { 54 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 55 | } 56 | for (let index = 0; index < UserCookieArr.length; index++) { 57 | let num = index + 1 58 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 59 | ck = UserCookieArr[index].split("&"); 60 | await start(); 61 | } 62 | await SendMsg(msg); 63 | } 64 | } 65 | 66 | })() 67 | .catch((e) => log(e)) 68 | .finally(() => $.done()) 69 | 70 | /** 71 | * 获取基础信息 72 | * @returns {Promise} 73 | */ 74 | async function start() { 75 | await getMemberInfo(2 * 1000); 76 | await $.wait(2000); 77 | await getMemberScore(2 * 1000); 78 | await $.wait(2000); 79 | await signin(2 * 1000); 80 | await $.wait(2000); 81 | await withdraw(2 * 1000); 82 | await $.wait(2000); 83 | return true; 84 | } 85 | /** 86 | * 查询会员信息 87 | * @param timeout 88 | * @returns {Promise} 89 | */ 90 | function getMemberInfo(timeout = 2000) { 91 | return new Promise((resolve) => { 92 | let url = { 93 | url: `${hostname}/archer/activity-api/cherycar/getCarUser?openId=${ck[0]}`, 94 | headers: { 95 | Host: host, 96 | 'Connection': 'keep-alive', 97 | 'Content-Type': 'application/json', 98 | 'wxappid': 'wx8c6e8a965158ad6c', 99 | 'appid': 'wx8c6e8a965158ad6c', 100 | 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36 MicroMessenger/7.0.4.501 NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF',// 101 | 'tenantid': '619669306447261696', 102 | }, 103 | } 104 | $.get(url, async (error, response, data) => { 105 | try { 106 | let result = JSON.parse(data); 107 | if (result.success == true) { 108 | DoubleLog(`\n 会员信息: ✅ ,用户:${result.result.phone}`) 109 | } else { 110 | DoubleLog(`\n 会员信息: ❌ ,原因是:${result.success}`) 111 | } 112 | } catch (e) { 113 | DoubleLog(`\n 会员异常: ❌ ,${response}`) 114 | } finally { 115 | resolve(); 116 | } 117 | }, timeout) 118 | }) 119 | } 120 | /** 121 | * 查询会员信息 122 | * @param timeout 123 | * @returns {Promise} 124 | */ 125 | function getMemberScore(timeout = 2000) { 126 | return new Promise((resolve) => { 127 | let url = { 128 | url: `${hostname}/archer/activity-api/common/accountPointLeft?pointId=620415610219683840`, 129 | headers: { 130 | Host: host, 131 | 'Content-Type': 'application/json', 132 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6763',// 133 | 'tenantid': '619669306447261696', 134 | 'activityId': '621911913692942337', 135 | 'accountId': ck[1], 136 | }, 137 | } 138 | $.get(url, async (error, response, data) => { 139 | try { 140 | let result = JSON.parse(data); 141 | if (result.success == true) { 142 | DoubleLog(`\n 查询积分: ✅ ,${result.result} 积分`) 143 | } else { 144 | DoubleLog(`\n 查询积分: ❌ ,原因是:${result.success}`) 145 | } 146 | } catch (e) { 147 | DoubleLog(`\n 积分异常: ❌ ,${response}`) 148 | } finally { 149 | resolve(); 150 | } 151 | }, timeout) 152 | }) 153 | } 154 | /** 155 | * 签到 156 | * @param timeout 157 | * @returns {Promise} 158 | */ 159 | function signin(timeout = 2000) { 160 | return new Promise((resolve) => { 161 | let url = { 162 | url: `${hostname}/archer/activity-api/signinact/signin`, 163 | headers: { 164 | Host: host, 165 | 'accept': 'application/json', 166 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6763',// 167 | 'tenantid': '619669306447261696',// 168 | 'activityId': '620810406813786113', 169 | 'accountId': ck[1], 170 | }, 171 | } 172 | $.get(url, async (error, response, data) => { 173 | try { 174 | let result = JSON.parse(data); 175 | if (result.code == 200) { 176 | if (result.result.message == "今日已签到") { 177 | DoubleLog(`\n 签到失败: ❌ ,原因是:${result.result.message}`) 178 | } else { 179 | DoubleLog(`\n 签到成功: ✅ ,获得 ${result.amount} 积分`) 180 | } 181 | } else { 182 | DoubleLog(`\n 签到失败: ❌ ,原因是:${result.result.message}`) 183 | } 184 | } catch (e) { 185 | DoubleLog(`\n 签到异常: ❌ ,${response}`) 186 | } finally { 187 | resolve(); 188 | } 189 | }, timeout) 190 | }) 191 | } 192 | /** 193 | * 查询会员信息 194 | * @param timeout 195 | * @returns {Promise} 196 | */ 197 | function withdraw(timeout = 2000) { 198 | return new Promise((resolve) => { 199 | let url = { 200 | url: `${hostname}/archer/activity-api/pointsmall/exchangeCard?pointsMallCardId=${qiang}&exchangeCount=1&mallOrderInputVoStr=%7B%22person%22:%22%22,%22phone%22:%22%22,%22province%22:%22%22,%22city%22:%22%22,%22area%22:%22%22,%22address%22:%22%22,%22remark%22:%22%22%7D&channel=1&exchangeType=0&exchangeNeedPoints=188&exchangeNeedMoney=0&cardGoodsItemIds=`, 201 | headers: { 202 | Host: host, 203 | 'accept': 'application/json', 204 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6763',// 205 | 'tenantid': '619669306447261696',// 206 | 'activityId': '621950054462152705', 207 | 'accountId': ck[1], 208 | }, 209 | } 210 | $.post(url, async (error, response, data) => { 211 | try { 212 | let result = JSON.parse(data); 213 | if (result.code == 200) { 214 | console.log(result) 215 | //DoubleLog(`\n 疯抢红包: ✅ ,${result.body.userInfo.nick} 余额:${result.body.goldCoinInfo.virtualCash},今天收益:${result.body.goldCoinInfo.amountToday} 金币`) 216 | } else { 217 | DoubleLog(`\n 疯抢红包: ❌ ,原因是:${result.message}`) 218 | } 219 | } catch (e) { 220 | DoubleLog(`\n 红包异常: ❌ ,${response}`) 221 | } finally { 222 | resolve(); 223 | } 224 | }, timeout) 225 | }) 226 | } 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | // ============================================重写============================================ \\ 244 | async function GetRewrite() { 245 | if ($request.url.indexOf("member/api/info/?userKeys=v1.0&pageName=member-info-index-search&formName=searchForm&kwwMember.memberId") > -1) { 246 | let ck = ''; 247 | let theRequest = new Object(); 248 | if ($request.url.indexOf("?") != -1) { 249 | let info = $request.url.split('?'); 250 | let strs = info[1].split("&"); 251 | for (var i = 0; i < strs.length; i++) { 252 | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 253 | } 254 | ck = theRequest.memberId; 255 | } 256 | if (kwwUid) { 257 | if (memberId.indexOf(ck) == -1) { 258 | memberId = memberId + "@" + ck; 259 | $.setdata(memberId, "kwwUid"); 260 | List = memberId.split("@"); 261 | $.msg(`【${$.name}】` + ` 获取第${memberId.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 262 | } 263 | } else { 264 | $.setdata(ck, "memberId"); 265 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 266 | } 267 | } 268 | } 269 | 270 | 271 | // ============================================变量检查============================================ \\ 272 | async function Envs() { 273 | if (UserCookie) { 274 | if (UserCookie.indexOf("@") != -1) { 275 | UserCookie.split("@").forEach((item) => { 276 | UserCookieArr.push(item); 277 | }); 278 | } else if (UserCookie.indexOf("\n") != -1) { 279 | UserCookie.split("\n").forEach((item) => { 280 | UserCookieArr.push(item); 281 | }); 282 | } else { 283 | UserCookieArr.push(UserCookie); 284 | } 285 | } else { 286 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_hqcsh_Cookie`) 287 | return; 288 | } 289 | return true; 290 | } 291 | // ============================================发送消息============================================ \\ 292 | async function SendMsg(message) { 293 | if (!message) 294 | return; 295 | 296 | if (Notify > 0) { 297 | if ($.isNode()) { 298 | var notify = require('./sendNotify'); 299 | await notify.sendNotify($.name, message); 300 | } else { 301 | $.msg(message); 302 | } 303 | } else { 304 | log(message); 305 | } 306 | } 307 | /** 308 | * 添加消息 309 | * @param str 310 | * @param is_log 311 | */ 312 | function addNotifyStr(str, is_log = true) { 313 | if (is_log) { 314 | log(`${str}\n`) 315 | } 316 | msg += `${str}\n` 317 | } 318 | /** 319 | * 双平台log输出 320 | */ 321 | function DoubleLog(data) { 322 | if ($.isNode()) { 323 | if (data) { 324 | console.log(`${data}`); 325 | msg += `${data}`; 326 | } 327 | } else { 328 | console.log(`${data}`); 329 | msg += `${data}`; 330 | } 331 | } 332 | function randomNum(min, max) { 333 | if (arguments.length === 0) return Math.random() 334 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 335 | return Math.floor(Math.random() * (max - min + 1) + min); 336 | } 337 | function DealScriptStr(str) { 338 | str = str.replace(/\/\*.*?\*\//g, ' '); 339 | str = str.replace(/\b0(\d+)/g, '0o$1'); 340 | return str; 341 | } 342 | /** 343 | * 随机UA 344 | * @param inputString 345 | * @returns {*} 346 | */ 347 | function getUA() { 348 | $.UUID = randomString(40) 349 | const buildMap = { 350 | "167814": `10.1.4`, 351 | "167841": `10.1.6`, 352 | "167853": `10.2.0` 353 | } 354 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 355 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 356 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 357 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 358 | $.appVersion = buildMap[$.build] 359 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 360 | } 361 | 362 | /** 363 | * 随机数生成 364 | */ 365 | function randomString(e) { 366 | e = e || 32; 367 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 368 | a = t.length, 369 | n = ""; 370 | for (i = 0; i < e; i++) 371 | n += t.charAt(Math.floor(Math.random() * a)); 372 | return n 373 | } 374 | 375 | 376 | /** 377 | * 修改配置文件 378 | */ 379 | function modify() { 380 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 381 | if(err){ 382 | return log('读取文件失败!'+err) 383 | } 384 | else { 385 | var result = dataStr.replace(/regular/g,string); 386 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 387 | if (err) {return log(err);} 388 | }); 389 | } 390 | }) 391 | } 392 | 393 | /** 394 | * 获取远程版本 395 | */ 396 | function getVersion(timeout = 3 * 1000) { 397 | return new Promise((resolve) => { 398 | let url = { 399 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_hqcsh.js`, 400 | } 401 | $.get(url, async (err, resp, data) => { 402 | try { 403 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 404 | update_data = data.match(/update_data = "(.*?)"/)[1] 405 | } catch (e) { 406 | $.logErr(e, resp); 407 | } finally { 408 | resolve() 409 | } 410 | }, timeout) 411 | }) 412 | } 413 | 414 | // md5 415 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 416 | // 完整 Env 417 | 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) } 418 | -------------------------------------------------------------------------------- /lekebo_rdxk.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * 项目类型:APP 4 | * 项目名称:热度星客 5 | * 项目抓包:抓m.reduxingke.com下的authorization填入变量 6 | * 项目变量:lekebo_rdxk_Cookie 7 | * 项目定时:每40分钟运行一次 8 | * cron: 0 9 * * * 9 | * github仓库:https://github.com/ 10 | * 11 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 邀请码:TNESO 12 | */ 13 | 14 | 15 | //===============脚本版本=================// 16 | let scriptVersion = "1.0.1"; 17 | let update_data = "完成签到,浏览视频,二手市场,校园头条任务"; 18 | //=======================================// 19 | const $ = new Env('热度星客'); 20 | const notify = $.isNode() ? require('./sendNotify') : ''; 21 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 22 | const {log} = console; 23 | let scriptVersionLatest = ""; 24 | let UserCookie = ($.isNode() ? process.env.lekebo_rdxk_Cookie : $.getdata('lekebo_rdxk_Cookie')) || ''; 25 | let UserCookieArr = []; 26 | let data = ''; 27 | let msg =``; 28 | let isSign = false; 29 | let host = 'm.reduxingke.com'; 30 | let hostname = 'https://' + host; 31 | //=======================================// 32 | !(async () => { 33 | if (typeof $request !== "undefined") { 34 | await GetRewrite(); 35 | } else { 36 | if (!(await Envs())){ 37 | return; 38 | } else { 39 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 40 | await getVersion(); 41 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 42 | if (scriptVersionLatest != scriptVersion) { 43 | DoubleLog(`\n 当前版本:${scriptVersion}`) 44 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 45 | DoubleLog(`\n 更新信息:${update_data}`) 46 | } else { 47 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 48 | } 49 | for (let index = 0; index < UserCookieArr.length; index++) { 50 | let num = index + 1 51 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 52 | ck = UserCookieArr[index].split("&"); 53 | taskBeforeScore = 0; 54 | await start(); 55 | } 56 | await SendMsg(msg); 57 | } 58 | } 59 | 60 | })() 61 | .catch((e) => log(e)) 62 | .finally(() => $.done()) 63 | 64 | /** 65 | * 获取基础信息 66 | * @returns {Promise} 67 | */ 68 | async function start() { 69 | await getMemberInfo(2 * 1000); 70 | await $.wait(2000); 71 | await sign(2 * 1000); 72 | await $.wait(2000); 73 | await signtoday(2 * 1000); 74 | await $.wait(2000); 75 | await setSpread(2 * 1000); 76 | await $.wait(2000); 77 | await withdraw(2 * 1000); 78 | await $.wait(2000); 79 | return true; 80 | } 81 | /** 82 | * 查询会员信息 83 | * @param timeout 84 | * @returns {Promise} 85 | */ 86 | function getMemberInfo(timeout = 2000) { 87 | return new Promise((resolve) => { 88 | let url = { 89 | url: `${hostname}/api/user`, 90 | headers: { 91 | 'Host': host, 92 | 'Content-Type': 'application/json', 93 | 'authori-zation': 'Bearer ' + ck[0], 94 | 'version': '10242', 95 | 'User-Agent': getUA(), 96 | }, 97 | } 98 | $.get(url, async (error, response, data) => { 99 | try { 100 | let result = JSON.parse(data); 101 | if (result.status == 200) { 102 | txje = Math.round(result.data.brokerage_price) 103 | //console.log(txje) 104 | DoubleLog(`\n 会员查询: ✅ ,${result.data.phone} 当前拥有:${result.data.brokerage_price} 元`) 105 | } else { 106 | DoubleLog(`\n 会员查询: ❌ ,原因是:${result.msg}`) 107 | } 108 | } catch (e) { 109 | DoubleLog(`\n 信息异常: ❌ ,${data},原因:${e}`) 110 | } finally { 111 | resolve(); 112 | } 113 | }, timeout) 114 | }) 115 | } 116 | /** 117 | * 签到 118 | * @param timeout 119 | * @returns {Promise} 120 | */ 121 | function sign(timeout = 2000) { 122 | return new Promise((resolve) => { 123 | let url = { 124 | url: `${hostname}/api/usersign/sign`, 125 | headers: { 126 | 'Host': host, 127 | 'Content-Type': 'application/json', 128 | 'Form-type': 'app', 129 | 'Authori-zation': 'Bearer ' + ck[0], 130 | 'User-Agent': getUA(), 131 | 'version': '10095', 132 | 'Referer': 'https://servicewechat.com/wx9e9a49f5659aa37b/3/page-frame.html', 133 | }, 134 | } 135 | $.post(url, async (error, response, data) => { 136 | try { 137 | let result = JSON.parse(data); 138 | if (result.code == 200) { 139 | DoubleLog(`\n 签到成功: ✅ ,${result.msg}`) 140 | } else { 141 | DoubleLog(`\n 签到失败: ❌ ,原因是:${result.msg}`) 142 | } 143 | } catch (e) { 144 | DoubleLog(`\n 信息异常: ❌ ,${data},原因:${e}`) 145 | } finally { 146 | resolve(); 147 | } 148 | }, timeout) 149 | }) 150 | } 151 | /** 152 | * 连续签到 153 | * @param timeout 154 | * @returns {Promise} 155 | */ 156 | function signtoday(timeout = 2000) { 157 | return new Promise((resolve) => { 158 | let url = { 159 | url: `${hostname}/api/usersign/index`, 160 | headers: { 161 | Host: host, 162 | 'Content-Type': 'application/json', 163 | 'Authori-zation': 'Bearer ' + ck[0], 164 | 'Referer': 'https://servicewechat.com/wx9e9a49f5659aa37b/3/page-frame.html', 165 | 'User-Agent': getUA(), 166 | }, 167 | } 168 | $.get(url, async (error, response, data) => { 169 | try { 170 | let result = JSON.parse(data); 171 | if (result.status == 200) { 172 | DoubleLog(`\n 连续签到: ✅ ,已连续签到 ${result.data.is_today_sign} 天`) 173 | } else { 174 | DoubleLog(`\n 连续签到: ❌ ,原因是:${result.msg}`) 175 | } 176 | } catch (e) { 177 | DoubleLog(`\n 信息异常: ❌ ,${data},原因:${e}`) 178 | } finally { 179 | resolve(); 180 | } 181 | }, timeout) 182 | }) 183 | } 184 | /** 185 | * 绑定推荐人 186 | * @param timeout 187 | * @returns {Promise} 188 | */ 189 | function setSpread(timeout = 2000) { 190 | return new Promise((resolve) => { 191 | let url = { 192 | url: `${hostname}/api/user/setSpread`, 193 | headers: { 194 | 'Host': host, 195 | 'Content-Type': 'application/json', 196 | 'Form-type': 'app', 197 | 'Authori-zation': 'Bearer ' + ck[0], 198 | 'User-Agent': getUA(), 199 | 'version': '10095', 200 | 'Referer': 'https://servicewechat.com/wx9e9a49f5659aa37b/3/page-frame.html', 201 | }, 202 | body: `{"invite_code":"XK31769646"}`, 203 | } 204 | $.post(url, async (error, response, data) => { 205 | try { 206 | let result = JSON.parse(data); 207 | if (result.status == 200) { 208 | DoubleLog(`\n 推荐成功: ✅ ,${result.msg}`) 209 | } else { 210 | DoubleLog(`\n 推荐失败: ❌ ,原因是:${result.msg}`) 211 | } 212 | } catch (e) { 213 | DoubleLog(`\n 信息异常: ❌ ,${data},原因:${e}`) 214 | } finally { 215 | resolve(); 216 | } 217 | }, timeout) 218 | }) 219 | } 220 | /** 221 | * 提现 222 | * @param timeout 223 | * @returns {Promise} 224 | */ 225 | function withdraw(timeout = 2000) { 226 | return new Promise((resolve) => { 227 | let url = { 228 | url: `${hostname}/api/user/applyExtract`, 229 | headers: { 230 | 'Host': host, 231 | 'authori-zation': 'Bearer ' + ck[0], 232 | 'User-Agent': getUA(), 233 | }, 234 | body: `{"brokerage":"${txje}","pwd":"274023","extract_type":"alipay"}`, 235 | } 236 | $.post(url, async (error, response, data) => { 237 | try { 238 | let result = JSON.parse(data); 239 | //console.log(result) 240 | if (result.status == 200) { 241 | DoubleLog(`\n 提现成功: ✅ ,${result.msg}`) 242 | } else { 243 | DoubleLog(`\n 提现失败: ❌ ,原因是:${result.msg}`) 244 | } 245 | } catch (e) { 246 | DoubleLog(`\n 信息异常: ❌ ,${data},原因:${e}`) 247 | } finally { 248 | resolve(); 249 | } 250 | }, timeout) 251 | }) 252 | } 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | // ============================================重写============================================ \\ 279 | async function GetRewrite() { 280 | if ($request.url.indexOf("member/api/info/?userKeys=v1.0&pageName=member-info-index-search&formName=searchForm&kwwMember.memberId") > -1) { 281 | let ck = ''; 282 | let theRequest = new Object(); 283 | if ($request.url.indexOf("?") != -1) { 284 | let info = $request.url.split('?'); 285 | let strs = info[1].split("&"); 286 | for (var i = 0; i < strs.length; i++) { 287 | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 288 | } 289 | ck = theRequest.memberId; 290 | } 291 | if (kwwUid) { 292 | if (memberId.indexOf(ck) == -1) { 293 | memberId = memberId + "@" + ck; 294 | $.setdata(memberId, "kwwUid"); 295 | List = memberId.split("@"); 296 | $.msg(`【${$.name}】` + ` 获取第${memberId.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 297 | } 298 | } else { 299 | $.setdata(ck, "memberId"); 300 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 301 | } 302 | } 303 | } 304 | 305 | 306 | // ============================================变量检查============================================ \\ 307 | async function Envs() { 308 | if (UserCookie) { 309 | if (UserCookie.indexOf("@") != -1) { 310 | UserCookie.split("@").forEach((item) => { 311 | UserCookieArr.push(item); 312 | }); 313 | } else if (UserCookie.indexOf("\n") != -1) { 314 | UserCookie.split("\n").forEach((item) => { 315 | UserCookieArr.push(item); 316 | }); 317 | } else { 318 | UserCookieArr.push(UserCookie); 319 | } 320 | } else { 321 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_rdxk_Cookie`) 322 | return; 323 | } 324 | return true; 325 | } 326 | // ============================================发送消息============================================ \\ 327 | async function SendMsg(message) { 328 | if (!message) 329 | return; 330 | 331 | if (Notify > 0) { 332 | if ($.isNode()) { 333 | var notify = require('./sendNotify'); 334 | await notify.sendNotify($.name, message); 335 | } else { 336 | $.msg(message); 337 | } 338 | } else { 339 | log(message); 340 | } 341 | } 342 | /** 343 | * 添加消息 344 | * @param str 345 | * @param is_log 346 | */ 347 | function addNotifyStr(str, is_log = true) { 348 | if (is_log) { 349 | log(`${str}\n`) 350 | } 351 | msg += `${str}\n` 352 | } 353 | /** 354 | * 双平台log输出 355 | */ 356 | function DoubleLog(data) { 357 | if ($.isNode()) { 358 | if (data) { 359 | console.log(`${data}`); 360 | msg += `${data}`; 361 | } 362 | } else { 363 | console.log(`${data}`); 364 | msg += `${data}`; 365 | } 366 | } 367 | function randomNum(min, max) { 368 | if (arguments.length === 0) return Math.random() 369 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 370 | return Math.floor(Math.random() * (max - min + 1) + min); 371 | } 372 | function DealScriptStr(str) { 373 | str = str.replace(/\/\*.*?\*\//g, ' '); 374 | str = str.replace(/\b0(\d+)/g, '0o$1'); 375 | return str; 376 | } 377 | /** 378 | * 随机UA 379 | * @param inputString 380 | * @returns {*} 381 | */ 382 | function getUA() { 383 | $.UUID = randomString(40) 384 | const buildMap = { 385 | "167814": `10.1.4`, 386 | "167841": `10.1.6`, 387 | "167853": `10.2.0` 388 | } 389 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 390 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 391 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 392 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 393 | $.appVersion = buildMap[$.build] 394 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 395 | } 396 | 397 | /** 398 | * 随机数生成 399 | */ 400 | function randomString(e) { 401 | e = e || 32; 402 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 403 | a = t.length, 404 | n = ""; 405 | for (i = 0; i < e; i++) 406 | n += t.charAt(Math.floor(Math.random() * a)); 407 | return n 408 | } 409 | 410 | /** 411 | * 修改配置文件 412 | */ 413 | function modify() { 414 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 415 | if(err){ 416 | return log('读取文件失败!'+err) 417 | } 418 | else { 419 | var result = dataStr.replace(/regular/g,string); 420 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 421 | if (err) {return log(err);} 422 | }); 423 | } 424 | }) 425 | } 426 | 427 | /** 428 | * 获取远程版本 429 | */ 430 | function getVersion(timeout = 3 * 1000) { 431 | return new Promise((resolve) => { 432 | let url = { 433 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_rdxk.js`, 434 | } 435 | $.get(url, async (err, resp, data) => { 436 | try { 437 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 438 | update_data = data.match(/update_data = "(.*?)"/)[1] 439 | } catch (e) { 440 | $.logErr(e, resp); 441 | } finally { 442 | resolve() 443 | } 444 | }, timeout) 445 | }) 446 | } 447 | 448 | /** 449 | * time 输出格式:1970-01-01 00:00:00 450 | */ 451 | function t() { 452 | var date = new Date(); 453 | // 获取当前月份 454 | var nowMonth = date.getMonth() + 1; 455 | // 获取当前是几号 456 | var strDate = date.getDate(); 457 | //获取当前小时(0-23) 458 | var nowhour = date.getHours() 459 | //获取当前分钟(0-59) 460 | var nowMinute = date.getMinutes() 461 | //获取当前秒数(0-59) 462 | var nowSecond = date.getSeconds(); 463 | // 添加分隔符“-” 464 | var seperator = "-"; 465 | // 添加分隔符“:” 466 | var seperator1 = ":"; 467 | // 对月份进行处理,1-9月在前面添加一个“0” 468 | if (nowMonth >= 1 && nowMonth <= 9) { 469 | nowMonth = "0" + nowMonth; 470 | } 471 | // 对月份进行处理,1-9号在前面添加一个“0” 472 | if (strDate >= 0 && strDate <= 9) { 473 | strDate = "0" + strDate; 474 | } 475 | // 对小时进行处理,0-9号在前面添加一个“0” 476 | if (nowhour >= 0 && nowhour <= 9) { 477 | nowhour = "0" + nowhour; 478 | } 479 | // 对分钟进行处理,0-9号在前面添加一个“0” 480 | if (nowMinute >= 0 && nowMinute <= 9) { 481 | nowMinute = "0" + nowMinute; 482 | } 483 | // 对秒数进行处理,0-9号在前面添加一个“0” 484 | if (nowSecond >= 0 && nowSecond <= 9) { 485 | nowSecond = "0" + nowSecond; 486 | } 487 | 488 | // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期 489 | var nowDate = date.getFullYear() + seperator + nowMonth + seperator + strDate + ` ` + nowhour + seperator1 + nowMinute + seperator1 + nowSecond 490 | return nowDate 491 | } 492 | 493 | 494 | // md5 495 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 496 | // 完整 Env 497 | 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) } 498 | -------------------------------------------------------------------------------- /lekebo_gmjk.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * 项目类型:微信小程序 5 | * 项目名称:敢迈健康+ 6 | * 项目抓包:抓api.digital4danone.com.cn下的X-Access-Token & openId & unionId填入变量 7 | * 项目变量:lekebo_gmjk_Cookie 8 | * 项目定时:每40分钟运行一次 9 | * cron: 0 0,7 * * * 10 | * github仓库:https://github.com/ 11 | * 12 | * 交流Q群:104062430 作者:乐客播 欢迎前来提交bug 邀请码:TNESO 13 | */ 14 | 15 | 16 | //===============脚本版本=================// 17 | let scriptVersion = "1.0.1"; 18 | let update_data = "小程序任务要求:改成这四个 记录便便 按时吃饭 23点前睡觉 起床喝杯水"; 19 | //=======================================// 20 | const $ = new Env('敢迈健康'); 21 | const notify = $.isNode() ? require('./sendNotify') : ''; 22 | const Notify = 1 //0为关闭通知,1为打开通知,默认为1 23 | const {log} = console; 24 | let scriptVersionLatest = ""; 25 | let UserCookie = ($.isNode() ? process.env.lekebo_gmjk_Cookie : $.getdata('lekebo_gmjk_Cookie')) || ''; 26 | let UserCookieArr = []; 27 | let data = ''; 28 | let msg =``; 29 | let isSign = false; 30 | var timestamp = Math.round(new Date().getTime()).toString(); 31 | let host = 'api.digital4danone.com.cn'; 32 | let hostname = 'https://' + host; 33 | //=======================================// 34 | !(async () => { 35 | if (typeof $request !== "undefined") { 36 | await GetRewrite(); 37 | } else { 38 | if (!(await Envs())){ 39 | return; 40 | } else { 41 | DoubleLog(`\n 交流Q群:104062430 作者:乐客播 欢迎前来提交bug`) 42 | await getVersion(); 43 | DoubleLog(`\n================ 共找到 ${UserCookieArr.length} 个账号 ================ \n 脚本执行✌北京时间(UTC+8):${new Date(new Date().getTime() + new Date().getTimezoneOffset() * 60 * 1000 + 8 * 60 * 60 * 1000).toLocaleString()} \n================ 版本对比检查更新 ================`); 44 | if (scriptVersionLatest != scriptVersion) { 45 | DoubleLog(`\n 当前版本:${scriptVersion}`) 46 | DoubleLog(`\n 最新版本:${scriptVersionLatest}`) 47 | DoubleLog(`\n 更新信息:${update_data}`) 48 | } else { 49 | DoubleLog(`\n 版本信息:${scriptVersion} ,已是最新版本无需更新开始执行脚本`) 50 | } 51 | for (let index = 0; index < UserCookieArr.length; index++) { 52 | let num = index + 1 53 | DoubleLog(`\n================ 开始第 ${num} 个账号 ================`) 54 | ck = UserCookieArr[index].split("&"); 55 | taskBeforeScore = 0; 56 | await start(); 57 | } 58 | await SendMsg(msg); 59 | } 60 | } 61 | 62 | })() 63 | .catch((e) => log(e)) 64 | .finally(() => $.done()) 65 | 66 | /** 67 | * 获取基础信息 68 | * @returns {Promise} 69 | */ 70 | async function start() { 71 | await getMemberInfo(2 * 1000); 72 | await $.wait(2000); 73 | await report(2 * 1000); 74 | await $.wait(2000); 75 | await getUserTask(2 * 1000); 76 | await $.wait(2000); 77 | return true; 78 | } 79 | /** 80 | * 查询会员信息 81 | * @param timeout 82 | * @returns {Promise} 83 | */ 84 | function getMemberInfo(timeout = 2000) { 85 | return new Promise((resolve) => { 86 | let url = { 87 | url: `${hostname}/healthyaging/danone/wx/ha/haUser/info`, 88 | headers: { 89 | Host: host, 90 | 'Connection': 'keep-alive', 91 | 'User-Agent': getUA(), 92 | 'X-Access-Token': ck[0], 93 | 'Content-Type': 'application/json', 94 | }, 95 | } 96 | $.get(url, async (error, response, data) => { 97 | try { 98 | let result = JSON.parse(data); 99 | //console.log(result) 100 | if (result.code == 200) { 101 | mobile = result.result.mobile 102 | DoubleLog(`\n 会员信息: ✅ ,用户${result.result.mobile}`) 103 | } else { 104 | DoubleLog(`\n 会员信息: ❌ ,原因是:${result.message}`) 105 | } 106 | } catch (e) { 107 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 108 | } finally { 109 | resolve(); 110 | } 111 | }, timeout) 112 | }) 113 | } 114 | /** 115 | * 上报请求 116 | * @param timeout 117 | * @returns {Promise} 118 | */ 119 | function report(timeout = 2000) { 120 | return new Promise((resolve) => { 121 | let url = { 122 | url: `${hostname}/healthyaging/danone/wx/config/eventReport`, 123 | headers: { 124 | Host: host, 125 | 'Connection': 'keep-alive', 126 | 'User-Agent': getUA(), 127 | 'X-Access-Token': ck[0], 128 | 'Content-Type': 'application/json', 129 | }, 130 | body: `{"content":"选择挑战任务页-浏览","name":"maievent-page-view","type":"view","mobile":"${mobile}","openId":"${ck[1]}","unionId":"${ck[2]}","page":"/sub1/pages/challenge-select/challenge-select?type=restart","source":"wechat-default","sdk":"ha-default"}`, 131 | } 132 | $.post(url, async (error, response, data) => { 133 | try { 134 | let result = JSON.parse(data); 135 | //console.log(result) 136 | if (result.code == 200) { 137 | DoubleLog(`\n 上报请求: ✅ ,操作成功`) 138 | } else { 139 | DoubleLog(`\n 上报请求: ❌ ,原因是:${result.message}`) 140 | } 141 | } catch (e) { 142 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 143 | } finally { 144 | resolve(); 145 | } 146 | }, timeout) 147 | }) 148 | } 149 | /** 150 | * 获取任务 151 | * @param timeout 152 | * @returns {Promise} 153 | */ 154 | function getUserTask(timeout = 2000) { 155 | return new Promise((resolve) => { 156 | let url = { 157 | url: `${hostname}/healthyaging/danone/wx/clockin/getUserTask`, 158 | headers: { 159 | Host: host, 160 | 'Connection': 'keep-alive', 161 | 'User-Agent': getUA(), 162 | 'X-Access-Token': ck[0], 163 | 'Content-Type': 'application/json', 164 | }, 165 | } 166 | $.get(url, async (error, response, data) => { 167 | try { 168 | let result = JSON.parse(data); 169 | if (result.code == 200) { 170 | if(result.result[0].status == 1){ 171 | taskid1 = result.result[0].userTaskDetailId ; 172 | if(result.result[0].ruleList != false){ 173 | ruleId1 = result.result[0].ruleList[0].id ; 174 | } else { 175 | ruleId1 = result.result[0].id ; 176 | } 177 | DoubleLog(`\n 获取任务: ✅ ,${result.result[0].simpleName} 未完成`); 178 | await clickIn(ruleId1,taskid1,2 * 1000); 179 | await $.wait(5000); 180 | }else{ 181 | DoubleLog(`\n 获取任务: ❌ ,${result.result[0].simpleName} 已完成`) 182 | } 183 | if(result.result[1].status == 1){ 184 | taskid2 = result.result[1].userTaskDetailId ; 185 | if(result.result[1].ruleList != false){ 186 | ruleId2 = result.result[1].ruleList[0].id ; 187 | } else { 188 | ruleId2 = result.result[1].id ; 189 | } 190 | DoubleLog(`\n 获取任务: ✅ ,${result.result[1].simpleName} 未完成`); 191 | await clickIn(ruleId2,taskid2,2 * 1000); 192 | await $.wait(5000); 193 | }else{ 194 | DoubleLog(`\n 获取任务: ❌ ,${result.result[1].simpleName} 已完成`) 195 | } 196 | if(result.result[2].status == 1){ 197 | taskid3 = result.result[2].userTaskDetailId ; 198 | if(result.result[2].ruleList != false){ 199 | ruleId3 = result.result[2].ruleList[0].id ; 200 | } else { 201 | ruleId3 = result.result[2].id ; 202 | } 203 | DoubleLog(`\n 获取任务: ✅ ,${result.result[2].simpleName} 未完成`); 204 | await clickIn(ruleId3,taskid3,2 * 1000); 205 | await $.wait(5000); 206 | }else{ 207 | DoubleLog(`\n 获取任务: ❌ ,${result.result[2].simpleName} 已完成`) 208 | } 209 | if(result.result[3].status == 1){ 210 | taskid4 = result.result[3].userTaskDetailId ; 211 | if(result.result[3].ruleList != false){ 212 | ruleId4 = result.result[3].ruleList[0].id ; 213 | } else { 214 | ruleId4 = result.result[3].id ; 215 | } 216 | DoubleLog(`\n 获取任务: ✅ ,${result.result[3].simpleName} 未完成`); 217 | await clickIn(ruleId4,taskid4,2 * 1000); 218 | }else{ 219 | DoubleLog(`\n 获取任务: ❌ ,${result.result[3].simpleName} 已完成`) 220 | } 221 | } else { 222 | DoubleLog(`\n 获取任务: ❌ ,原因是:${result.message}`) 223 | } 224 | } catch (e) { 225 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 226 | } finally { 227 | resolve(); 228 | } 229 | }, timeout) 230 | }) 231 | } 232 | /** 233 | * 执行任务 234 | * @param timeout 235 | * @returns {Promise} 236 | */ 237 | function clickIn(ruleId,taskid,timeout = 2000) { 238 | return new Promise((resolve) => { 239 | let url = { 240 | url: `${hostname}/healthyaging/danone/wx/clockin/clickIn`, 241 | headers: { 242 | Host: host, 243 | 'Connection': 'keep-alive', 244 | 'User-Agent': getUA(), 245 | 'X-Access-Token': ck[0], 246 | 'Content-Type': 'application/json', 247 | }, 248 | body: '{"ruleIds : [ ' + ruleId + ' ],taskDataCode" : "Auto","taskDataValue" : null,"userTaskDetailId" :' + taskid + '}', 249 | } 250 | $.post(url, async (error, response, data) => { 251 | try { 252 | let result = JSON.parse(data); 253 | if (result.code == 200) { 254 | DoubleLog(`\n 执行任务: ✅ ,操作成功`) 255 | } else { 256 | DoubleLog(`\n 执行任务: ❌ ,原因是:${result.message}`) 257 | } 258 | } catch (e) { 259 | DoubleLog(`\n 信息异常: ❌ ,${response}`) 260 | } finally { 261 | resolve(); 262 | } 263 | }, timeout) 264 | }) 265 | } 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | // ============================================重写============================================ \\ 286 | async function GetRewrite() { 287 | if ($request.url.indexOf("member/api/info/?userKeys=v1.0&pageName=member-info-index-search&formName=searchForm&kwwMember.memberId") > -1) { 288 | let ck = ''; 289 | let theRequest = new Object(); 290 | if ($request.url.indexOf("?") != -1) { 291 | let info = $request.url.split('?'); 292 | let strs = info[1].split("&"); 293 | for (var i = 0; i < strs.length; i++) { 294 | theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); 295 | } 296 | ck = theRequest.memberId; 297 | } 298 | if (kwwUid) { 299 | if (memberId.indexOf(ck) == -1) { 300 | memberId = memberId + "@" + ck; 301 | $.setdata(memberId, "kwwUid"); 302 | List = memberId.split("@"); 303 | $.msg(`【${$.name}】` + ` 获取第${memberId.length}个 ck 成功: ${ck} ,不用请自行关闭重写!`); 304 | } 305 | } else { 306 | $.setdata(ck, "memberId"); 307 | $.msg(`【${$.name}】` + ` 获取第1个 ck 成功: ${ck} ,不用请自行关闭重写!`); 308 | } 309 | } 310 | } 311 | 312 | 313 | // ============================================变量检查============================================ \\ 314 | async function Envs() { 315 | if (UserCookie) { 316 | if (UserCookie.indexOf("@") != -1) { 317 | UserCookie.split("@").forEach((item) => { 318 | UserCookieArr.push(item); 319 | }); 320 | } else if (UserCookie.indexOf("\n") != -1) { 321 | UserCookie.split("\n").forEach((item) => { 322 | UserCookieArr.push(item); 323 | }); 324 | } else { 325 | UserCookieArr.push(UserCookie); 326 | } 327 | } else { 328 | console.log(`\n 乐客播提示:系统变量未填写 lekebo_mnflag_Cookie`) 329 | return; 330 | } 331 | return true; 332 | } 333 | // ============================================发送消息============================================ \\ 334 | async function SendMsg(message) { 335 | if (!message) 336 | return; 337 | 338 | if (Notify > 0) { 339 | if ($.isNode()) { 340 | var notify = require('./sendNotify'); 341 | await notify.sendNotify($.name, message); 342 | } else { 343 | $.msg(message); 344 | } 345 | } else { 346 | log(message); 347 | } 348 | } 349 | /** 350 | * 添加消息 351 | * @param str 352 | * @param is_log 353 | */ 354 | function addNotifyStr(str, is_log = true) { 355 | if (is_log) { 356 | log(`${str}\n`) 357 | } 358 | msg += `${str}\n` 359 | } 360 | /** 361 | * 双平台log输出 362 | */ 363 | function DoubleLog(data) { 364 | if ($.isNode()) { 365 | if (data) { 366 | console.log(`${data}`); 367 | msg += `${data}`; 368 | } 369 | } else { 370 | console.log(`${data}`); 371 | msg += `${data}`; 372 | } 373 | } 374 | function randomNum(min, max) { 375 | if (arguments.length === 0) return Math.random() 376 | if (!max) max = 10 ** (Math.log(min) * Math.LOG10E + 1 | 0) - 1 377 | return Math.floor(Math.random() * (max - min + 1) + min); 378 | } 379 | 380 | function DealScriptStr(str) { 381 | str = str.replace(/\/\*.*?\*\//g, ' '); 382 | str = str.replace(/\b0(\d+)/g, '0o$1'); 383 | return str; 384 | } 385 | /** 386 | * 随机UA 387 | * @param inputString 388 | * @returns {*} 389 | */ 390 | function getUA() { 391 | $.UUID = randomString(40) 392 | const buildMap = { 393 | "167814": `10.1.4`, 394 | "167841": `10.1.6`, 395 | "167853": `10.2.0` 396 | } 397 | $.osVersion = `${randomNum(13, 14)}.${randomNum(3, 6)}.${randomNum(1, 3)}` 398 | let network = `network/${['4g', '5g', 'wifi'][randomNum(0, 2)]}` 399 | $.mobile = `iPhone${randomNum(9, 13)},${randomNum(1, 3)}` 400 | $.build = ["167814", "167841", "167853"][randomNum(0, 2)] 401 | $.appVersion = buildMap[$.build] 402 | return `jdapp;iPhone;${$.appVersion};${$.osVersion};${$.UUID};M/5.0;${network};ADID/;model/${$.mobile};addressid/;appBuild/${$.build};jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS ${$.osVersion.replace(/\./g, "_")} like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1;` 403 | } 404 | 405 | /** 406 | * 随机数生成 407 | */ 408 | function randomString(e) { 409 | e = e || 32; 410 | var t = "QWERTYUIOPASDFGHJKLZXCVBNM1234567890", 411 | a = t.length, 412 | n = ""; 413 | for (i = 0; i < e; i++) 414 | n += t.charAt(Math.floor(Math.random() * a)); 415 | return n 416 | } 417 | 418 | /** 419 | * 修改配置文件 420 | */ 421 | function modify() { 422 | fs.readFile('/ql/data/config/config.sh','utf8',function(err,dataStr){ 423 | if(err){ 424 | return log('读取文件失败!'+err) 425 | } 426 | else { 427 | var result = dataStr.replace(/regular/g,string); 428 | fs.writeFile('/ql/data/config/config.sh', result, 'utf8', function (err) { 429 | if (err) {return log(err);} 430 | }); 431 | } 432 | }) 433 | } 434 | 435 | /** 436 | * 获取远程版本 437 | */ 438 | function getVersion(timeout = 3 * 1000) { 439 | return new Promise((resolve) => { 440 | let url = { 441 | url: `https://ghproxy.com/https://raw.githubusercontent.com/qq274023/lekebo/master/lekebo_kww.js`, 442 | } 443 | $.get(url, async (err, resp, data) => { 444 | try { 445 | scriptVersionLatest = data.match(/scriptVersion = "([\d\.]+)"/)[1] 446 | update_data = data.match(/update_data = "(.*?)"/)[1] 447 | } catch (e) { 448 | $.logErr(e, resp); 449 | } finally { 450 | resolve() 451 | } 452 | }, timeout) 453 | }) 454 | } 455 | 456 | // md5 457 | function MD5Encrypt(a) { function b(a, b) { return a << b | a >>> 32 - b } function c(a, b) { var c, d, e, f, g; return e = 2147483648 & a, f = 2147483648 & b, c = 1073741824 & a, d = 1073741824 & b, g = (1073741823 & a) + (1073741823 & b), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f } function d(a, b, c) { return a & b | ~a & c } function e(a, b, c) { return a & c | b & ~c } function f(a, b, c) { return a ^ b ^ c } function g(a, b, c) { return b ^ (a | ~c) } function h(a, e, f, g, h, i, j) { return a = c(a, c(c(d(e, f, g), h), j)), c(b(a, i), e) } function i(a, d, f, g, h, i, j) { return a = c(a, c(c(e(d, f, g), h), j)), c(b(a, i), d) } function j(a, d, e, g, h, i, j) { return a = c(a, c(c(f(d, e, g), h), j)), c(b(a, i), d) } function k(a, d, e, f, h, i, j) { return a = c(a, c(c(g(d, e, f), h), j)), c(b(a, i), d) } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - d % 64) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;)b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | a.charCodeAt(i) << h, i++; return b = (i - i % 4) / 4, h = i % 4 * 8, g[b] = g[b] | 128 << h, g[f - 2] = c << 3, g[f - 1] = c >>> 29, g } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++)b = a >>> 8 * c & 255, e = "0" + b.toString(16), d += e.substr(e.length - 2, 2); return d } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? b += String.fromCharCode(d) : d > 127 && 2048 > d ? (b += String.fromCharCode(d >> 6 | 192), b += String.fromCharCode(63 & d | 128)) : (b += String.fromCharCode(d >> 12 | 224), b += String.fromCharCode(d >> 6 & 63 | 128), b += String.fromCharCode(63 & d | 128)) } return b } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16)p = t, q = u, r = v, s = w, t = h(t, u, v, w, x[o + 0], y, 3614090360), w = h(w, t, u, v, x[o + 1], z, 3905402710), v = h(v, w, t, u, x[o + 2], A, 606105819), u = h(u, v, w, t, x[o + 3], B, 3250441966), t = h(t, u, v, w, x[o + 4], y, 4118548399), w = h(w, t, u, v, x[o + 5], z, 1200080426), v = h(v, w, t, u, x[o + 6], A, 2821735955), u = h(u, v, w, t, x[o + 7], B, 4249261313), t = h(t, u, v, w, x[o + 8], y, 1770035416), w = h(w, t, u, v, x[o + 9], z, 2336552879), v = h(v, w, t, u, x[o + 10], A, 4294925233), u = h(u, v, w, t, x[o + 11], B, 2304563134), t = h(t, u, v, w, x[o + 12], y, 1804603682), w = h(w, t, u, v, x[o + 13], z, 4254626195), v = h(v, w, t, u, x[o + 14], A, 2792965006), u = h(u, v, w, t, x[o + 15], B, 1236535329), t = i(t, u, v, w, x[o + 1], C, 4129170786), w = i(w, t, u, v, x[o + 6], D, 3225465664), v = i(v, w, t, u, x[o + 11], E, 643717713), u = i(u, v, w, t, x[o + 0], F, 3921069994), t = i(t, u, v, w, x[o + 5], C, 3593408605), w = i(w, t, u, v, x[o + 10], D, 38016083), v = i(v, w, t, u, x[o + 15], E, 3634488961), u = i(u, v, w, t, x[o + 4], F, 3889429448), t = i(t, u, v, w, x[o + 9], C, 568446438), w = i(w, t, u, v, x[o + 14], D, 3275163606), v = i(v, w, t, u, x[o + 3], E, 4107603335), u = i(u, v, w, t, x[o + 8], F, 1163531501), t = i(t, u, v, w, x[o + 13], C, 2850285829), w = i(w, t, u, v, x[o + 2], D, 4243563512), v = i(v, w, t, u, x[o + 7], E, 1735328473), u = i(u, v, w, t, x[o + 12], F, 2368359562), t = j(t, u, v, w, x[o + 5], G, 4294588738), w = j(w, t, u, v, x[o + 8], H, 2272392833), v = j(v, w, t, u, x[o + 11], I, 1839030562), u = j(u, v, w, t, x[o + 14], J, 4259657740), t = j(t, u, v, w, x[o + 1], G, 2763975236), w = j(w, t, u, v, x[o + 4], H, 1272893353), v = j(v, w, t, u, x[o + 7], I, 4139469664), u = j(u, v, w, t, x[o + 10], J, 3200236656), t = j(t, u, v, w, x[o + 13], G, 681279174), w = j(w, t, u, v, x[o + 0], H, 3936430074), v = j(v, w, t, u, x[o + 3], I, 3572445317), u = j(u, v, w, t, x[o + 6], J, 76029189), t = j(t, u, v, w, x[o + 9], G, 3654602809), w = j(w, t, u, v, x[o + 12], H, 3873151461), v = j(v, w, t, u, x[o + 15], I, 530742520), u = j(u, v, w, t, x[o + 2], J, 3299628645), t = k(t, u, v, w, x[o + 0], K, 4096336452), w = k(w, t, u, v, x[o + 7], L, 1126891415), v = k(v, w, t, u, x[o + 14], M, 2878612391), u = k(u, v, w, t, x[o + 5], N, 4237533241), t = k(t, u, v, w, x[o + 12], K, 1700485571), w = k(w, t, u, v, x[o + 3], L, 2399980690), v = k(v, w, t, u, x[o + 10], M, 4293915773), u = k(u, v, w, t, x[o + 1], N, 2240044497), t = k(t, u, v, w, x[o + 8], K, 1873313359), w = k(w, t, u, v, x[o + 15], L, 4264355552), v = k(v, w, t, u, x[o + 6], M, 2734768916), u = k(u, v, w, t, x[o + 13], N, 1309151649), t = k(t, u, v, w, x[o + 4], K, 4149444226), w = k(w, t, u, v, x[o + 11], L, 3174756917), v = k(v, w, t, u, x[o + 2], M, 718787259), u = k(u, v, w, t, x[o + 9], N, 3951481745), t = c(t, p), u = c(u, q), v = c(v, r), w = c(w, s); var O = m(t) + m(u) + m(v) + m(w); return O.toLowerCase() } 458 | // 完整 Env 459 | 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) } 460 | --------------------------------------------------------------------------------