├── README.md ├── check.js ├── common.js ├── common北渡.js ├── ele_2048.js ├── ele_assest.py ├── ele_femf.js ├── ele_hctmm.js ├── ele_kpbl.py ├── ele_lgqs.py ├── ele_lyb.js ├── ele_mst.js ├── ele_nc.py ├── ele_tiao.py ├── ele_tjcs.js ├── elm.sh ├── elm_lyb.js ├── package.json ├── ql.js ├── sendNotify1.js ├── set_elmenv.sh ├── 吃货豆.py ├── 总裁.js ├── 饿了么本 By北渡.zip ├── 饿了么贪吃.py └── 饿了么资产推送.js /README.md: -------------------------------------------------------------------------------- 1 | # elm 2 | 饿了么游乐园乐园币获取程序 3 | -------------------------------------------------------------------------------- /check.js: -------------------------------------------------------------------------------- 1 | const { 2 | getEnvsByName, 3 | DisableCk, 4 | EnableCk, 5 | updateEnv, 6 | updateEnv11, 7 | getEnvByUserId 8 | } = require("./ql"); 9 | 10 | const { 11 | wait, 12 | checkCk, 13 | validateCarmeWithType, 14 | invalidCookieNotify, 15 | getUserInfo, 16 | runOne, 17 | getCookieMap 18 | } = require("./common.js"); 19 | 20 | const _0x11f78e = require("moment"); 21 | 22 | function _0x543ec4(_0x3fdeea, _0x4dabab) { 23 | return Math.floor(Math.random() * (_0x4dabab - _0x3fdeea + 1) + _0x3fdeea); 24 | } 25 | 26 | function reorderCookie(s) { 27 | const order = ["cookie2", "sgcookie", "unb", "USERID", "SID", "token", "utdid", "deviceId", "umt", "phone", "pwd"]; 28 | const cookies = s.split(';'); 29 | const cookieDict = {}; 30 | 31 | cookies.forEach(cookie => { 32 | const keyValue = cookie.split('=', 2); 33 | if (keyValue.length === 2) { 34 | const key = keyValue[0].trim(); 35 | const value = keyValue[1].trim(); 36 | cookieDict[key] = value; 37 | } 38 | }); 39 | 40 | const reorderedCookies = []; 41 | 42 | order.forEach(key => { 43 | if (cookieDict.hasOwnProperty(key)) { 44 | reorderedCookies.push(`${key}=${cookieDict[key]}`); 45 | } 46 | }); 47 | 48 | return reorderedCookies.join(';') + ';'; 49 | } 50 | 51 | function _0x389941(_0x1daaab) { 52 | let _0x59299c = ""; 53 | 54 | for (let [_0x7cf76, _0x5050e8] of _0x1daaab) { 55 | _0x59299c += _0x7cf76 + "=" + _0x5050e8 + ";"; 56 | } 57 | 58 | return _0x59299c; 59 | } 60 | 61 | async function _0x179175(data, context, options) { 62 | let result1 = await runOne(context, options); 63 | const msg = result1.msg; 64 | const responseData = result1.result; 65 | 66 | if (responseData) { 67 | if (responseData.code === 3000) { 68 | let parsedData = JSON.parse(responseData.returnValue.data); 69 | let token = parsedData.autoLoginToken; 70 | let cookie2 = responseData.returnValue.sid; 71 | let unb = responseData.returnValue.hid; 72 | const expiryTimestamp = parsedData.expires; 73 | const expiryDate = _0x11f78e(expiryTimestamp * 1000).format("YYYY-MM-DD HH:mm:ss"); 74 | 75 | let cookieMap = getCookieMap(context); 76 | let updatedContext = await runOne(context, cookieMap.get("SID")); 77 | 78 | if (!updatedContext) { 79 | return; 80 | } 81 | 82 | cookieMap.set('cookie2', cookie2); 83 | cookieMap.set('token', token); 84 | cookieMap.set('unb', unb); 85 | 86 | let ck666 = _0x389941(cookieMap); 87 | let updatedEnvironment = reorderCookie(ck666); 88 | 89 | if (data.id) { 90 | await updateEnv11(updatedEnvironment, data.id, data.remarks); 91 | } else { 92 | await updateEnv(updatedEnvironment, data._id, data.remarks); 93 | } 94 | 95 | let userID = cookieMap.get("USERID"); 96 | let userEnvironment = await getEnvByUserId(userID); 97 | 98 | let successMessage = `${msg}: ${expiryDate}`; 99 | console.log(successMessage); 100 | return successMessage; 101 | } else { 102 | if (responseData.message) { 103 | console.log(responseData.message); 104 | } else { 105 | console.log(response.ret[0]); 106 | } 107 | return null; 108 | } 109 | } else { 110 | console.log(msg); 111 | } 112 | } 113 | 114 | 115 | (async function _0x1f3fe2() { 116 | const aleo = process.env.ELE_CARME; 117 | await validateCarmeWithType(aleo, 1); 118 | const pragati = await getEnvsByName("elmck"); 119 | for (let mackala = 0; mackala < pragati.length; mackala++) { 120 | let athel = pragati[mackala].value; 121 | if (!athel) { 122 | console.log(" ❌无效用户信息, 请重新获取ck"); 123 | } else { 124 | try { 125 | var houda = 0; 126 | if (pragati[mackala]._id) { 127 | houda = pragati[mackala]._id; 128 | } 129 | if (pragati[mackala].id) { 130 | houda = pragati[mackala].id; 131 | } 132 | athel = athel.replace(/\s/g, ""); 133 | let lavante = await checkCk(athel, mackala); 134 | if (!lavante) { 135 | let deshaune = await _0x179175(pragati[mackala], athel); 136 | if (deshaune && deshaune.indexOf("刷新成功") !== -1) { 137 | await EnableCk(houda); 138 | console.log("第", mackala + 1, "账号正常😁\n"); 139 | } else { 140 | const lakeyah = await DisableCk(houda); 141 | if (lakeyah.code === 200) { 142 | console.log("第", mackala + 1, "账号失效!已🈲用"); 143 | } else { 144 | console.log("第", mackala + 1, "账号失效!请重新登录!!!😭"); 145 | } 146 | await invalidCookieNotify(athel, pragati[mackala].remarks); 147 | } 148 | } else { 149 | let amirr = await getUserInfo(athel); 150 | if (!amirr.encryptMobile) { 151 | let rudolphe = await _0x179175(pragati[mackala], athel); 152 | if (rudolphe && rudolphe.indexOf("刷新成功") !== -1) { 153 | await EnableCk(houda); 154 | console.log("第", mackala + 1, "账号正常😁\n"); 155 | } else { 156 | const jericca = await DisableCk(houda); 157 | if (jericca.code === 200) { 158 | console.log("第", mackala + 1, "账号失效!已🈲用"); 159 | } else { 160 | console.log("第", mackala + 1, "账号失效!请重新登录!!!😭"); 161 | } 162 | } 163 | await invalidCookieNotify(athel, pragati[mackala].remarks); 164 | } else { 165 | await _0x179175(pragati[mackala], athel, getCookieMap(athel).get("SID")); 166 | await EnableCk(houda); 167 | console.log("第", mackala + 1, "账号正常🎉🎉\n"); 168 | } 169 | } 170 | } catch (hannelore) { 171 | console.log(hannelore); 172 | } 173 | } 174 | await wait(_0x543ec4(1, 3)); 175 | } 176 | process.exit(0); 177 | }()); 178 | 179 | -------------------------------------------------------------------------------- /ele_assest.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import random 4 | import datetime 5 | import requests 6 | from urllib.parse import quote 7 | 8 | host = 'https://acs.m.goofish.com' 9 | xsign_host = "接口" 10 | 11 | class LYB: 12 | def __init__(self, cki): 13 | self.ck1 = self.tq(cki) 14 | self.ck = cki 15 | 16 | def tq(self, txt): 17 | try: 18 | txt = txt.replace(" ", "") 19 | pairs = txt.split(";")[:-1] 20 | ck_json = {i.split("=")[0]: i.split("=")[1] for i in pairs} 21 | return ck_json 22 | except Exception as e: 23 | print(f"", end="") 24 | return {} 25 | 26 | def xsign(self, api, data, uid, sid, wua, v): 27 | body = { 28 | "data": data, 29 | "api": api, 30 | "pageId": '', 31 | "uid": uid, 32 | 'sid': sid, 33 | "deviceId": '', 34 | "utdid": '', 35 | "wua": wua, 36 | 'ttid': '1551089129819@eleme_android_10.14.3', 37 | "v": v 38 | } 39 | 40 | try: 41 | r = requests.post( 42 | xsign_host, 43 | json=body 44 | ) 45 | r.raise_for_status() 46 | return r.json() 47 | except requests.exceptions.HTTPError as e: 48 | print(f'❎请求签名服务器失败: {e}') 49 | return None 50 | except requests.exceptions.RequestException as e: 51 | print(f'❎请求签名服务器错误: {e}') 52 | return None 53 | 54 | def req(self, api, data, uid, sid, wua='False', v="1.0"): 55 | try: 56 | if type(data) == dict: 57 | data = json.dumps(data) 58 | wua = str(wua) 59 | sign = self.xsign(api, data, uid, sid, wua, v) 60 | url = f"{host}/gw/{api}/{v}/" 61 | headers = { 62 | "x-sgext": quote(sign.get('x-sgext')), 63 | "x-sign": quote(sign.get('x-sign')), 64 | 'x-sid': sid, 65 | 'x-uid': uid, 66 | 'x-sv': '3.3.0', 67 | 'x-pv': '6.3', 68 | 'x-features': '1051', 69 | 'x-mini-wua': quote(sign.get('x-mini-wua')), 70 | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 71 | 'x-t': sign.get('x-t'), 72 | 'x-umt': sign.get('x-umt'), 73 | 'x-extdata': 'openappkey%3DDEFAULT_AUTH', 74 | 'x-ttid': '1551089129819@eleme_android_10.14.3', 75 | 'x-utdid': '', 76 | 'x-appkey': '24895413', 77 | 'x-devid': '', 78 | } 79 | 80 | params = {"data": data} 81 | if 'wua' in sign: 82 | params["wua"] = sign.get('wua') 83 | 84 | max_retries = 5 85 | retries = 0 86 | while retries < max_retries: 87 | try: 88 | res = requests.post(url, headers=headers, data=params, timeout=5) 89 | return res 90 | except requests.exceptions.Timeout: 91 | print("❎接口请求超时") 92 | except requests.exceptions.RequestException as e: 93 | print(f"❎请求异常: {e}") 94 | retries += 1 95 | print(f"❎重试次数: {retries}") 96 | if retries >= max_retries: 97 | print("❎重试次数上限") 98 | return None 99 | except Exception as e: 100 | print(f'❎请求接口失败: {e}') 101 | return None 102 | 103 | def yqm(self): 104 | if 'ZL_CK' in os.environ: 105 | cki = self.tq(os.environ.get('ZL_CK')) 106 | else: 107 | cki = self.tq(self.ck) 108 | if not cki: 109 | print("❎被助力账号为空,请设置后再运行") 110 | return None, None 111 | uid = cki.get("unb") 112 | sid = cki.get("cookie2") 113 | 114 | api = 'mtop.ele.biz.growth.task.core.querytask' 115 | data = json.dumps({"missionCollectionId": "839", 116 | "locationInfos": "[\"{\\\"lng\\\":\\\"105.75325090438128\\\",\\\"lat\\\":\\\"30.597472842782736\\\"}\"]", 117 | "bizScene": "game_center", "accountPlan": "HAVANA_COMMON"}) 118 | try: 119 | res = self.req(api, data, uid, sid, "1.0") 120 | if res is None: 121 | return None, None 122 | if res.json()["ret"][0] == "SUCCESS::接口调用成功": 123 | mlist = res.json()["data"]['mlist'] 124 | for item in mlist: 125 | if 'actionConfig' in item and 'ext' in item['actionConfig']: 126 | actid = item['actionConfig']['ext']['actId'] 127 | shareId = item['actionConfig']['ext']['shareId'] 128 | return actid, shareId 129 | elif res.json()["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 130 | print("❎ck过期", end=' ') 131 | return None, None 132 | else: 133 | print(res.text) 134 | except Exception as e: 135 | print(f'❎请求错误: {e}') 136 | print("❎获取助力id失败\n") 137 | return None, None 138 | 139 | def share(self, actid1, shareId1, usid): 140 | cki = self.ck1 141 | uid = cki.get("unb") 142 | sid = cki.get("cookie2") 143 | api = 'mtop.koubei.interactioncenter.share.common.triggershare' 144 | data = json.dumps( 145 | {"actId": actid1, "shareId": shareId1, "bizScene": "DEFAULT", "requestId": "1719848804784"}) 146 | try: 147 | res = self.req(api, data, uid, sid, "1.0") 148 | if res is None: 149 | return None 150 | if res.json()["ret"][0] == "SUCCESS::调用成功": 151 | print(f"✅助力成功\n") 152 | return True 153 | else: 154 | if res.json()["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 155 | ck_updated = self.update_ck(cki) 156 | if not ck_updated: 157 | print(f"❎助力ck过期\n") 158 | return False 159 | else: 160 | return self.share(actid1, shareId1, usid) 161 | else: 162 | if res.json()["data"]['errorMsg'] == "助力次数已用完": 163 | print(f"❎助力次数已用完", end="\n") 164 | return False 165 | if res.json()["data"]['errorMsg'] == "今日助力次数已用完": 166 | print(f"❎莫得次数咯", end="\n") 167 | return False 168 | if res.json()["data"]['errorMsg'] == " 人传人关系已达上限": 169 | print(f"❎助力上限", end="\n") 170 | return 'SX' 171 | if res.json()["data"]['errorMsg'] == "分享者已被助力成功,客态重复助力": 172 | print(f"❎重复助力", end="\n") 173 | return None 174 | else: 175 | print(f"❎助力失败", end="\n") 176 | print(res.text) 177 | return None 178 | except Exception as e: 179 | print(f'请求错误: {e}') 180 | return None 181 | 182 | def prize(self): 183 | if 'ZL_CK' in os.environ: 184 | cki = self.tq(os.environ.get('ZL_CK')) 185 | else: 186 | cki = self.tq(self.ck) 187 | if not cki: 188 | print("被助力账号为空,请设置后再运行") 189 | return 190 | uid = cki.get("unb") 191 | sid = cki.get("cookie2") 192 | api1 = 'mtop.ele.biz.growth.task.core.querytask' 193 | data1 = json.dumps({"missionCollectionId": "839", 194 | "locationInfos": "[\"{\\\"lng\\\":\\\"105.75325090438128\\\",\\\"lat\\\":\\\"30.597472842782736\\\"}\"]", 195 | "bizScene": "game_center", "accountPlan": "HAVANA_COMMON"}) 196 | try: 197 | res1 = self.req(api1, data1, uid, sid, "1.0") 198 | if res1 is None: 199 | return 200 | if res1.json()["ret"][0] == "SUCCESS::接口调用成功": 201 | for y in res1.json()['data']['mlist']: 202 | if y['name'] == "邀请好友助力": 203 | for o in y['missionStageDTOS']: 204 | if o['rewardStatus'] == "TODO" and o['status'] == "FINISH": 205 | api = 'mtop.ele.biz.growth.task.core.receiveprize' 206 | data2 = json.dumps({ 207 | "missionCollectionId": "839", 208 | "missionId": "20544001", 209 | "count": o['stageCount'] 210 | }) 211 | try: 212 | res = self.req(api, data2, uid, sid, "1.0") 213 | if res is None: 214 | continue 215 | data = res.json()["data"] 216 | if data.get('errorMsg') is not None: 217 | print(f"❎领取奖励失败: {data['errorMsg']}\n") 218 | else: 219 | rlist = data.get('rlist') 220 | if rlist is not None: 221 | print(f"✅领取奖励成功--{rlist[0]['value']}乐园币", end="\n") 222 | else: 223 | print(f"❎{res.json()['ret'][0]}") 224 | except Exception as e: 225 | print(f'请求错误: {e}') 226 | continue 227 | else: 228 | if res1.json()["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 229 | print(f"") 230 | else: 231 | print(f"❎获取列表失败:", res1.json()["data"]['errorMsg']) 232 | except Exception as e: 233 | print(f'请求错误: {e}') 234 | return 235 | 236 | def update_ck(self, cki): 237 | ck = self.ck 238 | update_url = "http://47.98.134.8:14499/elmxq" 239 | data = {'cookie': ck} 240 | response = requests.post(update_url, json=data) 241 | if response and response.status_code == 200: 242 | result = response.json() 243 | if result.get('message') == '刷新成功': 244 | expirationTime = result.get('expirationTime') 245 | print(f'cookie续期成功:{expirationTime}', end="\n") 246 | self.ck = result.get('cookie') 247 | self.ck1 = self.tq(self.ck) 248 | return True 249 | elif result.get('message') == '刷新失败': 250 | print(f'cookie续期失败') 251 | return False 252 | 253 | 254 | 255 | def get_ck_usid(ck): 256 | ck1 = ck.replace("==","") 257 | key_value_pairs = ck1.split(";") 258 | for pair in key_value_pairs: 259 | if '=' not in pair: 260 | continue 261 | key, value = pair.split("=") 262 | if key == "USERID": 263 | return value 264 | return None 265 | 266 | 267 | if __name__ == '__main__': 268 | today = datetime.date.today() 269 | today_str = today.strftime('%Y%m%d') 270 | filename = f'{today_str}.json' 271 | 272 | if not os.path.exists(filename): 273 | with open(filename, 'w') as f: 274 | json.dump({}, f) 275 | print("今日助力json文件不存在,已创建") 276 | else: 277 | print("今日助力json文件已存在") 278 | 279 | with open(filename, 'r') as file: 280 | data = json.load(file) 281 | 282 | 283 | ck = os.environ.get('elmck') 284 | ck_list = ck.split("&") if ck else [] 285 | random.shuffle(ck_list) 286 | print(f"获取到 {len(ck_list)} 个随机打乱顺序的助力账号") 287 | 288 | zlck = os.environ.get('elmzlck') 289 | zlck_list = zlck.split("&") if zlck else [] 290 | print(f"获取到 {len(zlck_list)} 个被助力账号") 291 | 292 | for dzl_num, zlck in enumerate(zlck_list, start=1): 293 | lyb = LYB(zlck) 294 | actid, shareId = lyb.yqm() 295 | if actid is None or shareId is None: 296 | print("❎获取助力id失败\n") 297 | continue 298 | print(f"🐂🍺>>>开始给第{dzl_num}/{len(ck_list)}个账号助力->获取邀请码成功->>") 299 | 300 | for i, ck in enumerate(ck_list): 301 | if len(ck) >200: 302 | usid = get_ck_usid(ck) 303 | zlcs = data.get(f"{usid}", 0) 304 | if zlcs < 3: 305 | print(f">>>第{i + 1}个", end="") 306 | try: 307 | a = LYB(ck).share(actid, shareId, usid) 308 | if a is None: 309 | continue 310 | elif a == 'SX': 311 | 312 | break 313 | else: 314 | data[f"{usid}"] = zlcs + 1 315 | with open(filename, 'w') as file: 316 | json.dump(data, file, indent=4) 317 | 318 | except Exception as e: 319 | print(f"❎助力时发生错误: {e}") 320 | continue 321 | else: 322 | print("网页CK,暂时跳过\n") 323 | print("\n======助力结束,领取奖励======") 324 | 325 | try: 326 | lyb.prize() 327 | except Exception as e: 328 | print(f"❎领取奖励时发生错误: {e}") 329 | print(f"======被助力账号{dzl_num}-助力结束======\n") 330 | 331 | -------------------------------------------------------------------------------- /ele_femf.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 变量:elmck: 必填,账号cookie, 3 | * cron 0 5 5 * * * 4 | * 2023.8.9 更新:首次发布; 5 | */ 6 | 7 | const $ = new Env('枫叶_饿了么福尔魔方'); 8 | 9 | const { 10 | validateCarmeWithType: _0x4cfa40, 11 | getCookies: _0x313a08, 12 | //getUserInfoWithX: _0x4a4a5b, 13 | wait: _0x5ad5ca, 14 | commonRequest: _0x5f380f, 15 | getCoordinates, 16 | sign, 17 | getToken, 18 | checkCk, 19 | tryCatchPromise 20 | } = require("./common.js"), 21 | request = require("request"), 22 | _0x57253e = process.env.ELE_CARME, 23 | _0x1c5d9a = 16; 24 | async function h5Req(_0x435d5d, _0x5231fc) { 25 | const _0x9519bd = { 26 | authority: "shopping.ele.me", 27 | accept: "application/json", 28 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 29 | "cache-control": "no-cache", 30 | "content-type": "application/x-www-form-urlencoded", 31 | origin: "https://r.ele.me", 32 | pragma: "no-cache", 33 | referer: "https://r.ele.me/linkgame/index.html?navType=3&spm-pre=a2ogi.13162730.zebra-ele-login-module-9089118186&spm=a13.b_activity_kb_m71293.0.0", 34 | cookie: _0x435d5d, 35 | //"x-ele-ua": "RenderWay/H5 AppName/wap Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36", 36 | //"user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" 37 | }, 38 | _0x395caf = new Date().getTime(), 39 | _0xc3123 = 12574478; 40 | var _0x262d46 = "data=" + encodeURIComponent(JSON.stringify(_0x5231fc)); 41 | const _0x3d0021 = getToken(_0x435d5d), 42 | _0x15dbe5 = _0x3d0021.split("_")[0], 43 | _0x4c2b9e = await sign(_0x15dbe5 + "&" + _0x395caf + "&" + _0xc3123 + "&" + JSON.stringify(_0x5231fc), process.env.ELE_CARME), 44 | _0xb036ce = { 45 | url: "https://shopping.ele.me/h5/mtop.koubei.interactioncenter.platform.right.lottery/1.0/?jsv=2.6.1&appKey=12574478&t=" + _0x395caf + "&sign=" + _0x4c2b9e + "&api=mtop.koubei.interactioncenter.platform.right.lottery&v=1.0&type=originaljson&dataType=json&timeout=5000&subDomain=shopping&mainDomain=ele.me&H5Request=true&pageDomain=ele.me&ttid=h5%40chrome_android_87.0.4280.141&SV=5.0", 46 | method: "POST", 47 | headers: _0x9519bd, 48 | body: _0x262d46 49 | }; 50 | return tryCatchPromise(_0x2a583b => { 51 | request(_0xb036ce, (_0x50c447, _0x3d3170, _0x300d49) => { 52 | _0x2a583b(JSON.parse(_0x300d49)); 53 | }); 54 | }); 55 | } 56 | async function initEnv(_0x22eacf, _0x47cef2, _0x48ccf4) { 57 | const _0xa1af4f = _0x57253e, 58 | _0x1b31ad = { 59 | method: "POST", 60 | url: process.env.HOST + "/check/getumtid", 61 | headers: { 62 | "user-agent": "Apifox/1.0.0 (imsb)", 63 | "content-type": "application/json" 64 | }, 65 | body: JSON.stringify({ 66 | carmi: _0xa1af4f, 67 | latitude: _0x47cef2, 68 | longitude: _0x48ccf4 69 | }) 70 | }; 71 | return tryCatchPromise(_0xdd0ccd => { 72 | request(_0x1b31ad, async (_0x135abe, _0x20c566, _0x5661a4) => { 73 | if (!_0x135abe && _0x20c566.statusCode === 200) { 74 | _0x5661a4 = JSON.parse(_0x5661a4); 75 | _0x5661a4.code === 20000 ? _0xdd0ccd(_0x5661a4.data) : (console.log(_0x5661a4.message), _0xdd0ccd()); 76 | } else { 77 | console.log(_0x135abe || _0x5661a4); 78 | _0xdd0ccd(); 79 | } 80 | }); 81 | }); 82 | } 83 | async function _0x109797(_0x59c2bc, _0x44a872) { 84 | const _0x182bf2 = new Date().getTime(), 85 | // //{ 86 | // latitude: _0x43c809, 87 | // longitude: _0x3192bc 88 | // } = await getCoordinates(), 89 | // { 90 | // UA: _0x1f9588, 91 | // umidtoken: _0x2ce074 92 | // } = await initEnv("", _0x43c809, _0x3192bc), 93 | _0x401a77 = { 94 | bizScene: "MAGIC_CUBE", 95 | //latitude: _0x43c809, 96 | //longitude: _0x3192bc, 97 | bizCode: "MAGIC_CUBE", 98 | actId: "20230802212526123181213864", 99 | collectionId: "20230802212526148986536967", 100 | componentId: "20230803112141370370827352", 101 | extParams: "{\\\"actId\\\":\\\"20230802212526123181213864\\\",\\\"bizScene\\\":\\\"MAGIC_CUBE\\\",\\\"desc\\\":\\\"魔方消消乐\\\"}", 102 | requestId: "20230802212526123181213864" + _0x182bf2 + "", 103 | //ua: _0x1f9588, 104 | //umidToken: _0x2ce074, 105 | asac: "2A22C0239QW1FOL3UUQY7U" 106 | }; 107 | try { 108 | const _0x445d66 = await h5Req(_0x59c2bc, _0x401a77); 109 | if (_0x445d66.data.data.errorMsg) { 110 | console.log(_0x445d66.data.data.errorMsg); 111 | return false; 112 | } else { 113 | const _0x282c4a = _0x445d66.data.data.sendRightList[0].discountInfo.amount; 114 | console.log("福尔魔方闯关成功。获得:" + _0x282c4a, "乐园币"); 115 | return _0x282c4a !== 1; 116 | } 117 | } catch (_0x31b031) { 118 | return false; 119 | } 120 | } 121 | async function _0x12d072() { 122 | await _0x4cfa40(_0x57253e, 1); 123 | const _0x1b7a0a = _0x313a08("elmck"); 124 | for (let _0x5c83c6 = 0; _0x5c83c6 < _0x1b7a0a.length; _0x5c83c6++) { 125 | let _0x24b3c4 = _0x1b7a0a[_0x5c83c6], 126 | //_0x2dd844 = await _0x4a4a5b(_0x24b3c4, _0x1c5d9a), 127 | _0x460a66 = await checkCk(_0x24b3c4, _0x5c83c6, process.env.ELE_CARME); 128 | 129 | 130 | 131 | 132 | 133 | await _0x109797(_0x460a66); 134 | console.log("防止挤爆了,延时 1 秒"); 135 | await _0x5ad5ca(1); 136 | } 137 | process.exit(0); 138 | } 139 | _0x12d072(); 140 | function Env(t, e) { 141 | "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); 142 | class s { 143 | constructor(t) { 144 | this.env = t; 145 | } 146 | send(t, e = "GET") { 147 | t = "string" == typeof t ? { 148 | url: t 149 | } : t; 150 | let s = this.get; 151 | "POST" === e && (s = this.post); 152 | return new Promise((e, i) => { 153 | s.call(this, t, (t, s, r) => { 154 | t ? i(t) : e(s); 155 | }); 156 | }); 157 | } 158 | get(t) { 159 | return this.send.call(this.env, t); 160 | } 161 | post(t) { 162 | return this.send.call(this.env, t, "POST"); 163 | } 164 | } 165 | return new class { 166 | constructor(t, e) { 167 | this.name = t; 168 | this.http = new s(this); 169 | this.data = null; 170 | this.dataFile = "box.dat"; 171 | this.logs = []; 172 | this.isMute = !1; 173 | this.isNeedRewrite = !1; 174 | this.logSeparator = "\n"; 175 | this.startTime = new Date().getTime(); 176 | Object.assign(this, e); 177 | this.log("", `??${this.name}, 开始!`); 178 | } 179 | isNode() { 180 | return "undefined" != typeof module && !!module.exports; 181 | } 182 | isQuanX() { 183 | return "undefined" != typeof $task; 184 | } 185 | isSurge() { 186 | return "undefined" != typeof $httpClient && "undefined" == typeof $loon; 187 | } 188 | isLoon() { 189 | return "undefined" != typeof $loon; 190 | } 191 | toObj(t, e = null) { 192 | try { 193 | return JSON.parse(t); 194 | } catch { 195 | return e; 196 | } 197 | } 198 | toStr(t, e = null) { 199 | try { 200 | return JSON.stringify(t); 201 | } catch { 202 | return e; 203 | } 204 | } 205 | getjson(t, e) { 206 | let s = e; 207 | const i = this.getdata(t); 208 | if (i) { 209 | try { 210 | s = JSON.parse(this.getdata(t)); 211 | } catch {} 212 | } 213 | return s; 214 | } 215 | setjson(t, e) { 216 | try { 217 | return this.setdata(JSON.stringify(t), e); 218 | } catch { 219 | return !1; 220 | } 221 | } 222 | getScript(t) { 223 | return new Promise(e => { 224 | this.get({ 225 | url: t 226 | }, (t, s, i) => e(i)); 227 | }); 228 | } 229 | runScript(t, e) { 230 | return new Promise(s => { 231 | let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); 232 | i = i ? i.replace(/\n/g, "").trim() : i; 233 | let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); 234 | r = r ? 1 * r : 20; 235 | r = e && e.timeout ? e.timeout : r; 236 | const [o, h] = i.split("@"), 237 | n = { 238 | url: `http://${h}/v1/scripting/evaluate`, 239 | body: { 240 | script_text: t, 241 | mock_type: "cron", 242 | timeout: r 243 | }, 244 | headers: { 245 | "X-Key": o, 246 | Accept: "*/*" 247 | } 248 | }; 249 | this.post(n, (t, e, i) => s(i)); 250 | }).catch(t => this.logErr(t)); 251 | } 252 | loaddata() { 253 | if (!this.isNode()) { 254 | return {}; 255 | } 256 | { 257 | this.fs = this.fs ? this.fs : require("fs"); 258 | this.path = this.path ? this.path : require("path"); 259 | const t = this.path.resolve(this.dataFile), 260 | e = this.path.resolve(process.cwd(), this.dataFile), 261 | s = this.fs.existsSync(t), 262 | i = !s && this.fs.existsSync(e); 263 | if (!s && !i) { 264 | return {}; 265 | } 266 | { 267 | const i = s ? t : e; 268 | try { 269 | return JSON.parse(this.fs.readFileSync(i)); 270 | } catch (t) { 271 | return {}; 272 | } 273 | } 274 | } 275 | } 276 | writedata() { 277 | if (this.isNode()) { 278 | this.fs = this.fs ? this.fs : require("fs"); 279 | this.path = this.path ? this.path : require("path"); 280 | const t = this.path.resolve(this.dataFile), 281 | e = this.path.resolve(process.cwd(), this.dataFile), 282 | s = this.fs.existsSync(t), 283 | i = !s && this.fs.existsSync(e), 284 | r = JSON.stringify(this.data); 285 | s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r); 286 | } 287 | } 288 | lodash_get(t, e, s) { 289 | const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); 290 | let r = t; 291 | for (const t of i) if (r = Object(r)[t], void 0 === r) { 292 | return s; 293 | } 294 | return r; 295 | } 296 | lodash_set(t, e, s) { 297 | 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); 298 | } 299 | getdata(t) { 300 | let e = this.getval(t); 301 | if (/^@/.test(t)) { 302 | const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), 303 | r = s ? this.getval(s) : ""; 304 | if (r) { 305 | try { 306 | const t = JSON.parse(r); 307 | e = t ? this.lodash_get(t, i, "") : e; 308 | } catch (t) { 309 | e = ""; 310 | } 311 | } 312 | } 313 | return e; 314 | } 315 | setdata(t, e) { 316 | let s = !1; 317 | if (/^@/.test(e)) { 318 | const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), 319 | o = this.getval(i), 320 | h = i ? "null" === o ? null : o || "{}" : "{}"; 321 | try { 322 | const e = JSON.parse(h); 323 | this.lodash_set(e, r, t); 324 | s = this.setval(JSON.stringify(e), i); 325 | } catch (e) { 326 | const o = {}; 327 | this.lodash_set(o, r, t); 328 | s = this.setval(JSON.stringify(o), i); 329 | } 330 | } else { 331 | s = this.setval(t, e); 332 | } 333 | return s; 334 | } 335 | getval(t) { 336 | 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; 337 | } 338 | setval(t, e) { 339 | 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; 340 | } 341 | initGotEnv(t) { 342 | this.got = this.got ? this.got : require("got"); 343 | this.cktough = this.cktough ? this.cktough : require("tough-cookie"); 344 | this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar(); 345 | t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)); 346 | } 347 | get(t, e = () => {}) { 348 | t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]); 349 | this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 350 | "X-Surge-Skip-Scripting": !1 351 | })), $httpClient.get(t, (t, s, i) => { 352 | !t && s && (s.body = i, s.statusCode = s.status); 353 | e(t, s, i); 354 | })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 355 | hints: !1 356 | })), $task.fetch(t).then(t => { 357 | const { 358 | statusCode: s, 359 | statusCode: i, 360 | headers: r, 361 | body: o 362 | } = t; 363 | e(null, { 364 | status: s, 365 | statusCode: i, 366 | headers: r, 367 | body: o 368 | }, o); 369 | }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { 370 | try { 371 | if (t.headers["set-cookie"]) { 372 | const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); 373 | s && this.ckjar.setCookieSync(s, null); 374 | e.cookieJar = this.ckjar; 375 | } 376 | } catch (t) { 377 | this.logErr(t); 378 | } 379 | }).then(t => { 380 | const { 381 | statusCode: s, 382 | statusCode: i, 383 | headers: r, 384 | body: o 385 | } = t; 386 | e(null, { 387 | status: s, 388 | statusCode: i, 389 | headers: r, 390 | body: o 391 | }, o); 392 | }, t => { 393 | const { 394 | message: s, 395 | response: i 396 | } = t; 397 | e(s, i, i && i.body); 398 | })); 399 | } 400 | post(t, e = () => {}) { 401 | 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()) { 402 | this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { 403 | "X-Surge-Skip-Scripting": !1 404 | })); 405 | $httpClient.post(t, (t, s, i) => { 406 | !t && s && (s.body = i, s.statusCode = s.status); 407 | e(t, s, i); 408 | }); 409 | } else { 410 | if (this.isQuanX()) { 411 | t.method = "POST"; 412 | this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { 413 | hints: !1 414 | })); 415 | $task.fetch(t).then(t => { 416 | const { 417 | statusCode: s, 418 | statusCode: i, 419 | headers: r, 420 | body: o 421 | } = t; 422 | e(null, { 423 | status: s, 424 | statusCode: i, 425 | headers: r, 426 | body: o 427 | }, o); 428 | }, t => e(t)); 429 | } else { 430 | if (this.isNode()) { 431 | this.initGotEnv(t); 432 | const { 433 | url: s, 434 | ...i 435 | } = t; 436 | this.got.post(s, i).then(t => { 437 | const { 438 | statusCode: s, 439 | statusCode: i, 440 | headers: r, 441 | body: o 442 | } = t; 443 | e(null, { 444 | status: s, 445 | statusCode: i, 446 | headers: r, 447 | body: o 448 | }, o); 449 | }, t => { 450 | const { 451 | message: s, 452 | response: i 453 | } = t; 454 | e(s, i, i && i.body); 455 | }); 456 | } 457 | } 458 | } 459 | } 460 | time(t, e = null) { 461 | const s = e ? new Date(e) : new Date(); 462 | let i = { 463 | "M+": s.getMonth() + 1, 464 | "d+": s.getDate(), 465 | "H+": s.getHours(), 466 | "m+": s.getMinutes(), 467 | "s+": s.getSeconds(), 468 | "q+": Math.floor((s.getMonth() + 3) / 3), 469 | S: s.getMilliseconds() 470 | }; 471 | /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); 472 | 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))); 473 | return t; 474 | } 475 | msg(e = t, s = "", i = "", r) { 476 | const o = t => { 477 | if (!t) { 478 | return t; 479 | } 480 | if ("string" == typeof t) { 481 | return this.isLoon() ? t : this.isQuanX() ? { 482 | "open-url": t 483 | } : this.isSurge() ? { 484 | url: t 485 | } : void 0; 486 | } 487 | if ("object" == typeof t) { 488 | if (this.isLoon()) { 489 | let e = t.openUrl || t.url || t["open-url"], 490 | s = t.mediaUrl || t["media-url"]; 491 | return { 492 | openUrl: e, 493 | mediaUrl: s 494 | }; 495 | } 496 | if (this.isQuanX()) { 497 | let e = t["open-url"] || t.url || t.openUrl, 498 | s = t["media-url"] || t.mediaUrl; 499 | return { 500 | "open-url": e, 501 | "media-url": s 502 | }; 503 | } 504 | if (this.isSurge()) { 505 | let e = t.url || t.openUrl || t["open-url"]; 506 | return { 507 | url: e 508 | }; 509 | } 510 | } 511 | }; 512 | if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { 513 | let t = ["", "==============??系统通知??=============="]; 514 | t.push(e); 515 | s && t.push(s); 516 | i && t.push(i); 517 | console.log(t.join("\n")); 518 | this.logs = this.logs.concat(t); 519 | } 520 | } 521 | log(...t) { 522 | t.length > 0 && (this.logs = [...this.logs, ...t]); 523 | console.log(t.join(this.logSeparator)); 524 | } 525 | logErr(t, e) { 526 | const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); 527 | s ? this.log("", `??${this.name}, 错误!`, t.stack) : this.log("", `??${this.name}, 错误!`, t); 528 | } 529 | wait(t) { 530 | return new Promise(e => setTimeout(e, t)); 531 | } 532 | done(t = {}) { 533 | const e = new Date().getTime(), 534 | s = (e - this.startTime) / 1000; 535 | this.log("", `??${this.name}, 结束! ?? ${s} 秒`); 536 | this.log(); 537 | (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t); 538 | } 539 | }(t, e); 540 | } -------------------------------------------------------------------------------- /ele_kpbl.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | import time 4 | import requests 5 | import json 6 | import random 7 | import string 8 | import hashlib 9 | from requests import RequestException 10 | from urllib.parse import urlencode, quote 11 | import concurrent.futures 12 | 13 | import logging 14 | import logging.handlers 15 | from queue import Queue 16 | host = 'https://acs.m.goofish.com' 17 | 18 | ck = '' 19 | 20 | def setup_logging(queue): 21 | root_logger = logging.getLogger() 22 | root_logger.setLevel(logging.INFO) 23 | handler = logging.handlers.QueueHandler(queue) 24 | root_logger.addHandler(handler) 25 | 26 | formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') 27 | 28 | console_handler = logging.StreamHandler() 29 | console_handler.setFormatter(formatter) 30 | 31 | listener = logging.handlers.QueueListener(queue, console_handler) 32 | listener.start() 33 | return listener 34 | 35 | 36 | 37 | def log_account_action(account_number, message): 38 | logging.info(f"🐂🍺账号 {account_number + 1}: {message}") 39 | 40 | 41 | def generate_random_string(length=50): 42 | return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) 43 | 44 | 45 | def get_ck_usid(ck1): 46 | key_value_pairs = ck1.split(";") 47 | for pair in key_value_pairs: 48 | if "=" in pair: 49 | key, value = pair.split("=", 1) 50 | if key == "USERID": 51 | return value 52 | else: 53 | print(f"❎错误的 Cookie 格式: {pair}") 54 | return '账号' 55 | 56 | 57 | def tq(txt): 58 | try: 59 | txt = txt.replace(" ", "") 60 | txt = txt.replace("chushi;", "") 61 | txt = txt.replace("zhuli", "") 62 | pairs = txt.split(";")[:-1] 63 | ck_json = {} 64 | for i in pairs: 65 | ck_json[i.split("=")[0]] = i.split("=")[1] 66 | return ck_json 67 | except Exception as e: 68 | print(f'❎Cookie解析错误: {e}') 69 | return {} 70 | 71 | 72 | def xsign(api, data, uid, sid, wua, v): 73 | body = { 74 | "data": data, 75 | "api": api, 76 | "pageId": '', 77 | "uid": uid, 78 | 'sid': sid, 79 | "deviceId": '', 80 | "utdid": '', 81 | "wua": wua, 82 | 'ttid': '1551089129819@eleme_android_10.14.3', 83 | "v": v 84 | } 85 | 86 | try: 87 | r = requests.post( 88 | "http://127.0.0.1:18848/api/getXSign", 89 | json=body 90 | ) 91 | r.raise_for_status() 92 | return r.json() 93 | except requests.exceptions.HTTPError as e: 94 | print(f'❎请求签名服务器失败: {e}') 95 | return None 96 | except requests.exceptions.RequestException as e: 97 | print(f'❎请求签名服务器错误: {e}') 98 | return None 99 | 100 | 101 | def req(api, data, uid, sid, wua='False', v="1.0"): 102 | try: 103 | if type(data) == dict: 104 | data = json.dumps(data) 105 | wua = str(wua) 106 | sign = xsign(api, data, uid, sid, wua, v) 107 | url = f"{host}/gw/{api}/{v}/" 108 | headers = { 109 | "x-sgext": quote(sign.get('x-sgext')), 110 | "x-sign": quote(sign.get('x-sign')), 111 | 'x-sid': sid, 112 | 'x-uid': uid, 113 | 'x-pv': '6.3', 114 | 'x-features': '1051', 115 | 'x-mini-wua': quote(sign.get('x-mini-wua')), 116 | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 117 | 'x-t': sign.get('x-t'), 118 | 'x-extdata': 'openappkey%3DDEFAULT_AUTH', 119 | 'x-ttid': '1551089129819@eleme_android_10.14.3', 120 | 'x-utdid': '', 121 | 'x-appkey': '24895413', 122 | 'x-devid': '', 123 | } 124 | 125 | params = {"data": data} 126 | if 'wua' in sign: 127 | params["wua"] = sign.get('wua') 128 | 129 | max_retries = 5 130 | retries = 0 131 | while retries < max_retries: 132 | try: 133 | res = requests.post(url, headers=headers, data=params, timeout=5) 134 | return res 135 | except requests.exceptions.Timeout: 136 | print("❎接口请求超时") 137 | except requests.exceptions.RequestException as e: 138 | print(f"❎请求异常: {e}") 139 | retries += 1 140 | print(f"❎重试次数: {retries}") 141 | if retries >= max_retries: 142 | print("❎重试次数上限") 143 | return None 144 | except Exception as e: 145 | print(f'❎请求接口失败: {e}') 146 | return None 147 | 148 | 149 | def check_cookie(cookie): 150 | url = "https://waimai-guide.ele.me/h5/mtop.alsc.personal.queryminecenter/1.0/?jsv=2.6.2&appKey=12574478" 151 | headers = { 152 | "Cookie": cookie, 153 | "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36" 154 | } 155 | 156 | try: 157 | response = requests.get(url, headers=headers) 158 | if response.status_code == 200: 159 | cookie_jar = response.cookies 160 | token = cookie_jar.get('_m_h5_tk', '') 161 | token_cookie = "_m_h5_tk=" + token 162 | enc_token = cookie_jar.get('_m_h5_tk_enc', '') 163 | enc_token_cookie = "_m_h5_tk_enc=" + enc_token 164 | cookie = hbh5tk(token_cookie, enc_token_cookie, cookie) 165 | return cookie 166 | else: 167 | return None 168 | except Exception as e: 169 | print("解析ck错误") 170 | return None 171 | 172 | 173 | def tq1(cookie_string): 174 | """ 175 | 获取_m_h5_tk 176 | """ 177 | if not cookie_string: 178 | return '-1' 179 | cookie_pairs = cookie_string.split(';') 180 | for pair in cookie_pairs: 181 | key_value = pair.split('=') 182 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 183 | return key_value[1] 184 | return '-1' 185 | 186 | 187 | def req1(cookie, api, data_str, v="1.0"): 188 | try: 189 | cookie = check_cookie(cookie) 190 | headers = { 191 | "authority": "shopping.ele.me", 192 | "accept": "application/json", 193 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 194 | "cache-control": "no-cache", 195 | "content-type": "application/x-www-form-urlencoded", 196 | "cookie": cookie, 197 | "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" 198 | } 199 | timestamp = int(time.time() * 1000) 200 | # data_str = json.dumps(data) 201 | token = tq1(cookie) 202 | token_part = token.split("_")[0] 203 | 204 | sign_str = f"{token_part}&{timestamp}&12574478&{data_str}" 205 | sign = md5(sign_str) 206 | url = f"https://guide-acs.m.taobao.com/h5/{api}/{v}/?jsv=2.6.1&appKey=12574478&t={timestamp}&sign={sign}&api={api}&v={v}&type=originaljson&dataType=json" 207 | data1 = urlencode({'data': data_str}) 208 | r = requests.post(url, headers=headers, data=data1) 209 | if r: 210 | return r 211 | else: 212 | return None 213 | except Exception as e: 214 | return None 215 | 216 | 217 | def md5(text): 218 | """ 219 | md5加密 220 | """ 221 | hash_md5 = hashlib.md5() 222 | hash_md5.update(text.encode()) 223 | return hash_md5.hexdigest() 224 | 225 | 226 | def hbh5tk(tk_cookie, enc_cookie, cookie_str): 227 | """ 228 | 合并带_m_h5_tk 229 | """ 230 | txt = cookie_str.replace(" ", "") 231 | txt = txt.replace("chushi;", "") 232 | if txt[-1] != ';': 233 | txt += ';' 234 | cookie_parts = txt.split(';')[:-1] 235 | updated = False 236 | for i, part in enumerate(cookie_parts): 237 | key_value = part.split('=') 238 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 239 | cookie_parts[i] = tk_cookie 240 | updated = True 241 | elif key_value[0].strip() in ["_m_h5_tk_enc", " _m_h5_tk_enc"]: 242 | cookie_parts[i] = enc_cookie 243 | updated = True 244 | 245 | if updated: 246 | return ';'.join(cookie_parts) + ';' 247 | else: 248 | return txt + tk_cookie + ';' + enc_cookie + ';' 249 | 250 | 251 | class TYT: 252 | def __init__(self, cki, account_number): 253 | self.taskId = None 254 | self.stop = False 255 | self.gameId = None 256 | self.token = None 257 | self.name = None 258 | self.taskList = None 259 | self.cki = tq(cki) 260 | self.uid = self.cki.get("unb") 261 | self.sid = self.cki.get("cookie2") 262 | self.name1 = get_ck_usid(cki) 263 | self.account_number = account_number 264 | 265 | def login(self, ck): 266 | api1 = 'mtop.alsc.user.detail.query' 267 | data1 = json.dumps({}) 268 | try: 269 | # res1 = req(api1, data1, self.uid, self.sid, "1.0") 270 | res1 = req1(ck, api1, data1, "1.0") 271 | if res1.json()['ret'][0] == 'SUCCESS::调用成功': 272 | self.name = res1.json()["data"]["encryptMobile"] 273 | api = 'mtop.koubei.interaction.center.common.queryintegralproperty.v2' 274 | data = json.dumps({"templateIds": "[\"1404\"]"}) 275 | try: 276 | # res = req(api, data, self.uid, self.sid, "1.0") 277 | res = req1(ck, api, data, "1.0") 278 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 279 | print(f'[账号{self.account_number}] ✅登录成功,乐园币----[{res.json()["data"]["data"]["1404"]["count"]}]') 280 | return True 281 | else: 282 | if res.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 283 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 284 | return False 285 | else: 286 | print(f'[{self.name1}] ❌登录失败,原因:{res.text}') 287 | return False 288 | except Exception as e: 289 | print(f"[{self.name1}] ❎登录失败: {e}") 290 | return False 291 | else: 292 | if res1.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 293 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 294 | return False 295 | else: 296 | print(f'[{self.name1}] ❌登录失败,原因:{res1.text}') 297 | return False 298 | except Exception as e: 299 | print(f"[{self.name1}] ❎登录失败: {e}") 300 | return False 301 | 302 | def gettoken(self, ck): 303 | api = 'mtop.alsc.playgame.mini.game.dispatch' 304 | data = json.dumps( 305 | {"bizScene": "CAPYBARA", "bizMethod": "login", "bizParam": "{\"gameId\":\"13254\",\"inviterId\":null}", 306 | "longitude": "104.09800574183464", "latitude": "30.22990694269538"}) 307 | # res = req(api, data, self.uid, self.sid, "1.0") 308 | res = req1(ck, api, data, "1.0") 309 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 310 | y = json.loads(res.json()["data"]["data"]) 311 | self.token = y["data"]["token"] 312 | self.gameId = y["data"]["openId"] 313 | return True 314 | elif res.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 315 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 316 | return False 317 | else: 318 | print(f'[{self.name1}] ❌获取token失败,原因:{res.text}') 319 | return False 320 | 321 | # 开始游戏 322 | def startgame(self): 323 | api = 'mtop.alsc.playgame.mini.game.dispatch' 324 | data = json.dumps({"bizScene": "CAPYBARA", "bizMethod": "startGame", 325 | "bizParam": "{\"levelId\":\"1\",\"isRestart\":true,\"gameId\":\"" + self.gameId + "\",\"token\":\"" + self.token + "\"}", 326 | "longitude": "105.75325090438128", "latitude": "30.597472842782736"}) 327 | res = req(api, data, self.uid, self.sid, "1.0") 328 | 329 | print("助力: " + res.text) 330 | 331 | ## 菜品类型 332 | def scdisheslx(self, ck): 333 | api = 'mtop.alsc.playgame.mini.game.dispatch' 334 | data = json.dumps({"bizScene": "CAPYBARA", "bizMethod": "startGame", 335 | "bizParam": "{\"levelId\":\"1\",\"isRestart\":false,\"gameId\":\"" + self.gameId + "\"}"}) 336 | try: 337 | # res = req(api, data, self.uid, self.sid, "1.0") 338 | res = req1(ck, api, data, "1.0") 339 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 340 | 341 | a = json.loads(res.json()["data"]["data"]) 342 | if a['data']['levelInfo']['orders']['CusS1001']['foodId'] == '_': 343 | foodid = 'Food1001' 344 | else: 345 | foodid = a['data']['levelInfo']['orders']['CusS1001']['foodId'] 346 | foodNum = a['data']['levelInfo']['orders']['CusS1001']['currCount'] 347 | if foodid in a['data']['levelInfo']['currFoods']: 348 | if self.scdishes(ck) is not None: 349 | if 'currFoods' in a['data']['levelInfo'] and foodid in a['data']['levelInfo']['currFoods']: 350 | foodlx = a['data']['levelInfo']['currFoods'][foodid] 351 | return foodid, foodNum, foodlx 352 | else: 353 | print(f"菜品类型错误") 354 | return None, None, None 355 | else: 356 | print(f"菜品类4444型错误") 357 | return None, None, None 358 | else: 359 | return 'Food1001', foodNum, 1 360 | else: 361 | print(f"[账号{self.account_number}] ❎获取菜品类型失败--{res.text}") 362 | return None, None, None 363 | except RequestException as e: 364 | print(f"[账号{self.account_number}] ❎请求失败: {str(e)}") 365 | return None, None, None 366 | except Exception as e: 367 | logging.exception(f"[账号{self.account_number}] ❎请求失败: {str(e)}") 368 | return None, None, None 369 | 370 | # 上菜 371 | def scdishes(self, ck): 372 | api = 'mtop.alsc.playgame.mini.game.dispatch' 373 | data = json.dumps({"bizScene": "CAPYBARA", "bizMethod": "handFoodOut", 374 | "bizParam": "{\"levelId\":\"1\",\"handCount\":10,\"gameId\":\"" + self.gameId + "\"}"}) 375 | try: 376 | # res = req(api, data, self.uid, self.sid, "1.0") 377 | res = req1(ck, api, data, "1.0") 378 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 379 | a = json.loads(res.json()["data"]["data"]) 380 | sysum = a['data']['energy']['num'] 381 | scjg = a['data']['outFoods'] 382 | print(f"[账号{self.account_number}] ✅上菜成功--剩余菜品数量:{sysum}") 383 | if sysum > 0: 384 | return True 385 | else: 386 | print(f"[账号{self.account_number}] ❎上菜失败--菜品数量不足") 387 | self.stop = True 388 | return False 389 | else: 390 | print(f"[账号{self.account_number}] ❎上菜失败--{res.json()['ret'][0]}") 391 | return None 392 | except Exception as e: 393 | print(f"[账号{self.account_number}] ❎2请求失败: {e}") 394 | return None 395 | 396 | # 提交菜品 397 | def tjdishes(self, ck): 398 | foodid, foodNum, foodlx = self.scdisheslx(ck) 399 | if foodlx is None: 400 | print(f"[账号{self.account_number}] ❎ 获取菜品信息失败") 401 | return 402 | else: 403 | if foodlx == 0: 404 | self.scdishes(ck) 405 | if int(foodNum) < 10: 406 | api = 'mtop.alsc.playgame.mini.game.dispatch' 407 | data = json.dumps({ 408 | "bizScene": "CAPYBARA", 409 | "bizMethod": "submitFood", 410 | "bizParam": "{\"levelId\":\"1\",\"orderSeatId\":\"CusS1001\",\"foodId\":\"" + foodid + "\",\"foodNum\":\"" + str( 411 | foodlx) + "\",\"gameId\":\"" + str(self.gameId) + "\"}" 412 | }) 413 | try: 414 | # res = req(api, data, self.uid, self.sid, "1.0") 415 | res = req1(ck, api, data, "1.0") 416 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 417 | a = json.loads(res.json()["data"]["data"]) 418 | if a['bizErrorCode'] == 'ORDER_FOOD_ERROR': 419 | print(f"[账号{self.account_number}] ❎提交菜品失败--{a['bizErrorMsg']}") 420 | self.scdishes(ck) 421 | else: 422 | print(f"[账号{self.account_number}] ✅提交菜品成功") 423 | else: 424 | print(f"[账号{self.account_number}] ❎提交菜品失败--{res.json()['ret'][0]}") 425 | except Exception as e: 426 | print(f"[账号{self.account_number}] ❎1请求失败") 427 | if int(foodNum) >= 10: 428 | self.scscdishes(ck) 429 | 430 | # 上传菜品 431 | def scscdishes(self, ck): 432 | api = 'mtop.alsc.playgame.mini.game.dispatch' 433 | data = json.dumps({"bizScene": "CAPYBARA", "bizMethod": "receiveOrderAward", 434 | "bizParam": "{\"levelId\":\"1\",\"orderSeatId\":\"CusS1001\",\"gameId\":\"" + self.gameId + "\"}"}) 435 | try: 436 | # res = req(api, data, self.uid, self.sid, "1.0") 437 | res = req1(ck, api, data, "1.0") 438 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 439 | # print(res.json()) 440 | print(f"[账号{self.account_number}] ✅上传菜品成功") 441 | else: 442 | print(f"[账号{self.account_number}] ❎上传菜品失败--{res.json()['ret'][0]}") 443 | except Exception as e: 444 | print(f"[账号{self.account_number}] ❎1请求失败: {e}") 445 | 446 | def task(self, ck): 447 | api = 'mtop.alsc.playgame.mini.game.dispatch' 448 | data = json.dumps({"bizScene": "CAPYBARA", "bizMethod": "getTasks", 449 | "bizParam": "{\"gameId\":\"" + self.gameId + "\",\"token\":\"" + self.token + "\"}", 450 | "longitude": "104.09800574183464", "latitude": "30.22990694269538"}) 451 | 452 | # res = req(api, data, self.uid, self.sid, "1.0") 453 | res = req1(ck, api, data, "1.0") 454 | 455 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 456 | self.taskList = json.loads(res.json()["data"]["data"]) 457 | return True 458 | 459 | def checkTask(self, ck): 460 | self.task(ck) 461 | if 'T001' in self.taskList['data']['tasks']: 462 | if self.taskList['data']['tasks']['T001']['isFinishe'] == True: 463 | print(f"[账号{self.account_number}] ✅任务T001已完成") 464 | elif self.taskList['data']['tasks']['T001']['progress'] == 30: 465 | print(f"[账号{self.account_number}] 尝试领取 T001 奖励") 466 | id = self.taskList['data']['tasks']['T001']['taskId'] 467 | if not self.postTask(id, ck): 468 | return 'T001' 469 | else: 470 | print(f"[账号{self.account_number}] T001 任务未完成!开始做任务⚠️⚠️") 471 | return 'T001' 472 | else: 473 | print(f"[账号{self.account_number}] T001 任务未开始!开始做任务⚠️⚠️") 474 | return 'T001' 475 | 476 | if 'T002' in self.taskList['data']['tasks']: 477 | if self.taskList['data']['tasks']['T002']['isFinishe'] == True: 478 | print(f"[账号{self.account_number}] ✅任务T002已完成") 479 | elif self.taskList['data']['tasks']['T002']['progress'] == 200: 480 | print(f"[账号{self.account_number}] 尝试领取 T002 奖励") 481 | id = self.taskList['data']['tasks']['T002']['taskId'] 482 | if not self.postTask(id, ck): 483 | return 'T002' 484 | else: 485 | print(f"[账号{self.account_number}] T002 任务未完成!开始做任务⚠️⚠️") 486 | return 'T002' 487 | else: 488 | print(f"[账号{self.account_number}] T002 任务未开始!开始做任务⚠️⚠️") 489 | return 'T002' 490 | 491 | if 'T003' in self.taskList['data']['tasks']: 492 | if self.taskList['data']['tasks']['T003']['isFinishe'] == True: 493 | print(f"[账号{self.account_number}] ✅任务T003已完成!") 494 | elif self.taskList['data']['tasks']['T003']['progress'] == 2: 495 | print(f"[账号{self.account_number}] 尝试领取 T003 奖励") 496 | id = self.taskList['data']['tasks']['T003']['taskId'] 497 | if not self.postTask(id, ck): 498 | return 'T003' 499 | else: 500 | print(f"[账号{self.account_number}] T003 任务未完成!开始做任务⚠️⚠️") 501 | return 'T003' 502 | else: 503 | print(f"[账号{self.account_number}] T003 任务未开始!开始做任务⚠️⚠️") 504 | return 'T003' 505 | 506 | return True 507 | 508 | def postTask(self, taskId, ck): 509 | api = 'mtop.alsc.playgame.mini.game.dispatch' 510 | data = json.dumps({"bizScene": "CAPYBARA", "bizMethod": "finisheTask", 511 | "bizParam": "{\"taskId\":\"" + taskId + "\",\"gameId\":\"" + self.gameId + "\",\"token\":\"" + self.token + "\"}", 512 | "longitude": "104.09800574183464", "latitude": "30.22990694269538"}) 513 | 514 | # res = req(api, data, self.uid, self.sid, "1.0") 515 | res = req1(ck, api, data, "1.0") 516 | print(f"完成任务{taskId}") 517 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 518 | # print(res.json()) 519 | nested_data = json.loads(res.json()['data']['data']) 520 | reward_items = nested_data['data']['rewardItems'] 521 | if reward_items: 522 | reward_num = reward_items[0]['num'] 523 | print(f"[账号{self.account_number}] ✅完成任务获得乐园币--[{reward_num}]") 524 | return True 525 | return False 526 | return False 527 | 528 | def daoju(self, count, ck): 529 | api = 'mtop.alsc.playgame.mini.game.dispatch' 530 | bizParam = json.dumps({ 531 | "levelId": "1", 532 | "itemId": f"It100{random.randint(1, 3)}", 533 | "removeFoods": { 534 | "Food1003": random.randint(1, 10), 535 | "Food1002": random.randint(1, 10), 536 | "Food1004": random.randint(1, 3) 537 | }, 538 | "gameId": self.gameId, 539 | "token": self.token, 540 | }) 541 | data = json.dumps({ 542 | "bizScene": "CAPYBARA", 543 | "bizMethod": "useGameProp", 544 | "bizParam": bizParam, 545 | "longitude": "104.09800574183464", 546 | "latitude": "30.22990694269538" 547 | }) 548 | try: 549 | # res = req(api, data, self.uid, self.sid, "1.0") 550 | res = req1(ck, api, data, "1.0") 551 | # print(res.json()) 552 | if json.loads(res.json()['data']['data'])['bizErrorCode'] == 'OK': 553 | print(f"[账号{self.account_number}] ✅第{count}次使用道具成功!") 554 | count = count + 1 555 | return count 556 | else: 557 | print(f'[账号{self.account_number}] ❎第{count}次使用道具失败!!!') 558 | return count 559 | except Exception as e: 560 | print(f"[账号{self.account_number}] ❎1请求失败,结束使用道具: {e}") 561 | return 6 562 | 563 | 564 | 565 | def main(self, ck): 566 | if self.login(ck): 567 | self.gettoken(ck) 568 | checkRes = self.checkTask(ck) 569 | 570 | if checkRes != True: 571 | print(f"----尝试领取游戏次数----") 572 | while True and self.stop == False: 573 | self.tjdishes(ck) 574 | 575 | print(f"----获取任务列表----") 576 | self.task(ck) 577 | 578 | if 'T003' in self.taskList['data']['tasks']: 579 | if self.taskList['data']['tasks']['T003']['isFinishe'] == True: 580 | print(f"[{self.name}] ✅任务T003已完成") 581 | elif self.taskList['data']['tasks']['T003']['progress'] == 2: 582 | print(f"[{self.name}] 已使用道具 尝试领取奖励") 583 | id = self.taskList['data']['tasks']['T003']['taskId'] 584 | self.postTask(id,ck) 585 | else: 586 | print(f"[{self.name}] 未使用道具2次,继续任务") 587 | usedCount = 1 588 | while usedCount < 3: 589 | usedCount = self.daoju(usedCount,ck) 590 | id = self.taskList['data']['tasks']['T003']['taskId'] 591 | self.postTask(id,ck) 592 | else: 593 | usedCount = 1 594 | while usedCount < 3: 595 | usedCount = self.daoju(usedCount,ck) 596 | self.task(ck) 597 | self.postTask(self.taskList['data']['tasks']['T003']['taskId'],ck) 598 | 599 | if 'T001' in self.taskList['data']['tasks']: 600 | if self.taskList['data']['tasks']['T001']['isFinishe'] == True: 601 | print(f"[{self.name}] ✅任务T001已完成") 602 | elif self.taskList['data']['tasks']['T001']['progress'] == 30: 603 | print(f"[{self.name}] ✅尝试领取 T001 奖励") 604 | id = self.taskList['data']['tasks']['T001']['taskId'] 605 | self.postTask(id,ck) 606 | else: 607 | print(f"[{self.name}] ❎任务T001未完成,进度{self.taskList['data']['tasks']['T001']['progress']}/30") 608 | 609 | 610 | if 'T002' in self.taskList['data']['tasks']: 611 | if self.taskList['data']['tasks']['T002']['isFinishe'] == True: 612 | print(f"[{self.name}] ✅任务T002已完成") 613 | elif self.taskList['data']['tasks']['T002']['progress'] == 200: 614 | print(f"[{self.name}] ✅尝试领取 T002 奖励") 615 | id = self.taskList['data']['tasks']['T002']['taskId'] 616 | self.postTask(id,ck) 617 | else: 618 | print(f"[{self.name}] ❎任务 T002 未完成,进度{self.taskList['data']['tasks']['T002']['progress']}/200") 619 | 620 | else: 621 | print(f"[{self.name}] ✅任务已全部完成。") 622 | 623 | 624 | if __name__ == '__main__': 625 | queue = Queue() 626 | listener = setup_logging(queue) 627 | 628 | if 'elmck' in os.environ: 629 | cookie = os.environ.get('elmck') 630 | else: 631 | log_account_action(-1, "环境变量中不存在[elmck],启用本地变量模式") 632 | cookie = ck 633 | if cookie == "": 634 | log_account_action(-1, "本地变量为空,请设置其中一个变量后再运行") 635 | exit(-1) 636 | 637 | cookies = cookie.split("&") 638 | log_account_action(-1, f"饿了么共获取到 {len(cookies)} 个账号") 639 | 640 | 641 | with concurrent.futures.ThreadPoolExecutor(max_workers=8) as executor: 642 | futures = {executor.submit(TYT(ck, i + 1).main, ck): i + 1 for i, ck in enumerate(cookies)} 643 | 644 | for future in concurrent.futures.as_completed(futures): 645 | account_number = futures[future] 646 | try: 647 | stop = future.result() 648 | log_account_action(account_number, "执行完毕") 649 | except Exception as e: 650 | log_account_action(account_number, f"执行出错: {e}") 651 | 652 | listener.stop() 653 | -------------------------------------------------------------------------------- /ele_lgqs.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import hashlib 4 | import os 5 | import re 6 | import time 7 | import requests 8 | from urllib.parse import urlencode, quote 9 | import execjs 10 | import tempfile 11 | import subprocess 12 | 13 | host = 'https://acs.m.goofish.com' 14 | 15 | ck = '' 16 | 17 | import json 18 | import random 19 | import string 20 | import base64 21 | 22 | def rsa_encrypt(public_key_pem, data_str): 23 | url = 'http://mzkj666.cn:9324/encrypt' 24 | data = { 25 | 'publicKeyPem': public_key_pem, 26 | 'dataStr': data_str 27 | } 28 | 29 | response = requests.post(url, json=data) 30 | if response.status_code == 200: 31 | return response.json()['encryptedData'] 32 | else: 33 | return response.json()['encryptedData'] 34 | 35 | def generate_random_string(length=50): 36 | return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) 37 | 38 | 39 | def get_ck_usid(ck1): 40 | key_value_pairs = ck1.split(";") 41 | for pair in key_value_pairs: 42 | key, value = pair.split("=") 43 | if key == "USERID": 44 | return value 45 | else: 46 | return '账号' 47 | 48 | def hbh5tk(tk_cookie, enc_cookie, cookie_str): 49 | """ 50 | 合并带_m_h5_tk 51 | """ 52 | txt = cookie_str.replace(" ", "") 53 | if txt[-1] != ';': 54 | txt += ';' 55 | cookie_parts = txt.split(';')[:-1] 56 | updated = False 57 | for i, part in enumerate(cookie_parts): 58 | key_value = part.split('=') 59 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 60 | cookie_parts[i] = tk_cookie 61 | updated = True 62 | elif key_value[0].strip() in ["_m_h5_tk_enc", " _m_h5_tk_enc"]: 63 | cookie_parts[i] = enc_cookie 64 | updated = True 65 | 66 | if updated: 67 | return ';'.join(cookie_parts) + ';' 68 | else: 69 | return txt + tk_cookie + ';' + enc_cookie + ';' 70 | 71 | 72 | def tq(cookie_string): 73 | """ 74 | 获取_m_h5_tk 75 | """ 76 | if not cookie_string: 77 | return '-1' 78 | cookie_pairs = cookie_string.split(';') 79 | for pair in cookie_pairs: 80 | key_value = pair.split('=') 81 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 82 | return key_value[1] 83 | return '-1' 84 | 85 | 86 | def tq1(txt): 87 | """ 88 | 拆分cookie 89 | """ 90 | try: 91 | txt = txt.replace(" ", "") 92 | if txt[-1] != ';': 93 | txt += ';' 94 | pairs = txt.split(";")[:-1] 95 | ck_json = {} 96 | for pair in pairs: 97 | key, value = pair.split("=", 1) 98 | ck_json[key] = value 99 | return ck_json 100 | except Exception as e: 101 | print(f'❎Cookie解析错误: {e}') 102 | return {} 103 | 104 | 105 | def md5(text): 106 | """ 107 | md5加密 108 | """ 109 | hash_md5 = hashlib.md5() 110 | hash_md5.update(text.encode()) 111 | return hash_md5.hexdigest() 112 | 113 | 114 | def check_cookie(cookie): 115 | url = "https://waimai-guide.ele.me/h5/mtop.alsc.personal.queryminecenter/1.0/?jsv=2.6.2&appKey=12574478" 116 | headers = { 117 | "Cookie": cookie, 118 | "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36" 119 | } 120 | 121 | try: 122 | response = requests.get(url, headers=headers) 123 | if response.status_code == 200: 124 | cookie_jar = response.cookies 125 | token = cookie_jar.get('_m_h5_tk', '') 126 | token_cookie = "_m_h5_tk=" + token 127 | enc_token = cookie_jar.get('_m_h5_tk_enc', '') 128 | enc_token_cookie = "_m_h5_tk_enc=" + enc_token 129 | cookie = hbh5tk(token_cookie, enc_token_cookie, cookie) 130 | return cookie 131 | else: 132 | return None 133 | except Exception as e: 134 | print("解析ck错误") 135 | return None 136 | 137 | class TYT: 138 | def __init__(self, cki): 139 | self.name = None 140 | self.ck = cki 141 | self.cki = tq1(cki) 142 | self.uid = self.cki.get("unb") 143 | self.sid = self.cki.get("cookie2") 144 | self.name1 = get_ck_usid(cki) 145 | self.curGameId = "" 146 | self.propertyId = "" 147 | self.gamePublicKey = "" 148 | self.gameCount = 0 149 | 150 | def xsign(self, api, data, wua, v): 151 | body = { 152 | "data": data, 153 | "api": api, 154 | "pageId": '', 155 | "uid": self.uid, 156 | 'sid': self.sid, 157 | "deviceId": '', 158 | "utdid": '', 159 | "wua": wua, 160 | 'ttid': '1551089129819@eleme_android_10.14.3', 161 | "v": v 162 | } 163 | 164 | try: 165 | r = requests.post( 166 | "http://192.168.1.124:1888/api/getXSign", 167 | json=body 168 | ) 169 | r.raise_for_status() 170 | return r.json() 171 | except requests.exceptions.HTTPError as e: 172 | print(f'❎请求签名服务器失败: {e}') 173 | return None 174 | except requests.exceptions.RequestException as e: 175 | print(f'❎请求签名服务器错误: {e}') 176 | return None 177 | 178 | def xsign_req(self, api, data, wua='False', v="1.0"): 179 | try: 180 | if type(data) == dict: 181 | data = json.dumps(data) 182 | wua = str(wua) 183 | sign = self.xsign(api, data, wua, v) 184 | url = f"{host}/gw/{api}/{v}/" 185 | headers = { 186 | "x-sgext": quote(sign.get('x-sgext')), 187 | "x-sign": quote(sign.get('x-sign')), 188 | 'x-sid': self.sid, 189 | 'x-uid': self.uid, 190 | 'x-pv': '6.3', 191 | 'x-features': '1051', 192 | 'x-mini-wua': quote(sign.get('x-mini-wua')), 193 | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 194 | 'x-t': sign.get('x-t'), 195 | 'x-extdata': 'openappkey%3DDEFAULT_AUTH', 196 | 'x-ttid': '1551089129819@eleme_android_10.14.3', 197 | 'x-utdid': '', 198 | 'x-appkey': '24895413', 199 | 'x-devid': '', 200 | } 201 | 202 | params = {"data": data} 203 | if 'wua' in sign: 204 | params["wua"] = sign.get('wua') 205 | 206 | max_retries = 5 207 | retries = 0 208 | while retries < max_retries: 209 | try: 210 | res = requests.post(url, headers=headers, data=params, timeout=5) 211 | return res 212 | except requests.exceptions.Timeout: 213 | print("❎接口请求超时") 214 | except requests.exceptions.RequestException as e: 215 | print(f"❎请求异常: {e}") 216 | retries += 1 217 | print(f"❎重试次数: {retries}") 218 | if retries >= max_retries: 219 | print("❎重试次数上限") 220 | return None 221 | except Exception as e: 222 | print(f'❎请求接口失败: {e}') 223 | return None 224 | 225 | def no_xsign_req(self, api, data, v="1.0"): 226 | try: 227 | cookie = check_cookie(self.ck) 228 | headers = { 229 | "authority": "shopping.ele.me", 230 | "accept": "application/json", 231 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 232 | "cache-control": "no-cache", 233 | "content-type": "application/x-www-form-urlencoded", 234 | "cookie": cookie, 235 | "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" 236 | } 237 | timestamp = int(time.time() * 1000) 238 | data_str = json.dumps(data) 239 | token = tq(cookie) 240 | token_part = token.split("_")[0] 241 | 242 | sign_str = f"{token_part}&{timestamp}&12574478&{data_str}" 243 | sign = md5(sign_str) 244 | url = f"https://guide-acs.m.taobao.com/h5/{api}/{v}/?jsv=2.6.1&appKey=12574478&t={timestamp}&sign={sign}&api={api}&v={v}&type=originaljson&dataType=json" 245 | data1 = urlencode({'data': data_str}) 246 | r = requests.post(url, headers=headers, data=data1) 247 | if r.json()['ret'][0] in ['SUCCESS::接口调用成功','SUCCESS::调用成功']: 248 | return r 249 | else: 250 | # print('请求失败:',r.text) 251 | return f"请求异常:{r.json()['ret'][0]}" 252 | except Exception as e: 253 | print('请求出现错误:',e) 254 | return None 255 | 256 | def login(self): 257 | api1 = 'mtop.alsc.user.detail.query' 258 | data1 = {} 259 | try: 260 | res1 = self.no_xsign_req(api1, data1, "1.0") 261 | if res1.json()['ret'][0] == 'SUCCESS::调用成功': 262 | self.name = res1.json()["data"]["encryptMobile"] 263 | api = 'mtop.koubei.interaction.center.common.queryintegralproperty.v2' 264 | data = {"templateIds": "[\"1404\"]"} 265 | try: 266 | res = self.no_xsign_req(api, data, "1.0") 267 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 268 | print(f'[{self.name}] ✅登录成功,乐园币----[{res.json()["data"]["data"]["1404"]["count"]}]') 269 | return True 270 | else: 271 | if res.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 272 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 273 | return False 274 | else: 275 | print(f'[{self.name1}] ❌登录失败,原因:{res.text}') 276 | return False 277 | except Exception as e: 278 | print(f"[{self.name1}] ❎登录失败: {e}") 279 | return False 280 | else: 281 | if res1.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 282 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 283 | return False 284 | else: 285 | print(f'[{self.name1}] ❌登录失败,原因:{res1.text}') 286 | return False 287 | except Exception as e: 288 | print(f"[{self.name1}] ❎登录失败: {e}") 289 | return False 290 | 291 | def task(self): 292 | print(f"[{self.name1}] 开始获取游戏任务") 293 | api = 'mtop.ele.biz.growth.task.core.querytask' 294 | data = json.dumps({"bizScene": "BLUE_KNIGHT_PARKOUR", "accountPlan": "HAVANA_COMMON", "missionCollectionId": "1322", 295 | "locationInfos": "[\"{\\\"lng\\\":\\\"120.220572\\\",\\\"lat\\\":\\\"30.178625\\\"}\"]" 296 | }) 297 | try: 298 | res = self.xsign_req(api, data, "1.0") 299 | if res.json()['ret'][0] == 'SUCCESS::接口调用成功': 300 | if res.json()["data"]["mlist"][0]["stage"]['count'] < 5: 301 | count = 5 - int(res.json()["data"]["mlist"][0]["stage"]['count']) 302 | for _ in range(int(count)): 303 | api = 'mtop.ele.biz.growth.task.event.pageview' 304 | data = { 305 | "collectionId": "1322", 306 | "missionId": "23414001", 307 | "actionCode": "PAGEVIEW", 308 | "pageFrom": "a2ogi.bx1157100", 309 | "viewTime": "15", 310 | "bizScene": "BLUE_KNIGHT_PARKOUR", 311 | "accountPlan": "KB_ORCHARD", 312 | "sync": "false", 313 | "asac": "2A23C08X4VP4SVOKFBKCA9", 314 | } 315 | try: 316 | res1 = self.no_xsign_req(api, data, "1.0") 317 | if res1: 318 | if '异常' not in res1: 319 | print(f'[{self.name}] ✅任务完成成功!') 320 | else: 321 | print(f'[{self.name}] ✅任务完成出错:',res1) 322 | break 323 | else: 324 | print(f'[{self.name}] ✅任务完成失败:',res1) 325 | except Exception as e: 326 | print(f"[{self.name}] ❎请求失败:",e) 327 | return None 328 | except Exception as e: 329 | print(f"[{self.name}] ❎请求失败1") 330 | 331 | print(f"[{self.name1}] 开始获取可领取次数") 332 | api = 'mtop.ele.biz.growth.task.core.querytask' 333 | data = json.dumps({ 334 | "bizScene": "BLUE_KNIGHT_PARKOUR", 335 | "accountPlan": "HAVANA_COMMON", 336 | "missionCollectionId": "1322", 337 | "locationInfos": "[\"{\\\"lng\\\":\\\"120.220572\\\",\\\"lat\\\":\\\"30.178625\\\"}\"]" 338 | }) 339 | try: 340 | res = self.xsign_req(api, data, "1.0") 341 | if res.json()['ret'][0] == 'SUCCESS::接口调用成功': 342 | for y in res.json()['data']['mlist']: 343 | for o in y['missionStageDTOS']: 344 | if o['rewardStatus'] == "TODO" and o['status'] == "FINISH": 345 | if o['rewards'][0]['name'] == "次数": 346 | api1 = 'mtop.ele.biz.growth.task.core.receiveprize' 347 | data1 = {"bizScene": "BLUE_KNIGHT_PARKOUR", "missionCollectionId": "1322", "missionId": "23414001", 348 | "locationInfos": "[\"{\\\"lng\\\":\\\"105.754353\\\",\\\"lat\\\":\\\"30.600449\\\"}\"]", 349 | "accountPlan":"HAVANA_COMMON", 350 | "count": o['stageCount'], 351 | "asac": "2A23B18B2HYMDVFDDOXP2F"} 352 | try: 353 | res1 = self.no_xsign_req(api1, data1, "1.0") 354 | if (res1 is None) or (res1 and '异常' in res1): 355 | continue 356 | data = res1.json()["data"] 357 | if data.get('errorMsg') is not None: 358 | print(f"[{self.name}] ❎领取奖励失败: {data['errorMsg']}") 359 | else: 360 | rlist = data.get('rlist') 361 | if rlist is not None: 362 | print(f"[{self.name}] ✅领取游戏次数成功--{rlist[0]['value']}次") 363 | else: 364 | print(f"[{self.name}] ❎{res1.json()['ret'][0]}") 365 | except Exception: 366 | print(f'请求错误') 367 | return None 368 | except Exception as e: 369 | print(f"[{self.name}] ❎请求失败:",e) 370 | 371 | def query_game_info(self): 372 | api = 'mtop.alsc.playgame.mini.game.index' 373 | data = json.dumps({ 374 | "bizScene": "BLUE_KNIGHT_PARKOUR", 375 | "latitude": "30.17862595617771", 376 | "longitude": "120.22057268768549", 377 | "collectionIds": "[\"20240204214413721933320869\"]", 378 | "actId": "20240204214413716190833090" 379 | }) 380 | try: 381 | res = self.xsign_req(api, data, "1.0") 382 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 383 | if len(res.json()["data"]["data"]['propertyList']): 384 | for propertyItem in res.json()["data"]["data"]['propertyList']: 385 | if propertyItem['propertyName'] == '乐园币': 386 | print(f'[{self.name}] ✅乐园币----[{propertyItem["amount"]}]') 387 | self.propertyId = propertyItem['propertyId'] 388 | elif propertyItem['propertyName'] == '剩余奖励次数': 389 | self.gameCount = int(propertyItem['amount']) 390 | print(f'[{self.name}] ✅剩余游戏次数----[{propertyItem["amount"]}]') 391 | else: 392 | print(f"[{self.name}] ❌查询游戏信息失败,原因:{res.text}") 393 | except Exception as e: 394 | print(f"[{self.name}] ❎查询游戏信息失败") 395 | 396 | def start_game(self): 397 | api = 'mtop.alsc.playgame.mini.game.play.start' 398 | data = json.dumps({ 399 | "bizScene":"BLUE_KNIGHT_PARKOUR", 400 | "latitude": "30.17862595617771", 401 | "longitude": "120.22057268768549", 402 | "actId":"20240204214413716190833090", 403 | "gamePattern":"REWARD_PATTERN", 404 | "extParams":"{\"changeVersion\":\"20240412\"}" 405 | }) 406 | try: 407 | res = self.xsign_req(api, data, "1.0") 408 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 409 | if res.json()["data"]["data"]['curGameId']: 410 | self.curGameId = res.json()["data"]["data"]['curGameId'] 411 | self.gamePublicKey = res.json()["data"]["data"]['extInfo']['pk'] 412 | else: 413 | print(f"[{self.name}] ❌开始游戏失败,原因:",res.json()['ret'][0]) 414 | except Exception as e: 415 | print(f"[{self.name}] ❎开始游戏失败") 416 | 417 | def settle_game(self,grantAmount): 418 | api = 'mtop.alsc.playgame.mini.game.play.settle' 419 | body = { 420 | "bizScene":"BLUE_KNIGHT_PARKOUR", 421 | "latitude": "30.17862595617771", 422 | "longitude": "120.22057268768549", 423 | "curGameId":self.curGameId, 424 | "actId":"20240204214413716190833090", 425 | "grantAmount":rsa_encrypt(self.gamePublicKey, str(grantAmount)), 426 | "propertyId":self.propertyId, 427 | "extParams":"{\"changeVersion\":\"20240412\"}" 428 | } 429 | data = json.dumps(body) 430 | try: 431 | res = self.xsign_req(api, data, "1.0") 432 | if res is None: 433 | return None 434 | if res.json()["ret"][0] == "SUCCESS::调用成功": 435 | game_gold = res.json()["data"]["data"]["realGrantValue"] 436 | if game_gold: 437 | print(f"[{self.name}] ✅游戏完成,获得--{game_gold}乐园币") 438 | else: 439 | print(f"[{self.name}] ❌游戏完成,并没有获得奖励") 440 | else: 441 | if res.json()["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 442 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 443 | return None 444 | else: 445 | print(f'[{self.name1}] ❎{res.json()["ret"][0]}') 446 | return res.json()["ret"][0] 447 | except Exception: 448 | print(f'❎请求错误') 449 | return None 450 | 451 | def main(self): 452 | if self.login(): 453 | self.query_game_info() 454 | print(f"----尝试领取游戏次数----") 455 | self.task() 456 | self.query_game_info() 457 | print(f"----尝试完成游戏----") 458 | if self.gameCount > 0: 459 | for i in range(self.gameCount): 460 | self.start_game() 461 | if self.curGameId: 462 | print(f"模拟玩一次游戏中……") 463 | settle_result = self.settle_game(25) 464 | if settle_result and '发放数量超日限制' in settle_result: 465 | break 466 | else: 467 | print(f"没有游戏次数可以玩了") 468 | 469 | 470 | if __name__ == '__main__': 471 | if 'elmck' in os.environ: 472 | cookie = os.environ.get('elmck') 473 | else: 474 | print("环境变量中不存在[elmck],启用本地变量模式") 475 | cookie = ck 476 | if cookie == "": 477 | print("本地变量为空,请设置其中一个变量后再运行") 478 | exit(-1) 479 | cookies = cookie.split("&") 480 | print(f"饿了么共获取到 {len(cookies)} 个账号") 481 | for i, ck in enumerate(cookies): 482 | print(f"======开始第{i + 1}个账号======") 483 | TYT(ck).main() 484 | print("2s后进行下一个账号") 485 | time.sleep(2) 486 | -------------------------------------------------------------------------------- /ele_tiao.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import random 4 | import re 5 | import time 6 | import requests 7 | from urllib.parse import quote 8 | 9 | host = 'https://acs.m.goofish.com' 10 | 11 | ck = '' 12 | 13 | 14 | import json 15 | import random 16 | import string 17 | 18 | def 取中间文本(html, start_str, end): 19 | start = html.find(start_str) 20 | if start >= 0: 21 | start += len(start_str) 22 | end = html.find(end, start) 23 | if end >= 0: 24 | return html[start:end].strip() 25 | 26 | def generate_random_string(length=50): 27 | return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) 28 | 29 | 30 | def get_ck_usid(ck1): 31 | #print(ck1) 32 | #id = 取中间文本(ck1, "USERID=",";") 33 | #if id != "": 34 | #return id 35 | #else: 36 | #return '账号' 37 | 38 | key_value_pairs = ck1.split(";") 39 | for pair in key_value_pairs: 40 | if pair.find("==") == -1: 41 | key, value = pair.split("=") 42 | if key == "USERID": 43 | return value 44 | else: 45 | return '账号' 46 | 47 | 48 | class TYT: 49 | def __init__(self, cki): 50 | self.name = None 51 | self.cki = self.tq(cki) 52 | self.uid = self.cki.get("unb") 53 | self.sid = self.cki.get("cookie2") 54 | self.name1 = get_ck_usid(cki) 55 | 56 | def tq(self, txt): 57 | try: 58 | txt = txt.replace(" ", "") 59 | pairs = txt.split(";")[:-1] 60 | ck_json = {} 61 | for i in pairs: 62 | ck_json[i.split("=")[0]] = i.split("=")[1] 63 | return ck_json 64 | except Exception as e: 65 | print(f'❎Cookie解析错误: {e}') 66 | return {} 67 | 68 | def xsign(self, api, data, uid, sid, wua, v): 69 | body = { 70 | "data": data, 71 | "api": api, 72 | "pageId": '', 73 | "uid": uid, 74 | 'sid': sid, 75 | "deviceId": '', 76 | "utdid": '', 77 | "wua": wua, 78 | 'ttid': '1551089129819@eleme_android_10.14.3', 79 | "v": v 80 | } 81 | 82 | try: 83 | r = requests.post( 84 | "接口", 85 | json=body 86 | ) 87 | r.raise_for_status() 88 | return r.json() 89 | except requests.exceptions.HTTPError as e: 90 | print(f'❎请求签名服务器失败: {e}') 91 | return None 92 | except requests.exceptions.RequestException as e: 93 | print(f'❎请求签名服务器错误: {e}') 94 | return None 95 | 96 | def req(self, api, data, uid, sid, wua='False', v="1.0"): 97 | try: 98 | if type(data) == dict: 99 | data = json.dumps(data) 100 | wua = str(wua) 101 | sign = self.xsign(api, data, uid, sid, wua, v) 102 | url = f"{host}/gw/{api}/{v}/" 103 | headers = { 104 | "x-sgext": quote(sign.get('x-sgext')), 105 | "x-sign": quote(sign.get('x-sign')), 106 | 'x-sid': sid, 107 | 'x-uid': uid, 108 | 'x-pv': '6.3', 109 | 'x-features': '1051', 110 | 'x-mini-wua': quote(sign.get('x-mini-wua')), 111 | 'content-type': 'application/x-www-form-urlencoded;charset=UTF-8', 112 | 'x-t': sign.get('x-t'), 113 | 'x-extdata': 'openappkey%3DDEFAULT_AUTH', 114 | 'x-ttid': '1551089129819@eleme_android_10.14.3', 115 | 'x-utdid': '', 116 | 'x-appkey': '24895413', 117 | 'x-devid': '', 118 | } 119 | 120 | params = {"data": data} 121 | if 'wua' in sign: 122 | params["wua"] = sign.get('wua') 123 | 124 | max_retries = 5 125 | retries = 0 126 | while retries < max_retries: 127 | try: 128 | res = requests.post(url, headers=headers, data=params, timeout=5) 129 | return res 130 | except requests.exceptions.Timeout: 131 | print("❎接口请求超时") 132 | except requests.exceptions.RequestException as e: 133 | print(f"❎请求异常: {e}") 134 | retries += 1 135 | print(f"❎重试次数: {retries}") 136 | if retries >= max_retries: 137 | print("❎重试次数上限") 138 | return None 139 | except Exception as e: 140 | print(f'❎请求接口失败: {e}') 141 | return None 142 | 143 | def login(self): 144 | api1 = 'mtop.alsc.user.detail.query' 145 | data1 = json.dumps({}) 146 | try: 147 | res1 = self.req(api1, data1, self.uid, self.sid, "1.0") 148 | if res1.json()['ret'][0] == 'SUCCESS::调用成功': 149 | self.name = res1.json()["data"]["encryptMobile"] 150 | api = 'mtop.koubei.interaction.center.common.queryintegralproperty.v2' 151 | data = json.dumps({"templateIds": "[\"1404\"]"}) 152 | try: 153 | res = self.req(api, data, self.uid, self.sid, "1.0") 154 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 155 | print(f'[{self.name}] ✅登录成功,乐园币----[{res.json()["data"]["data"]["1404"]["count"]}]') 156 | return True 157 | else: 158 | if res.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 159 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 160 | return False 161 | else: 162 | print(f'[{self.name1}] ❌登录失败,原因:{res.text}') 163 | return False 164 | except Exception as e: 165 | print(f"[{self.name1}] ❎登录失败: {e}") 166 | return False 167 | else: 168 | if res1.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 169 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 170 | return False 171 | else: 172 | print(f'[{self.name1}] ❌登录失败,原因:{res1.text}') 173 | return False 174 | except Exception as e: 175 | print(f"[{self.name1}] ❎登录失败: {e}") 176 | return False 177 | 178 | def game_grid_jump(self, jump_count): 179 | grid_data = [] 180 | prev_end_config_info = None 181 | for i in range(jump_count): 182 | start_grid_id = i 183 | end_grid_id = i + 1 184 | jump_time = random.randint(500, 1000) 185 | start_coordinates = (random.uniform(0, 5), random.uniform(0, 5)) 186 | end_coordinates = (random.uniform(0, 5), random.uniform(0, 5)) 187 | 188 | if i > 0: 189 | start_config_info = prev_end_config_info 190 | else: 191 | start_config_info = generate_random_string() 192 | 193 | end_config_info = generate_random_string() 194 | jump_interval = random.randint(1000, 5000) 195 | 196 | grid_data.append({ 197 | "startGridId": start_grid_id, 198 | "endGridId": end_grid_id, 199 | "jumpTime": jump_time, 200 | "startCoordinatesX": str(start_coordinates[0]), 201 | "startCoordinatesY": str(start_coordinates[1]), 202 | "endCoordinatesX": str(end_coordinates[0]), 203 | "endCoordinatesY": str(end_coordinates[1]), 204 | "startConfigInfo": start_config_info, 205 | "endConfigInfo": end_config_info, 206 | "jumpInterval": jump_interval 207 | }) 208 | 209 | prev_end_config_info = end_config_info 210 | return grid_data 211 | 212 | def task(self): 213 | api = 'mtop.ele.biz.growth.task.core.querytask' 214 | data = json.dumps({"bizScene": "JUMP_GAME", "accountPlan": "HAVANA_COMMON", "missionCollectionId": "1265", 215 | "locationInfos": "[\"{\\\"lng\\\":\\\"105.754581\\\",\\\"lat\\\":\\\"30.60041\\\"}\"]", 216 | "missionIds": "[22562022,22562021]"}) 217 | try: 218 | res = self.req(api, data, self.uid, self.sid, "1.0") 219 | if res.json()['ret'][0] == 'SUCCESS::接口调用成功': 220 | if res.json()["data"]["mlist"][0]["stage"]['count'] < 5: 221 | count = 5 - int(res.json()["data"]["mlist"][0]["stage"]['count']) 222 | for _ in range(int(count)): 223 | api = 'mtop.ele.biz.growth.task.event.pageview' 224 | data = json.dumps({"collectionId": "1265", "missionId": "22562021", "actionCode": "PAGEVIEW", 225 | "pageFrom": "a2ogi.bx1161372", "viewTime": "15", "bizScene": "JUMP_GAME", 226 | "accountPlan": "KB_ORCHARD", "sync": "false", 227 | "asac": "2A23B18B2HYMDVFDDOXP2F"}) 228 | try: 229 | res1 = self.req(api, data, self.uid, self.sid, "1.0") 230 | except Exception as e: 231 | print(f"[{self.name}] ❎请求失败") 232 | return None 233 | except Exception as e: 234 | print(f"[{self.name}] ❎请求失败") 235 | 236 | api = 'mtop.ele.biz.growth.task.core.querytask' 237 | data = json.dumps({"bizScene": "JUMP_GAME", "accountPlan": "HAVANA_COMMON", "missionCollectionId": "1265", 238 | "locationInfos": "[\"{\\\"lng\\\":\\\"105.754581\\\",\\\"lat\\\":\\\"30.60041\\\"}\"]", 239 | "missionIds": "[22562022,22562021]"}) 240 | try: 241 | res = self.req(api, data, self.uid, self.sid, "1.0") 242 | if res.json()['ret'][0] == 'SUCCESS::接口调用成功': 243 | for y in res.json()['data']['mlist']: 244 | for o in y['missionStageDTOS']: 245 | if o['rewardStatus'] == "TODO" and o['status'] == "FINISH": 246 | if o['rewards'][0]['name'] == "游戏次数": 247 | api1 = 'mtop.ele.biz.growth.task.core.receiveprize' 248 | data1 = json.dumps( 249 | {"bizScene": "JUMP_GAME", "missionCollectionId": "1265", "missionId": "22562021", 250 | "locationInfos": "[\"{\\\"lng\\\":\\\"105.754353\\\",\\\"lat\\\":\\\"30.600449\\\"}\"]", 251 | "count": o['stageCount'], "asac": "2A23B18B2HYMDVFDDOXP2F"}) 252 | try: 253 | res1 = self.req(api1, data1, self.uid, self.sid, "1.0") 254 | if res1 is None: 255 | continue 256 | data = res1.json()["data"] 257 | if data.get('errorMsg') is not None: 258 | print(f"[{self.name}] ❎领取奖励失败: {data['errorMsg']}") 259 | else: 260 | rlist = data.get('rlist') 261 | if rlist is not None: 262 | print(f"[{self.name}] ✅领取游戏次数成功--{rlist[0]['value']}次") 263 | else: 264 | print(f"[{self.name}] ❎{res1.json()['ret'][0]}") 265 | except Exception: 266 | print(f'请求错误') 267 | return None 268 | except Exception: 269 | print(f"[{self.name}] ❎请求失败") 270 | 271 | def startgame(self): 272 | api = 'mtop.alsc.playgame.mini.game.dispatch' 273 | data = json.dumps({"bizScene": "JUMP_GAME", "bizMethod": "start", "bizParam": "{}"}) 274 | try: 275 | res = self.req(api, data, self.uid, self.sid, "1.0") 276 | if res is None: 277 | return None 278 | if res.json()["ret"][0] == "SUCCESS::调用成功": 279 | pattern = r'"gameId":"(\w+)"' 280 | match = re.search(pattern, str(res.json())) 281 | if match: 282 | gameId = match.group(1) 283 | return gameId 284 | else: 285 | print("❎解析数据失败") 286 | return None 287 | else: 288 | if res.json()["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 289 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 290 | return None 291 | else: 292 | print(f'[{self.name1}] ❎{res.json()["ret"][0]}') 293 | return None 294 | except Exception: 295 | print(f'❎请求错误') 296 | return None 297 | 298 | def endgame(self): 299 | for i, gridId in enumerate([5, 20, 60], start=1): 300 | gameId = self.startgame() 301 | if gameId is None: 302 | return 303 | grid_jump_list = self.game_grid_jump(gridId) 304 | biz_param = { 305 | "gameId": gameId, 306 | "gridJumpList": grid_jump_list, 307 | "gridId": gridId 308 | } 309 | 310 | biz_request = { 311 | "bizScene": "JUMP_GAME", 312 | "bizMethod": "receiveReward", 313 | "bizParam": json.dumps(biz_param, separators=(',', ':')) 314 | } 315 | 316 | try: 317 | api = 'mtop.alsc.playgame.mini.game.dispatch' 318 | res = self.req(api, json.dumps(biz_request), self.uid, self.sid, "1.0") 319 | if res is None: 320 | return None 321 | res_json = res.json() 322 | if res_json["ret"][0] == "SUCCESS::调用成功": 323 | data_str = res_json['data']['data'] 324 | real_grant_value = re.search(r'"realGrantValue":(\d+)', data_str) 325 | amount = int(real_grant_value.group(1)) if real_grant_value else None 326 | if amount is not None: 327 | print(f"[{self.name}] ✅第{i}关完成,获得--{amount}乐园币") 328 | else: 329 | print(f"[{self.name}] ", res_json) 330 | print(f"[{self.name}] ❎第{i}关完成,并没有获得奖励") 331 | else: 332 | if res_json["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 333 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 334 | return None 335 | else: 336 | print(res_json["ret"][0]) 337 | return None 338 | except json.JSONDecodeError as e: 339 | print(f'[{self.name}] ❎JSON 解析错误: {e}') 340 | return None 341 | except requests.RequestException as e: 342 | print(f'[{self.name}] ❎请求错误: {e}') 343 | return None 344 | time.sleep(random.randint(1, 3)) 345 | 346 | def main(self): 347 | if self.login(): 348 | print(f"----尝试领取游戏次数----") 349 | self.task() 350 | print(f"----尝试完成闯关----") 351 | self.endgame() 352 | 353 | 354 | if __name__ == '__main__': 355 | if 'elmck' in os.environ: 356 | cookie = os.environ.get('elmck') 357 | else: 358 | print("环境变量中不存在[elmck],启用本地变量模式") 359 | cookie = ck 360 | if cookie == "": 361 | print("本地变量为空,请设置其中一个变量后再运行") 362 | exit(-1) 363 | cookies = cookie.split("&") 364 | print(f"饿了么共获取到 {len(cookies)} 个账号") 365 | for i, ck in enumerate(cookies): 366 | print(f"======开始第{i + 1}个账号======") 367 | TYT(ck).main() 368 | print("2s后进行下一个账号") 369 | time.sleep(2) 370 | -------------------------------------------------------------------------------- /ele_tjcs.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @平行绳 飞机频道:https://t.me/tigerorrose 3 | * 变量:elmck: 必填,账号cookie,短信登录面板项目地址:https://github.com/funaihui/eleWeb 4 | * cron 0 0 11 * * * 5 | * 2023.6.26 更新:首次发布; 6 | * 2023.7.7 更新:添加延时,增加 cookie 失效验证 7 | */ 8 | 9 | const { 10 | "sign": sign, 11 | "getToken": getToken, 12 | "checkCk": checkCk, 13 | "getCookies": getCookies, 14 | "getUserInfo": getUserInfo, 15 | "validateCarmeWithType": validateCarmeWithType, 16 | "wait": wait, 17 | "checkCarmeCount": checkCarmeCount, 18 | "tryCatchPromise": tryCatchPromise 19 | } = require("./common.js"); 20 | const request = require("request"); 21 | const md5 = require("md5"); 22 | const GAME_TYEP = 3; 23 | const kami = process["env"]["ELE_CARME"]; 24 | function isEmpty(_0xa5a90d) { 25 | return Object["values"](_0xa5a90d)["length"] === 0; 26 | } 27 | async function lottery(_0x49561f) { 28 | const _0x3ca203 = { 29 | "authority": "shopping.ele.me", 30 | "accept": "application/json", 31 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 32 | "cache-control": "no-cache", 33 | "content-type": "application/x-www-form-urlencoded", 34 | "origin": "https://r.ele.me", 35 | "pragma": "no-cache", 36 | "referer": "https://r.ele.me/linkgame/index.html?navType=3&spm-pre=a2ogi.13162730.zebra-ele-login-module-9089118186&spm=a13.b_activity_kb_m71293.0.0", 37 | "cookie": _0x49561f, 38 | //"x-ele-ua": "RenderWay/H5 AppName/wap Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36", 39 | //"user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" 40 | }; 41 | const _0x4ba9fe = { 42 | "bizScene": "XIAODANGJIA", 43 | "actId": "20230117134129770153614517", 44 | "uniqueId": '', 45 | "latitude": "30.17862595617771", 46 | "longitude": "120.22057268768549", 47 | "cityId": '2', 48 | "bizCode": "XIAODANGJIA", 49 | "collectionId": "20230421102945045949799658", 50 | "componentId": "20230505143809276394718532", 51 | "extParams": "{\"actId\":\"20230117134129770153614517\",\"bizScene\":\"XIAODANGJIA\",\"desc\":\"玩特级厨师挑战赛\"}", 52 | 'ua': "140#j5ux7ZvyzzWqwzo2+i+F4pN8s77dltkRQIO3QRil+Yn3wcq3bj90JrqHYHVu9Ajc4Qvzlp1zzqQUiL53Wzzx0Hw+93h/zzrb22U3lp1xzR2VV2EqlaOz2PD+VoS3xg8I1wba7X53xl82VUpji2Jpo20oiliCyZZMhx+aFhb3z6xBKJUo6ditqgIJzlXBvo3zHy952ETFQJJ4VtMblt1Rg5dK6cwi1gpgsO7bpU9tqcFbbrZp9GOwTNb6uzawxcYW4weLSQ7XJ4U/7LoSok/s/uEuOXtCCid22sUl01a8LcZBfGCH6TGTK9FPDON0BmAQHTTD+kOWs6V2AeXWJL+HZV2gXyt8W/N3T0xxs6+UHgah+Nthuf7mpQA0EEWZKpsQE4L+3F8co053zVawEqeNYdbiWEq9WRB+zTujE9bIpoJ4qA1MfJL091GI3KYCkeCxM9kuyjSpGexyNgSyYn57lvmiHroxcAuezPdEyElpAx4VHDwmWr0qKJHCt/YydEwWqyqoDhL394UXSjVCTBxEztWKF6wVtONnwT1T78KhjVKKmz/QHqzdCgyAGmhu+UY87Q3ah4C+yCkFLT/KS+i2gmBtA8k6cBYjjWEZvIXP+yYdk1w8zuJRP606RBHGrVkzJ3hv6g1G8rIJquUAWFE+v+eVlWJJUXTSv06yBe2jfe0Wu3cGnF==", 53 | "umidToken": "defaultToken3_init_callback_not_called@@https://r.ele.me/afun-chuka-ichiban/@@1687772010930", 54 | "asac": "2A22C0239QW1FOL3UUQY7U" 55 | }; 56 | const _0x1ffd1a = new Date()["getTime"](); 57 | const _0x25ced9 = 12574478; 58 | var _0xb79160 = "data=" + encodeURIComponent(JSON["stringify"](_0x4ba9fe)); 59 | const _0x49cff8 = getToken(_0x49561f); 60 | const _0x507372 = _0x49cff8["split"]('_')[0]; 61 | const _0x1776c6 = md5(_0x507372 + '&' + _0x1ffd1a + '&' + _0x25ced9 + '&' + JSON["stringify"](_0x4ba9fe), kami); 62 | const _0x4cdad7 = { 63 | "url": "https://shopping.ele.me/h5/mtop.koubei.interactioncenter.platform.right.lottery/1.0/?jsv=2.6.1&appKey=12574478&t=" + _0x1ffd1a + "&sign=" + _0x1776c6 + "&api=mtop.koubei.interactioncenter.platform.right.lottery&v=1.0&type=originaljson&dataType=json", 64 | "method": "POST", 65 | "headers": _0x3ca203, 66 | "body": _0xb79160 67 | }; 68 | return tryCatchPromise(_0x1d0c9f => { 69 | request(_0x4cdad7, async (_0x233414, _0x5f2660, _0x1714f1) => { 70 | if (!_0x233414 && _0x5f2660["statusCode"] == 200) { 71 | try { 72 | const _0xca907a = JSON["parse"](_0x1714f1); 73 | if (isEmpty(_0xca907a["data"]["data"])) { 74 | console["log"](_0xca907a["ret"][0]); 75 | _0x1d0c9f(false); 76 | } else { 77 | const _0x1709f8 = _0xca907a["data"]["data"]["sendRightList"][0]["discountInfo"]["amount"]; 78 | console["log"]("特级厨师闯关成功。获得:" + _0x1709f8, "乐园币"); 79 | if (_0x1709f8 == 1) { 80 | _0x1d0c9f(false); 81 | } else { 82 | _0x1d0c9f(true); 83 | } 84 | } 85 | } catch (_0x3750a0) { 86 | _0x1d0c9f(false); 87 | } 88 | } else { 89 | _0x1d0c9f(false); 90 | } 91 | }); 92 | }); 93 | } 94 | async function start() { 95 | //await validateCarmeWithType(kami, 1); 96 | const _0x3433f4 = getCookies("elmck"); 97 | for (let _0x192829 = 0; _0x192829 < _0x3433f4["length"]; _0x192829++) { 98 | const _0x352a5f = _0x3433f4[_0x192829]; 99 | if (!_0x352a5f) { 100 | console["log"](" ❌无效用户信息, 请重新获取ck"); 101 | } else { 102 | try { 103 | let _0x14288b = await checkCk(_0x352a5f, _0x192829); 104 | if (!_0x14288b) { 105 | continue; 106 | } 107 | let _0x4d732e = await getUserInfo(_0x14288b); 108 | if (!_0x4d732e["username"]) { 109 | console["log"]('第', _0x192829 + 1, "账号失效!请重新登录!!!😭"); 110 | continue; 111 | } 112 | const _0x39969d = _0x4d732e["user_id"]; 113 | //await checkCarmeCount(kami, _0x39969d, GAME_TYEP); 114 | console["log"]("******开始【饿了么账号", _0x192829 + 1, '】', _0x4d732e["username"], "*********"); 115 | var _0x120fe1 = await lottery(_0x14288b); 116 | console["log"]("延时 5 秒"); 117 | await wait(5); 118 | } catch (_0x2dcd3d) { 119 | console["log"](_0x2dcd3d); 120 | } 121 | } 122 | } 123 | process["exit"](0); 124 | } 125 | start(); 126 | 127 | // prettier-ignore 128 | //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) } -------------------------------------------------------------------------------- /elm.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 饿了么中央控制脚本 3 | 4 | sh set_elmenv.sh #获取elmck 5 | 6 | 7 | #node ./脚本名称.js 8 | #python ./脚本名称.py 9 | 10 | 11 | 12 | 13 | 14 | # 延时防黑 15 | delay=$(( ($RANDOM % 6) + 5 )) 16 | echo "延时 $delay 秒以防止黑号..." 17 | sleep $delay 18 | 19 | 20 | -------------------------------------------------------------------------------- /elm_lyb.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 变量:elmck: 必填,账号cookie 3 | * cron: 7 0,6,12,18,22 * * * 4 | * 修复连连看 5 | */ 6 | 7 | const $=new Env("\u5E01\u56ED\u4E50\u4E48\u4E86\u997F".split("").reverse().join(""));const{"\u0067\u0065\u0074\u0054\u006f\u006b\u0065\u006e":getToken,"\u0063\u0068\u0065\u0063\u006b\u0043\u006b":checkCk,"\u0077\u0061\u0069\u0074":wait,"\u0067\u0065\u0074\u0043\u006f\u006f\u006b\u0069\u0065\u0073":getCookies,"\u0067\u0065\u0074\u0055\u0073\u0065\u0072\u0049\u006e\u0066\u006f":getUserInfo,"\u0074\u0072\u0079\u0043\u0061\u0074\u0063\u0068\u0050\u0072\u006f\u006d\u0069\u0073\u0065":tryCatchPromise}=require("sj.nommoc/.".split("").reverse().join(""));const request=require("tseuqer".split("").reverse().join(""));const md5=require("\u006d\u0064\u0035");function isEmpty(_0x591a20){return Object["\u0076\u0061\u006c\u0075\u0065\u0073"](_0x591a20)['length']===(0x5715c^0x5715c);}async function lottery(_0x2a7333){const _0x37f589={'authority':'shopping.ele.me',"\u0061\u0063\u0063\u0065\u0070\u0074":'application/json','accept-language':"\u007a\u0068\u002d\u0043\u004e\u002c\u007a\u0068\u003b\u0071\u003d\u0030\u002e\u0039\u002c\u0065\u006e\u002d\u0055\u0053\u003b\u0071\u003d\u0030\u002e\u0038\u002c\u0065\u006e\u003b\u0071\u003d\u0030\u002e\u0037","\u0063\u0061\u0063\u0068\u0065\u002d\u0063\u006f\u006e\u0074\u0072\u006f\u006c":"\u006e\u006f\u002d\u0063\u0061\u0063\u0068\u0065",'content-type':'application/x-www-form-urlencoded','origin':'https://r.ele.me','pragma':"\u006e\u006f\u002d\u0063\u0061\u0063\u0068\u0065","\u0072\u0065\u0066\u0065\u0072\u0065\u0072":"\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u0072\u002e\u0065\u006c\u0065\u002e\u006d\u0065\u002f\u006c\u0069\u006e\u006b\u0067\u0061\u006d\u0065\u002f\u0069\u006e\u0064\u0065\u0078\u002e\u0068\u0074\u006d\u006c\u003f\u006e\u0061\u0076\u0054\u0079\u0070\u0065\u003d\u0033\u0026\u0073\u0070\u006d\u002d\u0070\u0072\u0065\u003d\u0061\u0032\u006f\u0067\u0069\u002e\u0031\u0033\u0031\u0036\u0032\u0037\u0033\u0030\u002e\u007a\u0065\u0062\u0072\u0061\u002d\u0065\u006c\u0065\u002d\u006c\u006f\u0067\u0069\u006e\u002d\u006d\u006f\u0064\u0075\u006c\u0065\u002d\u0039\u0030\u0038\u0039\u0031\u0031\u0038\u0031\u0038\u0036\u0026\u0073\u0070\u006d\u003d\u0061\u0031\u0033\u002e\u0062\u005f\u0061\u0063\u0074\u0069\u0076\u0069\u0074\u0079\u005f\u006b\u0062\u005f\u006d\u0037\u0031\u0032\u0039\u0033\u002e\u0030\u002e\u0030",'cookie':_0x2a7333,"\u0078\u002d\u0065\u006c\u0065\u002d\u0075\u0061":'RenderWay/H5\x20AppName/wap\x20Mozilla/5.0\x20(Linux;\x20Android\x208.0.0;\x20SM-G955U\x20Build/R16NW)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/87.0.4280.141\x20Mobile\x20Safari/537.36',"\u0075\u0073\u0065\u0072\u002d\u0061\u0067\u0065\u006e\u0074":'Mozilla/5.0\x20(Linux;\x20Android\x208.0.0;\x20SM-G955U\x20Build/R16NW)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/87.0.4280.141\x20Mobile\x20Safari/537.36'};const _0x47799a={"\u0061\u0063\u0074\u0049\u0064":'20221207144029906162546384','collectionId':'20230224114656384938530468',"\u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u0049\u0064":"\u0032\u0030\u0032\u0033\u0030\u0032\u0032\u0034\u0031\u0031\u0034\u0038\u0032\u0035\u0032\u0031\u0036\u0033\u0037\u0033\u0033\u0036\u0037\u0039\u0039\u0038","\u0062\u0069\u007a\u0053\u0063\u0065\u006e\u0065":'game_center','bizCode':"\u004c\u004f\u0054\u0054\u0045\u0052\u0059",'longitude':'120.21993197500706',"\u006c\u0061\u0074\u0069\u0074\u0075\u0064\u0065":'30.178378857672215','asac':'2A232091VOX6SPEQYH6RG4',"\u0065\u0078\u0074\u0050\u0061\u0072\u0061\u006d\u0073":'{\x22bizType\x22:\x22LOTTERY\x22}'};const _0x5695ee=new Date()["\u0067\u0065\u0074\u0054\u0069\u006d\u0065"]();const _0x315936=0xbfdf0e;var _0x369abd="=atad".split("").reverse().join("")+encodeURIComponent(JSON['stringify'](_0x47799a));const _0x881d98=getToken(_0x2a7333);const _0x34e5a0=_0x881d98['split']('_')[0x424e3^0x424e3];const _0x26d75a=md5(_0x34e5a0+"\u0026"+_0x5695ee+'&'+_0x315936+'&'+JSON['stringify'](_0x47799a));const _0x43bb72={"\u0075\u0072\u006c":"=t&87447521=yeKppa&1.6.2=vsj?/0.1/yrettol.thgir.mroftalp.retnecnoitcaretni.iebuok.potm/5h/moc.oaboat.m.sca-ediug//:sptth".split("").reverse().join("")+_0x5695ee+"\u0026\u0073\u0069\u0067\u006e\u003d"+_0x26d75a+"nosj=epyTatad&nosjlanigiro=epyt&0.1=v&yrettol.thgir.mroftalp.retnecnoitcaretni.iebuok.potm=ipa&".split("").reverse().join(""),'method':'POST','headers':_0x37f589,"\u0062\u006f\u0064\u0079":_0x369abd};return tryCatchPromise(_0x51ba78=>{request(_0x43bb72,async(_0x16ed8b,_0x409ead,_0x108964)=>{if(!_0x16ed8b&&_0x409ead["\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006f\u0064\u0065"]===(0x425be^0x42576)){try{const _0x13c6dc=JSON['parse'](_0x108964);if(isEmpty(_0x13c6dc["\u0064\u0061\u0074\u0061"]["\u0064\u0061\u0074\u0061"])){console['log'](_0x13c6dc["\u0072\u0065\u0074"][0x1884c^0x1884c]);_0x51ba78(![]);}else{if(_0x13c6dc['data']["\u0064\u0061\u0074\u0061"]['errorMsg']){console['log'](_0x13c6dc['data']['data']["\u0065\u0072\u0072\u006f\u0072\u004d\u0073\u0067"]);}else{let _0x2f73eb=_0x13c6dc["\u0064\u0061\u0074\u0061"]["\u0064\u0061\u0074\u0061"]["\u0073\u0065\u006e\u0064\u0052\u0069\u0067\u0068\u0074\u004c\u0069\u0073\u0074"][0x485ae^0x485ae];const _0x2880f0=_0x2f73eb['materialInfo']["\u0064\u0065\u0073\u0063\u0072\u0069\u0070\u0074\u0069\u006f\u006e"]+_0x2f73eb["\u006d\u0061\u0074\u0065\u0072\u0069\u0061\u006c\u0049\u006e\u0066\u006f"]["\u0074\u0069\u0074\u006c\u0065"];console["\u006c\u006f\u0067"](_0x2880f0);}_0x51ba78(_0x13c6dc);}}catch(_0x2f051a){_0x51ba78(![]);}}else{_0x51ba78(![]);}});});}async function lyb_sign(_0x24cd86){const _0x4ec66f=await checkCk(_0x24cd86);const _0xcfadee={"\u0061\u0075\u0074\u0068\u006f\u0072\u0069\u0074\u0079":"\u006d\u0074\u006f\u0070\u002e\u0065\u006c\u0065\u002e\u006d\u0065","\u0061\u0063\u0063\u0065\u0070\u0074":'application/json','accept-language':"\u007a\u0068\u002d\u0043\u004e\u002c\u007a\u0068\u003b\u0071\u003d\u0030\u002e\u0039\u002c\u0065\u006e\u002d\u0055\u0053\u003b\u0071\u003d\u0030\u002e\u0038\u002c\u0065\u006e\u003b\u0071\u003d\u0030\u002e\u0037",'asac':"\u0032\u0041\u0032\u0031\u0036\u0030\u0037\u004e\u0049\u0049\u0054\u0031\u004e\u0044\u0035\u0043\u0034\u0059\u0058\u004a\u0036\u0043",'cache-control':'no-cache',"\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u002d\u0074\u0079\u0070\u0065":'application/x-www-form-urlencoded',"\u006f\u0072\u0069\u0067\u0069\u006e":'https://tb.ele.me',"\u0070\u0072\u0061\u0067\u006d\u0061":"\u006e\u006f\u002d\u0063\u0061\u0063\u0068\u0065","\u0072\u0065\u0066\u0065\u0072\u0065\u0072":'https://tb.ele.me/wow/alsc/mod/b9ee9e6451bc8eda7a6afcbb?spm=a2ogi.13162730.zebra-ele-login-module-9089118186&spm=a2ogi.13162730.zebra-ele-login-module-9089118186&spm-pre=a13.b_activity_kb_m71293.ebridge.login',"\u0063\u006f\u006f\u006b\u0069\u0065":_0x4ec66f,'user-agent':'Mozilla/5.0\x20(Linux;\x20Android\x208.0.0;\x20SM-G955U\x20Build/R16NW)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/87.0.4280.141\x20Mobile\x20Safari/537.36'};const _0x502234=new Date()['getTime']();const _0x165860=0xbfdf0e;const _0x57005c={'bizScene':"\u0067\u0061\u006d\u0065\u005f\u0063\u0065\u006e\u0074\u0065\u0072","\u0061\u0073\u0061\u0063":"\u0032\u0041\u0032\u0031\u0036\u0030\u0037\u004e\u0049\u0049\u0054\u0031\u004e\u0044\u0035\u0043\u0034\u0059\u0058\u004a\u0036\u0043","\u0075\u006d\u0069\u0064\u0074\u006f\u006b\u0065\u006e":"@@bbcfa6a7ade8cb1546e9ee9b/dom/csla/wow/em.ele.bt//:sptth@@tuoemit htiw deliaf_daol_2nekoTtluafed".split("").reverse().join("")+_0x502234};var _0x436165="=atad".split("").reverse().join("")+encodeURIComponent(JSON["\u0073\u0074\u0072\u0069\u006e\u0067\u0069\u0066\u0079"](_0x57005c));const _0x4d6ee1=getToken(_0x4ec66f);const _0x26b3ee=_0x4d6ee1["\u0073\u0070\u006c\u0069\u0074"]('_')[0xcaaba^0xcaaba];const _0x4ee849=md5(_0x26b3ee+"\u0026"+_0x502234+'&'+_0x165860+"\u0026"+JSON['stringify'](_0x57005c));const _0x3db8af={'url':"\u0068\u0074\u0074\u0070\u0073\u003a\u002f\u002f\u006d\u0074\u006f\u0070\u002e\u0065\u006c\u0065\u002e\u006d\u0065\u002f\u0068\u0035\u002f\u006d\u0074\u006f\u0070\u002e\u006b\u006f\u0075\u0062\u0065\u0069\u002e\u0069\u006e\u0074\u0065\u0072\u0061\u0063\u0074\u0069\u006f\u006e\u0063\u0065\u006e\u0074\u0065\u0072\u002e\u0073\u0069\u0067\u006e\u002e\u0063\u006f\u006d\u0070\u006f\u006e\u0065\u006e\u0074\u002e\u0072\u0065\u0063\u006f\u0072\u0064\u0073\u0069\u0067\u006e\u0069\u006e\u002f\u0031\u002e\u0030\u002f\u0035\u002e\u0030\u002f\u003f\u006a\u0073\u0076\u003d\u0032\u002e\u0037\u002e\u0031\u0026\u0061\u0070\u0070\u004b\u0065\u0079\u003d\u0031\u0032\u0035\u0037\u0034\u0034\u0037\u0038\u0026\u0074\u003d"+_0x502234+'&sign='+_0x4ee849+"141.0824.0.78_emorhc_diordna04%5h=dittces&C6JXY4C5DN1TIIN70612A2=casa&0.5=VS&pnosj=epyTatad&eurt=tseuqeRnigoL&eurt=nigoLdeen&gnirts=epyTeulav&nosj=epyt&1=edoce&0.1=v&ningisdrocer.tnenopmoc.ngis.retnecnoitcaretni.iebuok.potm=ipa&".split("").reverse().join(""),"\u006d\u0065\u0074\u0068\u006f\u0064":"\u0050\u004f\u0053\u0054",'headers':_0xcfadee,'body':_0x436165};return tryCatchPromise(_0x203200=>{request(_0x3db8af,async(_0x272115,_0x1c441d,_0x179163)=>{if(!_0x272115&&_0x1c441d['statusCode']==(0x7267b^0x726b3)){const _0x533317=JSON['parse'](_0x179163);if(_0x533317['data']['errorMsg']){console['log'](_0x533317['data']['errorMsg']);}else{console['log']("\u529F\u6210\u5230\u7B7E".split("").reverse().join(""));}_0x203200(_0x533317);}else{_0x203200(null);}});});}async function lyb_llk_token(_0x439987){const _0x2f601c={'bizScene':'LIANLIANKAN','bizMethod':'login','bizParam':'{\x22inviterId\x22:null,\x22gameId\x22:null,\x22token\x22:\x22token\x22}','longitude':114.174328,'latitude':22.316555};const _0x470dc0=await gameRequest(_0x439987,_0x2f601c);return _0x470dc0['data']['token'];}async function lyb_llk_gamecode(_0x38c94c,_0x245e6e){const _0x273bc4={"\u0062\u0069\u007a\u0053\u0063\u0065\u006e\u0065":'LIANLIANKAN','bizMethod':'startGameV2','bizParam':'{\x22gameId\x22:null,\x22token\x22:\x22'+_0x245e6e+'\x22}','longitude':114.174328,'latitude':22.316555};const _0x8b94cf=await gameRequest(_0x38c94c,_0x273bc4);if(_0x8b94cf['bizErrorMsg']!='success'){console['log'](_0x8b94cf['bizErrorMsg']);return null;}return _0x8b94cf["\u0064\u0061\u0074\u0061"]['gameCode'];}async function lyb_llk_passgame(_0xf45113,_0x38b9fe,_0x5456b3){const _0x2d9a39={"\u0062\u0069\u007a\u0053\u0063\u0065\u006e\u0065":"\u004c\u0049\u0041\u004e\u004c\u0049\u0041\u004e\u004b\u0041\u004e",'bizMethod':'settlement','bizParam':"\":\"edoCemag\"{".split("").reverse().join("")+_0x38b9fe+"\":\"nekot\",llun:\"dIemag\",15304:\"emiTleveLssap\",\"".split("").reverse().join("")+_0x5456b3+'\x22}'};const _0x32ca44=await gameRequest(_0xf45113,_0x2d9a39);if(_0x32ca44['bizErrorMsg']!='success'){console['log'](_0x32ca44['bizErrorMsg']);return null;}return _0x32ca44['data']['lastLevelId'];}async function gameRequest(_0x5c4a15,_0x293db2){const _0x1de928={"\u0061\u0075\u0074\u0068\u006f\u0072\u0069\u0074\u0079":'shopping.ele.me',"\u0061\u0063\u0063\u0065\u0070\u0074":'application/json','accept-language':'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7','cache-control':'no-cache',"\u0063\u006f\u006e\u0074\u0065\u006e\u0074\u002d\u0074\u0079\u0070\u0065":"\u0061\u0070\u0070\u006c\u0069\u0063\u0061\u0074\u0069\u006f\u006e\u002f\u0078\u002d\u0077\u0077\u0077\u002d\u0066\u006f\u0072\u006d\u002d\u0075\u0072\u006c\u0065\u006e\u0063\u006f\u0064\u0065\u0064",'origin':'https://r.ele.me','pragma':'no-cache','referer':'https://r.ele.me/linkgame/index.html?navType=3&spm-pre=a2ogi.13162730.zebra-ele-login-module-9089118186&spm=a13.b_activity_kb_m71293.0.0','cookie':_0x5c4a15,'x-ele-ua':'RenderWay/H5\x20AppName/wap\x20Mozilla/5.0\x20(Linux;\x20Android\x208.0.0;\x20SM-G955U\x20Build/R16NW)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/87.0.4280.141\x20Mobile\x20Safari/537.36','user-agent':'Mozilla/5.0\x20(Linux;\x20Android\x208.0.0;\x20SM-G955U\x20Build/R16NW)\x20AppleWebKit/537.36\x20(KHTML,\x20like\x20Gecko)\x20Chrome/87.0.4280.141\x20Mobile\x20Safari/537.36'};const _0x34fa44=new Date()["\u0067\u0065\u0074\u0054\u0069\u006d\u0065"]();const _0x173b76=0xbfdf0e;var _0x5976a2="=atad".split("").reverse().join("")+encodeURIComponent(JSON['stringify'](_0x293db2));const _0x4e9995=getToken(_0x5c4a15);const _0x3f9a68=_0x4e9995['split']('_')[0x0];const _0x282679=md5(_0x3f9a68+'&'+_0x34fa44+'&'+_0x173b76+"\u0026"+JSON['stringify'](_0x293db2));const _0x2e5dc4={'url':'https://shopping.ele.me/h5/mtop.alsc.playgame.mini.game.dispatch/1.0/?jsv=2.6.1&appKey=12574478&t='+_0x34fa44+'&sign='+_0x282679+'&api=mtop.alsc.playgame.mini.game.dispatch&v=1.0&type=originaljson&dataType=json&timeout=5000&subDomain=shopping&mainDomain=ele.me&H5Request=true&pageDomain=ele.me&ttid=h5%40chrome_android_87.0.4280.141&SV=5.0','method':'POST','headers':_0x1de928,'body':_0x5976a2};return tryCatchPromise(_0x57f3b2=>{request(_0x2e5dc4,async(_0x5bbc13,_0x42298e,_0x37c3cc)=>{if(!_0x5bbc13&&_0x42298e['statusCode']==(0xa5b85^0xa5b4d)){try{const _0x470bb4=JSON['parse'](_0x37c3cc);const _0x87f7ce=JSON['parse'](_0x470bb4['data']["\u0064\u0061\u0074\u0061"]);_0x57f3b2(_0x87f7ce);}catch(_0x396c6a){console['log'](_0x37c3cc);_0x57f3b2(null);}}else{_0x57f3b2(null);}});});}async function llk_game(_0x25bfaf,_0x3cbc40){const _0x5e5e02=await lyb_llk_gamecode(_0x25bfaf,_0x3cbc40);if(_0x5e5e02){let _0x49e6f6=await lyb_llk_passgame(_0x25bfaf,_0x5e5e02,_0x3cbc40);console['log']('连连看第'+_0x49e6f6+'关闯关成功');console['log']('随机等待5-10s');await wait(getRandom(0x5,0xa));if(_0x49e6f6===0x3){return;}else{await llk_game(_0x25bfaf,_0x3cbc40);}}else{console['log']("\u8FC7\u6210\u5B8C\u5DF2\u770B\u8FDE\u8FDE".split("").reverse().join(""));}}async function water_login(_0x1f943d){const _0x22a643={"\u0062\u0069\u007a\u0053\u0063\u0065\u006e\u0065":'WATER_SORT','bizParam':'{\x22type\x22:\x22login\x22}','bizMethod':'login'};const _0x2d2d31=await gameRequest(_0x1f943d,_0x22a643);return _0x2d2d31;}async function water_game_success(_0x5605a4){const _0x320ec5={'bizScene':"\u0057\u0041\u0054\u0045\u0052\u005f\u0053\u004f\u0052\u0054",'bizParam':'{\x22type\x22:\x22gameSuccess\x22}','bizMethod':'gameSuccess'};const _0x3d4a5f=await gameRequest(_0x5605a4,_0x320ec5);return _0x3d4a5f;}async function water_reward(_0x381a2a,_0x45fe93){const _0x5b7071={'bizScene':'WATER_SORT','bizParam':'{\x22type\x22:\x22getPassPrize\x22,\x22data\x22:{\x22addNum\x22:\x22'+_0x45fe93+"}}1:\"epyt\",\"".split("").reverse().join(""),'bizMethod':'getPassPrize'};const _0x2a1757=await gameRequest(_0x381a2a,_0x5b7071);return _0x2a1757;}async function water_game(_0x3ee10c){const _0x27e9b3=await water_login(_0x3ee10c);const _0x50f5a3=_0x27e9b3['passConf'];const _0x50e194=[];for(let _0x3ac6d8 of Object['values'](_0x50f5a3)){_0x50e194['push'](_0x3ac6d8['passNum']);}var _0x55c700=await water_game_success(_0x3ee10c);var _0x194b12=_0x55c700['info']['todayPass'];var _0x4ba1ef=0x0;while(_0x194b12<=_0x50e194[_0x50e194["\u006c\u0065\u006e\u0067\u0074\u0068"]-0x1]){_0x55c700=await water_game_success(_0x3ee10c);_0x194b12=_0x55c700['info']["\u0074\u006f\u0064\u0061\u0079\u0050\u0061\u0073\u0073"];console['log']("\u6b22\u4e50\u5012\u6c34\u7b2c"+_0x194b12+'关闯关成功');if(_0x50e194['includes'](_0x194b12)){_0x4ba1ef=_0x50e194['indexOf'](_0x194b12)+(0x263ae^0x263af);const _0x499012=await water_reward(_0x3ee10c,_0x4ba1ef);console['log']("\uFF1A\u5F97\u83B7".split("").reverse().join("")+_0x499012['goldnum']+"\u5E01\u56ED\u4E50".split("").reverse().join(""));}}console['log']("\u6210\u5B8C\u5173\u95EF\u6C34\u5012\u4E50\u5FEB".split("").reverse().join(""));}async function start(){const _0x1612bb=getCookies();for(let _0x18c297=0x0;_0x18c297<_0x1612bb['length'];_0x18c297++){const _0x5ed52b=_0x1612bb[_0x18c297];if(!_0x5ed52b){console['log']('\x20❌无效用户信息,\x20请重新获取ck');}else{try{let _0xaeedd3=await checkCk(_0x5ed52b,_0x18c297);if(!_0xaeedd3){continue;}let _0x55835b=await getUserInfo(_0xaeedd3);if(!_0x55835b['username']){console["\u006c\u006f\u0067"]("\u7b2c",_0x18c297+0x1,"\uDE2D\uD83D\uFF01\uFF01\uFF01\u5F55\u767B\u65B0\u91CD\u8BF7\uFF01\u6548\u5931\u53F7\u8D26".split("").reverse().join(""));continue;}const _0x266e75=_0x55835b['user_id'];console['log']("\u53F7\u8D26\u4E48\u4E86\u997F\u3010\u59CB\u5F00******".split("").reverse().join(""),_0x18c297+(0x66f1e^0x66f1f),"\u3011",_0x55835b['username'],"*********".split("").reverse().join(""));await lyb_sign(_0xaeedd3);await lottery(_0xaeedd3);const _0x402827=await lyb_llk_token(_0xaeedd3);await llk_game(_0xaeedd3,_0x402827);await llk_game(_0xaeedd3,_0x402827);await water_game(_0xaeedd3);console['log']("\u5E05\u6700\u79E6\u8001".split("").reverse().join(""));await wait(getRandom(0x5,0xa));}catch(_0x54faf5){console['log'](_0x54faf5);}}}process['exit'](0x0);}start();function getRandom(_0x3bfe5c,_0x38370c){return Math['floor'](Math["\u0072\u0061\u006e\u0064\u006f\u006d"]()*(_0x38370c-_0x3bfe5c+0x1)+_0x3bfe5c);}function Env(_0x1759e6,_0x1c342e){"denifednu".split("").reverse().join("")!=typeof process&&JSON['stringify'](process['env'])['indexOf']('GITHUB')>-(0xee163^0xee162)&&process['exit'](0x87ef4^0x87ef4);class _0x5b3a29{constructor(_0x282ebc){this['env']=_0x282ebc;}["dnes".split("").reverse().join("")](_0x2629a2,_0x211493="TEG".split("").reverse().join("")){_0x2629a2="gnirts".split("").reverse().join("")==typeof _0x2629a2?{'url':_0x2629a2}:_0x2629a2;let _0x5a2f16=this['get'];return'POST'===_0x211493&&(_0x5a2f16=this['post']),new Promise((_0x178f13,_0x51b2d5)=>{_0x5a2f16['call'](this,_0x2629a2,(_0x22a257,_0x4e7aa2,_0x4fc604)=>{_0x22a257?_0x51b2d5(_0x22a257):_0x178f13(_0x4e7aa2);});});}['get'](_0x291e00){return this['send']["\u0063\u0061\u006c\u006c"](this['env'],_0x291e00);}['post'](_0x165de7){return this['send']['call'](this['env'],_0x165de7,'POST');}}return new class{constructor(_0x3a94a2,_0x19b7e2){this['name']=_0x3a94a2,this['http']=new _0x5b3a29(this),this['data']=null,this['dataFile']="tad.xob".split("").reverse().join(""),this['logs']=[],this['isMute']=!(0xa818d^0xa818c),this["\u0069\u0073\u004e\u0065\u0065\u0064\u0052\u0065\u0077\u0072\u0069\u0074\u0065"]=!(0x71b15^0x71b14),this['logSeparator']='\x0a',this['startTime']=new Date()['getTime'](),Object['assign'](this,_0x19b7e2),this["\u006c\u006f\u0067"]('',"\uDD14\uD83D".split("").reverse().join("")+this['name']+',\x20开始!');}['isNode'](){return'undefined'!=typeof module&&!!module['exports'];}['isQuanX'](){return"denifednu".split("").reverse().join("")!=typeof $task;}['isSurge'](){return'undefined'!=typeof $httpClient&&'undefined'==typeof $loon;}["nooLsi".split("").reverse().join("")](){return'undefined'!=typeof $loon;}["jbOot".split("").reverse().join("")](_0x564fe,_0x5d93da=null){try{return JSON['parse'](_0x564fe);}catch{return _0x5d93da;}}['toStr'](_0x369925,_0x335381=null){try{return JSON["\u0073\u0074\u0072\u0069\u006e\u0067\u0069\u0066\u0079"](_0x369925);}catch{return _0x335381;}}["nosjteg".split("").reverse().join("")](_0x213f5b,_0xc5b94e){let _0x39d3cb=_0xc5b94e;const _0x296ff6=this['getdata'](_0x213f5b);if(_0x296ff6)try{_0x39d3cb=JSON['parse'](this['getdata'](_0x213f5b));}catch{}return _0x39d3cb;}['setjson'](_0x4932e3,_0x2ecc6e){try{return this['setdata'](JSON['stringify'](_0x4932e3),_0x2ecc6e);}catch{return!(0x2c927^0x2c926);}}['getScript'](_0x1a32d1){return new Promise(_0x1d598b=>{this['get']({'url':_0x1a32d1},(_0x532d08,_0x44a9f8,_0x3a17f3)=>_0x1d598b(_0x3a17f3));});}['runScript'](_0x469436,_0x6dc920){return new Promise(_0x2f9842=>{let _0x3d519d=this['getdata']("ipaptth.sgfCresu_sjxob_yvahc@".split("").reverse().join(""));_0x3d519d=_0x3d519d?_0x3d519d['replace'](/\n/g,'')['trim']():_0x3d519d;let _0xb150d4=this["\u0067\u0065\u0074\u0064\u0061\u0074\u0061"]("\u0040\u0063\u0068\u0061\u0076\u0079\u005f\u0062\u006f\u0078\u006a\u0073\u005f\u0075\u0073\u0065\u0072\u0043\u0066\u0067\u0073\u002e\u0068\u0074\u0074\u0070\u0061\u0070\u0069\u005f\u0074\u0069\u006d\u0065\u006f\u0075\u0074");_0xb150d4=_0xb150d4?0x1*_0xb150d4:0x14,_0xb150d4=_0x6dc920&&_0x6dc920['timeout']?_0x6dc920['timeout']:_0xb150d4;const[_0x9bcfd0,_0x533f9c]=_0x3d519d['split']('@'),_0x388212={'url':"\u0068\u0074\u0074\u0070\u003a\u002f\u002f"+_0x533f9c+"etaulave/gnitpircs/1v/".split("").reverse().join(""),'body':{'script_text':_0x469436,'mock_type':'cron','timeout':_0xb150d4},'headers':{'X-Key':_0x9bcfd0,"\u0041\u0063\u0063\u0065\u0070\u0074":'*/*'}};this["\u0070\u006f\u0073\u0074"](_0x388212,(_0x50b05c,_0x7a22f8,_0xa79ec2)=>_0x2f9842(_0xa79ec2));})['catch'](_0x4a3d21=>this['logErr'](_0x4a3d21));}["ataddaol".split("").reverse().join("")](){if(!this["\u0069\u0073\u004e\u006f\u0064\u0065"]())return{};{this['fs']=this['fs']?this['fs']:require("sf".split("").reverse().join("")),this['path']=this['path']?this['path']:require('path');const _0x1b9854=this['path']['resolve'](this['dataFile']),_0x577cd7=this['path']['resolve'](process['cwd'](),this['dataFile']),_0xb95263=this['fs']["\u0065\u0078\u0069\u0073\u0074\u0073\u0053\u0079\u006e\u0063"](_0x1b9854),_0x10fb39=!_0xb95263&&this["\u0066\u0073"]['existsSync'](_0x577cd7);if(!_0xb95263&&!_0x10fb39)return{};{const _0x343a27=_0xb95263?_0x1b9854:_0x577cd7;try{return JSON['parse'](this["\u0066\u0073"]['readFileSync'](_0x343a27));}catch(_0x3e606f){return{};}}}}['writedata'](){if(this['isNode']()){this['fs']=this['fs']?this["\u0066\u0073"]:require("\u0066\u0073"),this['path']=this['path']?this['path']:require('path');const _0x18f8dd=this['path']["\u0072\u0065\u0073\u006f\u006c\u0076\u0065"](this['dataFile']),_0x51f039=this['path']['resolve'](process['cwd'](),this['dataFile']),_0x421d4c=this['fs']['existsSync'](_0x18f8dd),_0x4892e0=!_0x421d4c&&this["\u0066\u0073"]['existsSync'](_0x51f039),_0x1003bb=JSON["\u0073\u0074\u0072\u0069\u006e\u0067\u0069\u0066\u0079"](this['data']);_0x421d4c?this['fs']['writeFileSync'](_0x18f8dd,_0x1003bb):_0x4892e0?this['fs']["\u0077\u0072\u0069\u0074\u0065\u0046\u0069\u006c\u0065\u0053\u0079\u006e\u0063"](_0x51f039,_0x1003bb):this['fs']['writeFileSync'](_0x18f8dd,_0x1003bb);}}['lodash_get'](_0x1f9ec4,_0x2d0253,_0x3d7e0f){const _0x4ab606=_0x2d0253['replace'](/\[(\d+)\]/g,"\u002e\u0024\u0031")['split']('.');let _0x5999bb=_0x1f9ec4;for(const _0x11ce7e of _0x4ab606)if(_0x5999bb=Object(_0x5999bb)[_0x11ce7e],void(0xb81cd^0xb81cd)===_0x5999bb)return _0x3d7e0f;return _0x5999bb;}['lodash_set'](_0x1e13e2,_0x59323f,_0x5cc069){return Object(_0x1e13e2)!==_0x1e13e2?_0x1e13e2:(Array['isArray'](_0x59323f)||(_0x59323f=_0x59323f['toString']()['match'](/[^.[\]]+/g)||[]),_0x59323f['slice'](0x9da0c^0x9da0c,-(0xd7e78^0xd7e79))['reduce']((_0x153855,_0x1c3b5c,_0x46ba72)=>Object(_0x153855[_0x1c3b5c])===_0x153855[_0x1c3b5c]?_0x153855[_0x1c3b5c]:_0x153855[_0x1c3b5c]=Math['abs'](_0x59323f[_0x46ba72+0x1])>>(0x6a90a^0x6a90a)==+_0x59323f[_0x46ba72+0x1]?[]:{},_0x1e13e2)[_0x59323f[_0x59323f['length']-0x1]]=_0x5cc069,_0x1e13e2);}["atadteg".split("").reverse().join("")](_0x240af6){let _0x10c0c4=this['getval'](_0x240af6);if(/^@/['test'](_0x240af6)){const[,_0x2a0326,_0x3ed8fc]=/^@(.*?)\.(.*?)$/['exec'](_0x240af6),_0x403016=_0x2a0326?this["\u0067\u0065\u0074\u0076\u0061\u006c"](_0x2a0326):'';if(_0x403016)try{const _0x553144=JSON['parse'](_0x403016);_0x10c0c4=_0x553144?this['lodash_get'](_0x553144,_0x3ed8fc,''):_0x10c0c4;}catch(_0x51e0be){_0x10c0c4='';}}return _0x10c0c4;}["atadtes".split("").reverse().join("")](_0x513e5c,_0x45ebf3){let _0x46e2c4=!0x1;if(/^@/["\u0074\u0065\u0073\u0074"](_0x45ebf3)){const[,_0x511ac3,_0x4bf58f]=/^@(.*?)\.(.*?)$/['exec'](_0x45ebf3),_0x55021c=this['getval'](_0x511ac3),_0x29d2a3=_0x511ac3?'null'===_0x55021c?null:_0x55021c||"\u007b\u007d":'{}';try{const _0x2eb991=JSON["\u0070\u0061\u0072\u0073\u0065"](_0x29d2a3);this["\u006c\u006f\u0064\u0061\u0073\u0068\u005f\u0073\u0065\u0074"](_0x2eb991,_0x4bf58f,_0x513e5c),_0x46e2c4=this['setval'](JSON['stringify'](_0x2eb991),_0x511ac3);}catch(_0x421fd6){const _0x327cf2={};this['lodash_set'](_0x327cf2,_0x4bf58f,_0x513e5c),_0x46e2c4=this['setval'](JSON['stringify'](_0x327cf2),_0x511ac3);}}else _0x46e2c4=this['setval'](_0x513e5c,_0x45ebf3);return _0x46e2c4;}['getval'](_0x4f8fb2){return this['isSurge']()||this['isLoon']()?$persistentStore['read'](_0x4f8fb2):this['isQuanX']()?$prefs['valueForKey'](_0x4f8fb2):this['isNode']()?(this['data']=this['loaddata'](),this['data'][_0x4f8fb2]):this['data']&&this['data'][_0x4f8fb2]||null;}["\u0073\u0065\u0074\u0076\u0061\u006c"](_0x171167,_0x5820be){return this['isSurge']()||this["\u0069\u0073\u004c\u006f\u006f\u006e"]()?$persistentStore['write'](_0x171167,_0x5820be):this['isQuanX']()?$prefs['setValueForKey'](_0x171167,_0x5820be):this['isNode']()?(this['data']=this["\u006c\u006f\u0061\u0064\u0064\u0061\u0074\u0061"](),this['data'][_0x5820be]=_0x171167,this['writedata'](),!0x0):this['data']&&this['data'][_0x5820be]||null;}['initGotEnv'](_0x2f50b9){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'](),_0x2f50b9&&(_0x2f50b9['headers']=_0x2f50b9['headers']?_0x2f50b9['headers']:{},void 0x0===_0x2f50b9['headers']['Cookie']&&void 0x0===_0x2f50b9['cookieJar']&&(_0x2f50b9['cookieJar']=this['ckjar']));}['get'](_0x47278e,_0x9411e8=()=>{}){_0x47278e['headers']&&(delete _0x47278e["\u0068\u0065\u0061\u0064\u0065\u0072\u0073"]['Content-Type'],delete _0x47278e['headers']['Content-Length']),this['isSurge']()||this['isLoon']()?(this['isSurge']()&&this['isNeedRewrite']&&(_0x47278e['headers']=_0x47278e['headers']||{},Object['assign'](_0x47278e['headers'],{'X-Surge-Skip-Scripting':!0x1})),$httpClient['get'](_0x47278e,(_0x27cad1,_0x20b0c4,_0x55a96d)=>{!_0x27cad1&&_0x20b0c4&&(_0x20b0c4['body']=_0x55a96d,_0x20b0c4["\u0073\u0074\u0061\u0074\u0075\u0073\u0043\u006f\u0064\u0065"]=_0x20b0c4['status']),_0x9411e8(_0x27cad1,_0x20b0c4,_0x55a96d);})):this['isQuanX']()?(this["\u0069\u0073\u004e\u0065\u0065\u0064\u0052\u0065\u0077\u0072\u0069\u0074\u0065"]&&(_0x47278e['opts']=_0x47278e['opts']||{},Object['assign'](_0x47278e['opts'],{'hints':!0x1})),$task['fetch'](_0x47278e)['then'](_0x51ae77=>{const{statusCode:_0x17ad06,statusCode:_0x505c7f,headers:_0xfc4036,body:_0x29ad7f}=_0x51ae77;_0x9411e8(null,{'status':_0x17ad06,'statusCode':_0x505c7f,'headers':_0xfc4036,'body':_0x29ad7f},_0x29ad7f);},_0x3aa23d=>_0x9411e8(_0x3aa23d))):this['isNode']()&&(this['initGotEnv'](_0x47278e),this['got'](_0x47278e)['on']('redirect',(_0x351234,_0x1c27f7)=>{try{if(_0x351234['headers']["\u0073\u0065\u0074\u002d\u0063\u006f\u006f\u006b\u0069\u0065"]){const _0x368c7a=_0x351234['headers']['set-cookie']['map'](this['cktough']['Cookie']['parse'])['toString']();_0x368c7a&&this["\u0063\u006b\u006a\u0061\u0072"]['setCookieSync'](_0x368c7a,null),_0x1c27f7['cookieJar']=this['ckjar'];}}catch(_0x3a1ff1){this['logErr'](_0x3a1ff1);}})['then'](_0x2ae1a3=>{const{statusCode:_0x25f1b0,statusCode:_0x432dd4,headers:_0x4d4db8,body:_0x1dbcd7}=_0x2ae1a3;_0x9411e8(null,{'status':_0x25f1b0,'statusCode':_0x432dd4,'headers':_0x4d4db8,'body':_0x1dbcd7},_0x1dbcd7);},_0x2236c7=>{const{message:_0x2d973b,response:_0x2c4c24}=_0x2236c7;_0x9411e8(_0x2d973b,_0x2c4c24,_0x2c4c24&&_0x2c4c24['body']);}));}['post'](_0x5b81c8,_0x2e6bc8=()=>{}){if(_0x5b81c8['body']&&_0x5b81c8['headers']&&!_0x5b81c8['headers']['Content-Type']&&(_0x5b81c8['headers']['Content-Type']='application/x-www-form-urlencoded'),_0x5b81c8['headers']&&delete _0x5b81c8['headers']['Content-Length'],this['isSurge']()||this['isLoon']())this['isSurge']()&&this['isNeedRewrite']&&(_0x5b81c8['headers']=_0x5b81c8['headers']||{},Object['assign'](_0x5b81c8['headers'],{'X-Surge-Skip-Scripting':!0x1})),$httpClient['post'](_0x5b81c8,(_0xfa8f5c,_0x3edb78,_0x3f4afa)=>{!_0xfa8f5c&&_0x3edb78&&(_0x3edb78['body']=_0x3f4afa,_0x3edb78['statusCode']=_0x3edb78['status']),_0x2e6bc8(_0xfa8f5c,_0x3edb78,_0x3f4afa);});else if(this['isQuanX']())_0x5b81c8['method']="\u0050\u004f\u0053\u0054",this['isNeedRewrite']&&(_0x5b81c8['opts']=_0x5b81c8['opts']||{},Object['assign'](_0x5b81c8['opts'],{'hints':!0x1})),$task['fetch'](_0x5b81c8)['then'](_0x3d3b9e=>{const{statusCode:_0x5876fd,statusCode:_0x395fb7,headers:_0x261e3b,body:_0xce0ad4}=_0x3d3b9e;_0x2e6bc8(null,{'status':_0x5876fd,'statusCode':_0x395fb7,'headers':_0x261e3b,'body':_0xce0ad4},_0xce0ad4);},_0xb2bafd=>_0x2e6bc8(_0xb2bafd));else if(this['isNode']()){this['initGotEnv'](_0x5b81c8);const{url:_0x3d5f56,..._0x513aa0}=_0x5b81c8;this['got']['post'](_0x3d5f56,_0x513aa0)['then'](_0xf5af63=>{const{statusCode:_0x4c7950,statusCode:_0x53056c,headers:_0x5b3aa0,body:_0x2f8aa9}=_0xf5af63;_0x2e6bc8(null,{'status':_0x4c7950,'statusCode':_0x53056c,'headers':_0x5b3aa0,'body':_0x2f8aa9},_0x2f8aa9);},_0x191896=>{const{message:_0x155c37,response:_0x13a0ee}=_0x191896;_0x2e6bc8(_0x155c37,_0x13a0ee,_0x13a0ee&&_0x13a0ee['body']);});}}['time'](_0x3175c3,_0x4fe252=null){const _0x34d93c=_0x4fe252?new Date(_0x4fe252):new Date();let _0x27cae4={'M+':_0x34d93c['getMonth']()+(0x73302^0x73303),'d+':_0x34d93c['getDate'](),'H+':_0x34d93c['getHours'](),'m+':_0x34d93c['getMinutes'](),'s+':_0x34d93c['getSeconds'](),'q+':Math['floor']((_0x34d93c['getMonth']()+0x3)/0x3),'S':_0x34d93c['getMilliseconds']()};/(y+)/['test'](_0x3175c3)&&(_0x3175c3=_0x3175c3['replace'](RegExp['$1'],(_0x34d93c['getFullYear']()+"".split("").reverse().join(""))['substr'](0x4-RegExp['$1']['length'])));for(let _0x2aa5eb in _0x27cae4)new RegExp('('+_0x2aa5eb+')')['test'](_0x3175c3)&&(_0x3175c3=_0x3175c3['replace'](RegExp['$1'],0x1==RegExp['$1']["\u006c\u0065\u006e\u0067\u0074\u0068"]?_0x27cae4[_0x2aa5eb]:('00'+_0x27cae4[_0x2aa5eb])['substr'](("".split("").reverse().join("")+_0x27cae4[_0x2aa5eb])['length'])));return _0x3175c3;}["gsm".split("").reverse().join("")](_0x23ef3e=_0x1759e6,_0x1a70e9="".split("").reverse().join(""),_0x3fd03a='',_0x90aa42){const _0x2f8bf7=_0x3efd50=>{if(!_0x3efd50)return _0x3efd50;if("gnirts".split("").reverse().join("")==typeof _0x3efd50)return this['isLoon']()?_0x3efd50:this['isQuanX']()?{'open-url':_0x3efd50}:this['isSurge']()?{'url':_0x3efd50}:void(0x7feca^0x7feca);if("tcejbo".split("").reverse().join("")==typeof _0x3efd50){if(this['isLoon']()){let _0x1c4df7=_0x3efd50['openUrl']||_0x3efd50['url']||_0x3efd50['open-url'],_0x2c197e=_0x3efd50['mediaUrl']||_0x3efd50['media-url'];return{'openUrl':_0x1c4df7,'mediaUrl':_0x2c197e};}if(this['isQuanX']()){let _0x38c8aa=_0x3efd50['open-url']||_0x3efd50['url']||_0x3efd50['openUrl'],_0x25d4e5=_0x3efd50['media-url']||_0x3efd50['mediaUrl'];return{'open-url':_0x38c8aa,'media-url':_0x25d4e5};}if(this['isSurge']()){let _0x3a3dc9=_0x3efd50['url']||_0x3efd50['openUrl']||_0x3efd50['open-url'];return{'url':_0x3a3dc9};}}};if(this['isMute']||(this['isSurge']()||this['isLoon']()?$notification['post'](_0x23ef3e,_0x1a70e9,_0x3fd03a,_0x2f8bf7(_0x90aa42)):this['isQuanX']()&&$notify(_0x23ef3e,_0x1a70e9,_0x3fd03a,_0x2f8bf7(_0x90aa42))),!this['isMuteLog']){let _0x4f7ca4=["".split("").reverse().join(""),'==============📣系统通知📣=============='];_0x4f7ca4['push'](_0x23ef3e),_0x1a70e9&&_0x4f7ca4['push'](_0x1a70e9),_0x3fd03a&&_0x4f7ca4['push'](_0x3fd03a),console['log'](_0x4f7ca4['join']('\x0a')),this['logs']=this['logs']['concat'](_0x4f7ca4);}}['log'](..._0x4c69e){_0x4c69e['length']>0x0&&(this['logs']=[...this['logs'],..._0x4c69e]),console['log'](_0x4c69e['join'](this['logSeparator']));}['logErr'](_0x4aa270,_0x1b0d74){const _0x740f7a=!this['isSurge']()&&!this['isQuanX']()&&!this['isLoon']();_0x740f7a?this['log']("".split("").reverse().join(""),'❗️'+this['name']+',\x20错误!',_0x4aa270['stack']):this['log']("".split("").reverse().join(""),'❗️'+this['name']+',\x20错误!',_0x4aa270);}['wait'](_0x51d2d9){return new Promise(_0x1c2948=>setTimeout(_0x1c2948,_0x51d2d9));}['done'](_0xd27aa3={}){const _0x2b3ff3=new Date()['getTime'](),_0x486788=(_0x2b3ff3-this['startTime'])/(0x3955f^0x396b7);this['log']('','🔔'+this['name']+" \uDD5B\uD83D !\u675F\u7ED3 ,".split("").reverse().join("")+_0x486788+'\x20秒'),this['log'](),(this['isSurge']()||this['isQuanX']()||this['isLoon']())&&$done(_0xd27aa3);}}(_0x1759e6,_0x1c342e);} 8 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "elm", 3 | "version": "1.0.0", 4 | "description": "elm乐园币获取程序", 5 | "main": "elm.sh", 6 | "scripts": { 7 | "start": "sh elm.sh" 8 | }, 9 | "author": "Shuying-exquisite", 10 | "license": "MIT", 11 | "dependencies": { 12 | "dotenv": "^16.0.0", 13 | "cheerio": "^1.0.0", 14 | "request": "^2.88.2", 15 | "xmldom": "^0.6.0", 16 | "axios": "^1.7.2", 17 | "node-rsa": "^1.1.1", 18 | "jsencrypt": "^3.3.2", 19 | "crypto-js": "^4.2.0", 20 | "moment": "^2.30.1", 21 | "md5": "^2.3.0", 22 | "utils": "^0.3.1" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ql.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | const got = require('got'); 4 | require('dotenv').config(); 5 | const { readFile } = require('fs/promises'); 6 | const path = require('path'); 7 | 8 | const qlDir = '/ql'; 9 | const fs = require('fs'); 10 | let Fileexists = fs.existsSync('/ql/data/config/auth.json'); 11 | let authFile=""; 12 | if (Fileexists) 13 | authFile="/ql/data/config/auth.json" 14 | else 15 | authFile="/ql/config/auth.json" 16 | //const authFile = path.join(qlDir, 'config/auth.json'); 17 | 18 | const api = got.extend({ 19 | prefixUrl: 'http://127.0.0.1:5600', 20 | retry: { limit: 0 }, 21 | }); 22 | 23 | async function getToken() { 24 | const authConfig = JSON.parse(await readFile(authFile)); 25 | return authConfig.token; 26 | } 27 | 28 | module.exports.getEnvs = async (envName='elmck') => { 29 | const token = await getToken(); 30 | const body = await api({ 31 | url: 'api/envs', 32 | searchParams: { 33 | searchValue: envName, 34 | t: Date.now(), 35 | }, 36 | headers: { 37 | Accept: 'application/json', 38 | authorization: `Bearer ${token}`, 39 | }, 40 | }).json(); 41 | return body.data; 42 | }; 43 | 44 | async function getEnvsByName(name){ 45 | const token = await getToken(); 46 | const body = await api({ 47 | url: 'api/envs', 48 | searchParams: { 49 | searchValue: name, 50 | t: Date.now(), 51 | }, 52 | headers: { 53 | Accept: 'application/json', 54 | authorization: `Bearer ${token}`, 55 | }, 56 | }).json(); 57 | return body.data; 58 | } 59 | 60 | module.exports.getEnvsByName = getEnvsByName 61 | 62 | module.exports.getEnvsCount = async () => { 63 | const data = await this.getEnvs(); 64 | return data.length; 65 | }; 66 | 67 | module.exports.addEnv = async (cookie, remarks) => { 68 | const token = await getToken(); 69 | const body = await api({ 70 | method: 'post', 71 | url: 'api/envs', 72 | params: { t: Date.now() }, 73 | json: [{ 74 | name: 'elmck', 75 | value: cookie, 76 | remarks, 77 | }], 78 | headers: { 79 | Accept: 'application/json', 80 | authorization: `Bearer ${token}`, 81 | 'Content-Type': 'application/json;charset=UTF-8', 82 | }, 83 | }).json(); 84 | return body; 85 | }; 86 | 87 | module.exports.updateEnv = async (cookie, eid, remarks,envName='elmck') => { 88 | const token = await getToken(); 89 | const body = await api({ 90 | method: 'put', 91 | url: 'api/envs', 92 | params: { t: Date.now() }, 93 | json: { 94 | name: envName, 95 | value: cookie, 96 | _id: eid, 97 | remarks, 98 | }, 99 | headers: { 100 | Accept: 'application/json', 101 | authorization: `Bearer ${token}`, 102 | 'Content-Type': 'application/json;charset=UTF-8', 103 | }, 104 | }).json(); 105 | return body; 106 | }; 107 | 108 | module.exports.updateEnv11 = async (cookie, eid, remarks,envName='elmck') => { 109 | const token = await getToken(); 110 | const body = await api({ 111 | method: 'put', 112 | url: 'api/envs', 113 | params: { t: Date.now() }, 114 | json: { 115 | name: envName, 116 | value: cookie, 117 | id: eid, 118 | remarks, 119 | }, 120 | headers: { 121 | Accept: 'application/json', 122 | authorization: `Bearer ${token}`, 123 | 'Content-Type': 'application/json;charset=UTF-8', 124 | }, 125 | }).json(); 126 | return body; 127 | }; 128 | 129 | module.exports.DisableCk = async (eid) => { 130 | const token = await getToken(); 131 | const body = await api({ 132 | method: 'put', 133 | url: 'api/envs/disable', 134 | params: { t: Date.now() }, 135 | body: JSON.stringify([eid]), 136 | headers: { 137 | Accept: 'application/json', 138 | authorization: `Bearer ${token}`, 139 | 'Content-Type': 'application/json;charset=UTF-8', 140 | }, 141 | }).json(); 142 | return body; 143 | }; 144 | 145 | module.exports.EnableCk = async (eid) => { 146 | const token = await getToken(); 147 | const body = await api({ 148 | method: 'put', 149 | url: 'api/envs/enable', 150 | params: { t: Date.now() }, 151 | body: JSON.stringify([eid]), 152 | headers: { 153 | Accept: 'application/json', 154 | authorization: `Bearer ${token}`, 155 | 'Content-Type': 'application/json;charset=UTF-8', 156 | }, 157 | }).json(); 158 | return body; 159 | }; 160 | 161 | module.exports.getstatus = async(eid) => { 162 | var envs = await getEnvsByName('elmck'); 163 | var tempid = 0; 164 | for (let i = 0; i < envs.length; i++) { 165 | tempid = 0; 166 | if (envs[i]._id) { 167 | tempid = envs[i]._id; 168 | } 169 | if (envs[i].id) { 170 | tempid = envs[i].id; 171 | } 172 | if (tempid == eid) { 173 | return envs[i].status; 174 | } 175 | } 176 | return 99; 177 | }; 178 | 179 | module.exports.getEnvById = async(eid) => { 180 | const envs = await this.getEnvs(); 181 | var tempid = 0; 182 | for (let i = 0; i < envs.length; i++) { 183 | tempid = 0; 184 | if (envs[i]._id) { 185 | tempid = envs[i]._id; 186 | } 187 | if (envs[i].id) { 188 | tempid = envs[i].id; 189 | } 190 | if (tempid == eid) { 191 | return envs[i].value; 192 | } 193 | } 194 | return ""; 195 | }; 196 | 197 | module.exports.getEnvByUserId = async (userId) => { 198 | const envs = await this.getEnvs('elmqqck'); 199 | 200 | for (let i = 0; i < envs.length; i++) { 201 | let ck = envs[i].value 202 | const user_id = ck.match(/USERID=([^; ]+)(?=;?)/) ? ck.match(/USERID=([^; ]+)(?=;?)/)[0] : '123'; 203 | 204 | if (user_id.indexOf(userId)!==-1) { 205 | return envs[i] 206 | } 207 | } 208 | return ""; 209 | }; 210 | 211 | module.exports.delEnv = async (eid) => { 212 | const token = await getToken(); 213 | const body = await api({ 214 | method: 'delete', 215 | url: 'api/envs', 216 | params: { t: Date.now() }, 217 | body: JSON.stringify([eid]), 218 | headers: { 219 | Accept: 'application/json', 220 | authorization: `Bearer ${token}`, 221 | 'Content-Type':'application/json;charset=UTF-8', 222 | }, 223 | }).json(); 224 | return body; 225 | }; 226 | -------------------------------------------------------------------------------- /set_elmenv.sh: -------------------------------------------------------------------------------- 1 | export elmck=" " 2 | -------------------------------------------------------------------------------- /吃货豆.py: -------------------------------------------------------------------------------- 1 | import hashlib 2 | import os 3 | import re 4 | import time 5 | import requests 6 | from urllib.parse import urlencode, quote 7 | 8 | host = 'https://acs.m.goofish.com' 9 | 10 | ck = '' 11 | 12 | 13 | import json 14 | import random 15 | import string 16 | 17 | 18 | def generate_random_string(length=50): 19 | return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) 20 | 21 | 22 | def reorder_ck(s: str) -> str: 23 | order = ["cookie2", "sgcookie", "unb", "USERID", "SID", "token", "utdid", "deviceId", "umt"] 24 | cookies = s.split(';') 25 | cookie_dict = {} 26 | for cookie in cookies: 27 | key_value = cookie.split('=', 1) 28 | if len(key_value) == 2: 29 | key, value = key_value 30 | cookie_dict[key.strip()] = value.strip() 31 | reordered_cookies = [] 32 | for key in order: 33 | if key in cookie_dict: 34 | reordered_cookies.append(f"{key}={cookie_dict[key]}") 35 | return ';'.join(reordered_cookies) + ';' 36 | 37 | 38 | def get_ck_usid(ck1): 39 | key_value_pairs = ck1.split(";") 40 | for pair in key_value_pairs: 41 | key, value = pair.split("=") 42 | if key == "USERID": 43 | return value 44 | else: 45 | return '账号' 46 | 47 | 48 | def hbh5tk(tk_cookie, enc_cookie, cookie_str): 49 | """ 50 | 合并带_m_h5_tk 51 | """ 52 | txt = cookie_str.replace(" ", "") 53 | txt = txt.replace("chushi;", "") 54 | if txt[-1] != ';': 55 | txt += ';' 56 | cookie_parts = txt.split(';')[:-1] 57 | updated = False 58 | for i, part in enumerate(cookie_parts): 59 | key_value = part.split('=') 60 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 61 | cookie_parts[i] = tk_cookie 62 | updated = True 63 | elif key_value[0].strip() in ["_m_h5_tk_enc", " _m_h5_tk_enc"]: 64 | cookie_parts[i] = enc_cookie 65 | updated = True 66 | 67 | if updated: 68 | return ';'.join(cookie_parts) + ';' 69 | else: 70 | return txt + tk_cookie + ';' + enc_cookie + ';' 71 | 72 | 73 | def tq(cookie_string): 74 | """ 75 | 获取_m_h5_tk 76 | """ 77 | if not cookie_string: 78 | return '-1' 79 | cookie_pairs = cookie_string.split(';') 80 | for pair in cookie_pairs: 81 | key_value = pair.split('=') 82 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 83 | return key_value[1] 84 | return '-1' 85 | 86 | 87 | def tq1(txt): 88 | """ 89 | 拆分cookie 90 | """ 91 | try: 92 | txt = txt.replace(" ", "") 93 | txt = txt.replace("zhuli;", "") 94 | txt = txt.replace("chushi;", "") 95 | txt = txt.replace("zhuli", "") 96 | if txt[-1] != ';': 97 | txt += ';' 98 | pairs = txt.split(";")[:-1] 99 | ck_json = {} 100 | for pair in pairs: 101 | key, value = pair.split("=", 1) 102 | ck_json[key] = value 103 | return ck_json 104 | except Exception as e: 105 | print(f'❎Cookie解析错误: {e}') 106 | return {} 107 | 108 | 109 | def md5(text): 110 | """ 111 | md5加密 112 | """ 113 | hash_md5 = hashlib.md5() 114 | hash_md5.update(text.encode()) 115 | return hash_md5.hexdigest() 116 | 117 | 118 | def check_cookie(cookie): 119 | url = "https://waimai-guide.ele.me/h5/mtop.alsc.personal.queryminecenter/1.0/?jsv=2.6.2&appKey=12574478" 120 | headers = { 121 | "Cookie": cookie, 122 | "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36" 123 | } 124 | 125 | try: 126 | response = requests.get(url, headers=headers) 127 | if response.status_code == 200: 128 | cookie_jar = response.cookies 129 | token = cookie_jar.get('_m_h5_tk', '') 130 | token_cookie = "_m_h5_tk=" + token 131 | enc_token = cookie_jar.get('_m_h5_tk_enc', '') 132 | enc_token_cookie = "_m_h5_tk_enc=" + enc_token 133 | cookie = hbh5tk(token_cookie, enc_token_cookie, cookie) 134 | return cookie 135 | else: 136 | return None 137 | except Exception as e: 138 | print("解析ck错误") 139 | return None 140 | 141 | 142 | class TYT: 143 | def __init__(self, cki): 144 | self.name = None 145 | self.ck = cki 146 | self.cki = tq1(cki) 147 | self.uid = self.cki.get("unb") 148 | self.sid = self.cki.get("cookie2") 149 | self.name1 = get_ck_usid(cki) 150 | if self.name1 is None: 151 | raise ValueError("❎获取USERID失败,跳过该账号") 152 | 153 | def req(self, api, data, v="1.0"): 154 | try: 155 | ck3 = check_cookie(self.ck) 156 | headers = { 157 | "authority": "shopping.ele.me", 158 | "accept": "application/json", 159 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 160 | "cache-control": "no-cache", 161 | "content-type": "application/x-www-form-urlencoded", 162 | "cookie": ck3, 163 | "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" 164 | } 165 | timestamp = int(time.time() * 1000) 166 | data_str = json.dumps(data) 167 | token = tq(ck3) 168 | token_part = token.split("_")[0] 169 | 170 | sign_str = f"{token_part}&{timestamp}&12574478&{data_str}" 171 | sign = md5(sign_str) 172 | url = f"https://guide-acs.m.taobao.com/h5/{api}/{v}/?jsv=2.6.1&appKey=12574478&t={timestamp}&sign={sign}&api={api}&v={v}&type=originaljson&dataType=json" 173 | data1 = urlencode({'data': data_str}) 174 | r = requests.post(url, headers=headers, data=data1) 175 | if r: 176 | return r 177 | else: 178 | return None 179 | except Exception as e: 180 | return None 181 | 182 | def main(self): 183 | try: 184 | if self.login(): 185 | return self.task() 186 | except Exception as e: 187 | print(f'❎登录失败: {e}') 188 | return False 189 | 190 | def login(self): 191 | amount = 0 192 | api1 = 'mtop.alsc.user.detail.query' 193 | data1 = {} 194 | try: 195 | res1 = self.req(api1, data1, "1.0") 196 | if res1.json()['ret'][0] == 'SUCCESS::调用成功': 197 | self.name = res1.json()["data"]["encryptMobile"] 198 | api = 'mtop.alibaba.svip.langrisser.query' 199 | data = { 200 | "lgrsRequestItems": "[{\"backup\":false,\"count\":1,\"data\":{\"needHead\":true,\"month\":\"\"},\"resId\":\"867018\"}]", 201 | "latitude": 30.59858, "longitude": 105.756336} 202 | try: 203 | res = self.req(api, data, "1.0") 204 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 205 | uu = res.json()['data']['data']['867018']['data'] 206 | for yyy in uu: 207 | if 'peaCount' in yyy: 208 | amount = yyy['peaCount'] 209 | print(f'[{self.name}] ✅登录成功,吃货豆----[{amount}]') 210 | return True 211 | else: 212 | if res.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 213 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 214 | return False 215 | else: 216 | print(f'[{self.name1}] ❌登录失败,原因:{res.text}') 217 | return False 218 | except Exception as e: 219 | print(f"[{self.name1}] ❎登录失败: {e}") 220 | return False 221 | else: 222 | if res1.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 223 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 224 | return False 225 | else: 226 | print(f'[{self.name1}] ❌登录失败,原因:{res1.text}') 227 | return False 228 | except Exception as e: 229 | print(f"[{self.name1}] ❎登录失败: {e}") 230 | return False 231 | 232 | def task(self): 233 | try: 234 | api = 'mtop.alibaba.svip.langrisser.query' 235 | data = {"callSource": "biz_card_main", "lgrsRequestItems": "[{\"resId\":\"224166\",\"data\":{}}]", 236 | "extra": "{\"source\":\"mtop\"}", "longitude": "105.75325090438128", 237 | "latitude": "30.597472842782736"} 238 | res = self.req(api, data, "1.0") 239 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 240 | for yyyy in res.json()['data']['data']['224166']['data']: 241 | if yyyy['rewardStatus'] == 'TODO': 242 | api1 = 'mtop.alibaba.svip.langrisser.act' 243 | data1 = { 244 | "extra": "{\"missionDefId\":" + str(yyyy[ 245 | 'distinctId']) + ",\"missionCollectionId\":36,\"missionType\":\"SIMPLESIGNIN\",\"source\":\"mtop\",\"asac\":\"2A21119A45TTVAEXP40N7N\",\"missionXId\":\"" + 246 | yyyy['missionXId'] + "\"}", 247 | "resId": "223166", "callSource": "biz_code_main", "source": "mtop", 248 | "longitude": "105.75325090438128", "latitude": "30.597472842782736"} 249 | res = self.req(api1, data1, "1.0") 250 | res1 = res.json() 251 | if 'extend' in res1['data'] and 'value' in res1['data']['extend'] and res1['ret'][ 252 | 0] == 'SUCCESS::调用成功': 253 | print(f"[{self.name}] [{yyyy['showTitle']}]✅领取成功,获得{res1['data']['extend']['value']}个吃货豆") 254 | else: 255 | if 'msgInfo' in res1['data']: 256 | print(f"[{self.name}] [{yyyy['showTitle']}]❌领取失败,原因:{res1['data']['msgInfo']}") 257 | else: 258 | print(f'[{self.name}] [{yyyy["showTitle"]}]❌领取失败{res.text}') 259 | if 'pageStageTime' in yyyy: 260 | api2 = 'mtop.ele.biz.growth.task.event.pageview' 261 | data2 = {"collectionId": "36", "missionId": yyyy['distinctId'], "actionCode": "PAGEVIEW", 262 | "pageFrom": yyyy['pageSpm'], 263 | "viewTime": "15", "bizScene": "svip", "accountPlan": "HAVANA_COMMON", "sync": "true"} 264 | res2 = self.req(api2, data2, "1.1") 265 | if res2.json()['ret'][0] == 'SUCCESS::调用成功': 266 | print(f"[{self.name}] [{yyyy['showTitle']}]✅领取成功") 267 | else: 268 | print(f'[{self.name}] [{yyyy["showTitle"]}]❌领取失败,原因:{res2.json()["ret"][0]}') 269 | except Exception as e: 270 | print(f"[{self.name}] ❌领取失败: {e}") 271 | 272 | 273 | if __name__ == '__main__': 274 | if 'elmck' in os.environ: 275 | cookie = os.environ.get('elmck') 276 | else: 277 | print("环境变量中不存在[elmck],启用本地变量模式") 278 | cookie = ck 279 | if cookie == "": 280 | print("本地变量为空,请设置其中一个变量后再运行") 281 | exit(-1) 282 | cookies = cookie.split("&") 283 | print(f"饿了么共获取到 {len(cookies)} 个账号") 284 | for i, ck in enumerate(cookies): 285 | ck = reorder_ck(ck) 286 | print(f"======开始第{i + 1}个账号======") 287 | TYT(ck).main() 288 | print("2s后进行下一个账号") 289 | time.sleep(2) 290 | -------------------------------------------------------------------------------- /总裁.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 饿了么 - 我要当总裁 3 | */ 4 | 5 | const $ = new Env('饿了么-我要当总裁'); 6 | const { 7 | cookiesToMap, 8 | elmRequestByApi, 9 | elmRequestByH5 10 | } = require('./comm'); 11 | 12 | 13 | class Task { 14 | constructor(cookie, index) { 15 | this.cookie = cookie 16 | this.cookieObject = cookiesToMap(cookie) 17 | this.uid = this.cookieObject.get('USERID') 18 | this.index = index + 1 19 | 20 | this.count = 1 21 | } 22 | 23 | // 获取token 24 | async getToken(){ 25 | const api = 'mtop.alsc.playgame.mini.game.dispatch' 26 | const data = JSON.stringify({ 27 | "bizScene": "TOBECEO", 28 | "bizMethod": "login", 29 | "bizParam": "{\"gameId\":\"\"}", 30 | "longitude": "104.09800574183464", 31 | "latitude": "30.22990694269538" 32 | }) 33 | let res = await elmRequestByH5(this.cookie, api, data); 34 | if(res.ret.indexOf('SUCCESS::调用成功') > -1){ 35 | let jsonData = JSON.parse(res.data.data) 36 | this.token = jsonData.data.token 37 | this.gameId = jsonData.data.token 38 | // console.log('获取游戏token,',this.token) 39 | // console.log('获取游戏gameId,',this.gameId) 40 | return true 41 | } 42 | console.log('['+this.uid+'] 获取 token/gameid 出错----',res.ret) 43 | return false 44 | } 45 | 46 | // 开始游戏 47 | async startGame(){ 48 | const api = 'mtop.alsc.playgame.mini.game.dispatch' 49 | const data = JSON.stringify({ 50 | "bizScene": "TOBECEO", "bizMethod": "startGame", 51 | "bizParam": "{\"gameId\":\"" + this.gameId + "\",\"token\":\"" + this.token + "\"}", 52 | "longitude": "104.09800574183464", 53 | "latitude": "30.22990694269538" 54 | }) 55 | 56 | let res = await elmRequestByH5(this.cookie, api, data); 57 | if(res.ret.indexOf('SUCCESS::调用成功') > -1){ 58 | let jsonData = JSON.parse(res.data.data) 59 | if(jsonData.bizErrorMsg == 'success'){ 60 | this.gameCode = jsonData.data.gameMatch.gameCode 61 | console.log('['+this.uid+'] 开始游戏,游戏码----') 62 | return true 63 | } 64 | console.log('['+this.uid+'] 没有游戏次数了----',jsonData.bizErrorMsg) 65 | return false 66 | } 67 | console.log('['+this.uid+'] 开始游戏出错----',res.ret) 68 | return false 69 | } 70 | 71 | // 结束游戏 72 | async endGame(){ 73 | const api = 'mtop.alsc.playgame.mini.game.dispatch' 74 | const data = JSON.stringify({ 75 | "bizScene": "TOBECEO", 76 | "bizMethod": "endGame", 77 | "bizParam": "{\"gameId\":\"" + this.gameId + "\",\"gameCode\":\"" + this.gameCode + "\",\"operationQueue\":[[4,6],[9,1],[6,4],[9,1],[1,9],[8,2],[5,5],[8,2],[2,8],[5,5],[1,9],[8,2],[5,5],[1,9],[8,2],[5,5],[8,2],[2,8],[5,5],[1,9],[8,2],[5,5],[8,2],[2,8],[5,5],[1,9],[8,2],[5,5],[8,2],[2,8],[5,5],[8,2],[2,8],[5,5],[5,5],[6,4],[3,7],[1,9],[9,1],[6,4],[3,7],[6,4],[1,9],[8,2],[5,5],[8,2],[2,8],[5,5],[1,9],[8,2],[5,5],[8,2],[2,8],[5,5],[6,4]],\"token\":\"" + this.token + "\"}", 78 | "longitude": "104.09800574183464", 79 | "latitude": "30.22990694269538" 80 | }) 81 | 82 | let res = await elmRequestByH5(this.cookie, api, data); 83 | if(res.ret.indexOf('SUCCESS::调用成功') > -1){ 84 | console.log('['+this.uid+'] 结束游戏----') 85 | return true 86 | } 87 | console.log('['+this.uid+'] 结束游戏出错----',res.ret) 88 | return false 89 | } 90 | 91 | // 看广告 92 | async getPageview(){ 93 | const api = "mtop.ele.biz.growth.task.event.pageview" 94 | const data = JSON.stringify({ 95 | "collectionId": "1477", 96 | "missionId": "25380001", 97 | "actionCode": "PAGEVIEW", 98 | "bizScene": "FOOD_ELIMINATE", 99 | "accountPlan": "KB_ORCHARD", 100 | "locationInfos": "[\"{\\\"lng\\\":\\\"-360\\\",\\\"lat\\\":\\\"-360\\\"}\"]" 101 | }) 102 | 103 | let res = await elmRequestByApi(api, data, this.cookie); 104 | if(res.ret[0] =='SUCCESS::接口调用成功'){ 105 | console.log('开始看广告----') 106 | return true 107 | } 108 | console.log('看广告出错----', res ? res.ret : 'res未定义'); 109 | return false 110 | } 111 | 112 | // 领取道具 113 | async postPageview(){ 114 | await $.wait(3000); 115 | const api = "mtop.ele.biz.growth.task.core.receiveprize" 116 | let extInfo = JSON.stringify({ 117 | "count":9, 118 | "gameId":this.gameId, 119 | "type":"GameProp", 120 | "costType":"Ads", 121 | "itemId":"D001", 122 | "token":this.token 123 | }) 124 | const data = JSON.stringify({ 125 | "missionCollectionId":"1477", 126 | "missionId":"25380001", 127 | "count":this.count, 128 | "extInfo":extInfo, 129 | "missionXId":"", 130 | "instanceId":"", 131 | "umiToken":"1", 132 | "ua":"1", 133 | "locationInfos":"[\"{\\\"lng\\\":104.09800574183464,\\\"lat\\\":30.22990694269538,\\\"city\\\":\\\"511400\\\"}\"]", 134 | "longitude":"104.09800574183464", 135 | "latitude":"30.22990694269538" 136 | }) 137 | 138 | let res = await elmRequestByApi(api, data, this.cookie); 139 | if(res.ret[0] =='SUCCESS::接口调用成功'){ 140 | console.log('['+this.uid+'] 领取道具----') 141 | return true 142 | } 143 | console.log('['+this.uid+'] 领取道具出错----',res.ret) 144 | return false 145 | 146 | } 147 | 148 | // 使用道具 149 | async usedGameProp(){ 150 | const api = 'mtop.alsc.playgame.mini.game.dispatch' 151 | const data = JSON.stringify({ 152 | "bizScene":"TOBECEO", 153 | "bizMethod":"useGameProp", 154 | "bizParam": "{\"gameId\":\"" + this.gameId + "\",\"token\":\"" + this.token + "\"}", 155 | "longitude": "104.09800574183464", 156 | "latitude": "30.22990694269538" 157 | }) 158 | 159 | let res = await elmRequestByH5(this.cookie, api, data); 160 | if(res.ret.indexOf('SUCCESS::调用成功') > -1){ 161 | let jsonData = JSON.parse(res.data.data) 162 | if(jsonData.bizErrorMsg == 'success'){ 163 | console.log('['+this.uid+'] 使用道具成功') 164 | this.count++ 165 | return true 166 | } 167 | 168 | console.log('['+this.uid+'] 使用道具出错----',jsonData.bizErrorMsg) 169 | return false 170 | } 171 | console.log('['+this.uid+'] 使用道具出错----',res.ret) 172 | return false 173 | } 174 | 175 | // 获取任务列表 176 | async getTaskList(){ 177 | const api = 'mtop.alsc.playgame.mini.game.dispatch' 178 | const data = JSON.stringify({ 179 | "bizScene":"TOBECEO", 180 | "bizMethod":"getTasks", 181 | "bizParam": JSON.stringify({ 182 | "gameId":this.gameId, 183 | "token":this.token 184 | }), 185 | "longitude": "104.09800574183464", 186 | "latitude": "30.22990694269538" 187 | }) 188 | 189 | let res = await elmRequestByH5(this.cookie, api, data); 190 | if(res.ret.indexOf('SUCCESS::调用成功') > -1){ 191 | let jsonData = JSON.parse(res.data.data) 192 | if(jsonData.bizErrorMsg == 'success'){ 193 | this.taskList = jsonData.data.tasks 194 | if(Object.keys(this.taskList).length > 0){ 195 | console.log('['+this.uid+'] 获取任务列表成功----') 196 | return true 197 | } 198 | console.log('['+this.uid+'] 还没有待领奖任务') 199 | return false 200 | } 201 | console.log('['+this.uid+'] 获取任务列表出错----',jsonData.bizErrorMsg) 202 | return false 203 | } 204 | console.log('['+this.uid+'] 获取任务列表出错----',res.ret) 205 | return false 206 | } 207 | 208 | // 校验任务是否完成 209 | async checkTask(){ 210 | if(await this.getTaskList()){ 211 | // 判断是否使用道具 212 | // if("T001" in this.taskList){ 213 | // if(this.taskList['T001']['isFinishe'] == true){ 214 | // console.log('✅任务T001已完成') 215 | // }else if(this.taskList['T001']['progress'] == 4){ 216 | // console.log('领取T001奖励') 217 | // this.postTask(this.taskList['T001']['taskId']) 218 | // }else{ 219 | // console.log('T001任务进度',this.taskList['T001']['progress']+"/4") 220 | // console.log('继续T001任务') 221 | // } 222 | // } 223 | 224 | // 判断是否完成任务 225 | if("T004" in this.taskList){ 226 | if(this.taskList['T004']['isFinishe'] == true){ 227 | console.log('['+this.uid+'] ✅任务T004已完成') 228 | return false 229 | }else if(this.taskList['T004']['progress'] == 100){ 230 | console.log('['+this.uid+'] 领取T004奖励') 231 | this.postTask(this.taskList['T004']['taskId']) 232 | return false 233 | }else{ 234 | console.log('['+this.uid+'] T004任务进度',this.taskList['T004']['progress']+"/4") 235 | console.log('['+this.uid+'] 继续T004任务') 236 | return true 237 | } 238 | } 239 | } 240 | 241 | return true 242 | 243 | } 244 | 245 | // 领取任务奖励 246 | async postTask(taskId){ 247 | const api = 'mtop.alsc.playgame.mini.game.dispatch' 248 | const data = JSON.stringify({ 249 | "bizScene":"TOBECEO", 250 | "bizMethod":"finisheTask", 251 | "bizParam": JSON.stringify({ 252 | "taskId":taskId, 253 | "gameId":this.gameId, 254 | "token":this.token 255 | }), 256 | "longitude": "104.09800574183464", 257 | "latitude": "30.22990694269538" 258 | }) 259 | 260 | let res = await elmRequestByH5(this.cookie, api, data); 261 | if(res.ret.indexOf('SUCCESS::调用成功') > -1){ 262 | let jsonData = JSON.parse(res.data.data) 263 | if(jsonData.bizErrorMsg == 'success'){ 264 | console.log(`[${this.uid}] ✅完成任务获得乐园币--[${jsonData['data']['rewardItems'][0]['num']}]`) 265 | }else{ 266 | console.log('['+this.uid+'] 完成任务'+taskId+'出错----',jsonData.bizErrorMsg) 267 | } 268 | } 269 | } 270 | 271 | async main() { 272 | // 获取 token 273 | console.log('*****第【' + this.uid + '】个账号【' + this.uid + '】开始 *****') 274 | if (await this.getToken()) 275 | // 获取任务列表 276 | if (await this.checkTask()) { 277 | if (await this.startGame()) { 278 | await this.getPageview() 279 | await this.postPageview() 280 | await this.usedGameProp() 281 | await this.endGame() 282 | 283 | // 领取奖励 284 | await this.getTaskList() 285 | if ("T004" in this.taskList) { 286 | if (this.taskList['T004']['isFinishe'] == true) { 287 | console.log('[' + this.uid + '] ✅任务T004已完成') 288 | } else if (this.taskList['T004']['progress'] == 100) { 289 | console.log('[' + this.uid + '] 领取T004奖励') 290 | await this.postTask(this.taskList['T004']['taskId']) 291 | } else { 292 | console.log('[' + this.uid + '] T004任务进度', this.taskList['T004']['progress'] + "/4") 293 | console.log('[' + this.uid + '] 继续T004任务') 294 | } 295 | } 296 | 297 | // 领取奖励 道具 298 | if ("T001" in this.taskList) { 299 | if (this.taskList['T001']['isFinishe'] == true) { 300 | console.log('✅任务T001已完成') 301 | } else if (this.taskList['T001']['progress'] == 4) { 302 | console.log('领取T001奖励') 303 | await this.postTask(this.taskList['T001']['taskId']) 304 | } else { 305 | console.log('T001任务进度', this.taskList['T001']['progress'] + "/4") 306 | } 307 | } 308 | 309 | } 310 | } 311 | console.log('*****第【' + this.uid + '】个账号【' + this.uid + '】结束 *****') 312 | } 313 | } 314 | 315 | async function start() { 316 | // 获取账号 317 | let cookies = [] 318 | if (process.env.elmck) { 319 | // 环境变量 320 | if (process.env.elmck.indexOf('&') > -1) { 321 | cookies = process.env.elmck.split('&'); 322 | } else { 323 | cookies.push(process.env.elmck); 324 | } 325 | console.log(`执行账号个数:${cookies.length}`); 326 | } else { 327 | // 本地测试 328 | cookies = cookies.concat([ 329 | '' 330 | ]) 331 | if (cookies.length < 1) { 332 | log("检测到环境变量、本地ck都为空"); 333 | return; 334 | } 335 | } 336 | 337 | for (let i = 0; i < cookies.length; i++) { 338 | const cookie = cookies[i]; 339 | const task = new Task(cookie, i); 340 | await task.main(); 341 | $.log('等待3秒') 342 | await $.wait(3000) 343 | } 344 | 345 | } 346 | 347 | start() 348 | 349 | 350 | // prettier-ignore 351 | 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) } 352 | 353 | -------------------------------------------------------------------------------- /饿了么本 By北渡.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Shuying-exquisite/elm/5295854385a168e54580c44570964400553ad0dd/饿了么本 By北渡.zip -------------------------------------------------------------------------------- /饿了么贪吃.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | import time 4 | import datetime 5 | import requests 6 | from urllib.parse import urlencode, quote 7 | import hashlib 8 | import json 9 | import random 10 | import string 11 | 12 | host = 'https://acs.m.goofish.com' 13 | 14 | ck = '' 15 | 16 | 17 | def generate_random_string(length=50): 18 | return ''.join(random.choices(string.ascii_letters + string.digits, k=length)) 19 | 20 | 21 | def reorder_ck(s: str) -> str: 22 | order = ["cookie2", "sgcookie", "unb", "USERID", "SID", "token", "utdid", "deviceId", "umt"] 23 | cookies = s.split(';') 24 | cookie_dict = {} 25 | for cookie in cookies: 26 | key_value = cookie.split('=', 1) 27 | if len(key_value) == 2: 28 | key, value = key_value 29 | cookie_dict[key.strip()] = value.strip() 30 | reordered_cookies = [] 31 | for key in order: 32 | if key in cookie_dict: 33 | reordered_cookies.append(f"{key}={cookie_dict[key]}") 34 | return ';'.join(reordered_cookies) + ';' 35 | 36 | 37 | def get_ck_usid(ck1): 38 | key_value_pairs = ck1.split(";") 39 | for pair in key_value_pairs: 40 | if "=" in pair: 41 | key, value = pair.split("=", 1) 42 | if key == "USERID": 43 | return value 44 | return '账号' 45 | 46 | 47 | def hbh5tk(tk_cookie, enc_cookie, cookie_str): 48 | """ 49 | 合并带_m_h5_tk 50 | """ 51 | txt = cookie_str.replace(" ", "") 52 | txt = txt.replace("chushi;", "") 53 | if txt[-1] != ';': 54 | txt += ';' 55 | cookie_parts = txt.split(';')[:-1] 56 | updated = False 57 | for i, part in enumerate(cookie_parts): 58 | key_value = part.split('=') 59 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 60 | cookie_parts[i] = tk_cookie 61 | updated = True 62 | elif key_value[0].strip() in ["_m_h5_tk_enc", " _m_h5_tk_enc"]: 63 | cookie_parts[i] = enc_cookie 64 | updated = True 65 | 66 | if updated: 67 | return ';'.join(cookie_parts) + ';' 68 | else: 69 | return txt + tk_cookie + ';' + enc_cookie + ';' 70 | 71 | 72 | def tq(cookie_string): 73 | """ 74 | 获取_m_h5_tk 75 | """ 76 | if not cookie_string: 77 | return '-1' 78 | cookie_pairs = cookie_string.split(';') 79 | for pair in cookie_pairs: 80 | key_value = pair.split('=') 81 | if key_value[0].strip() in ["_m_h5_tk", " _m_h5_tk"]: 82 | return key_value[1] 83 | return '-1' 84 | 85 | 86 | def tq1(txt): 87 | """ 88 | 拆分cookie 89 | """ 90 | try: 91 | txt = txt.replace(" ", "") 92 | if txt[-1] != ';': 93 | txt += ';' 94 | pairs = txt.split(";")[:-1] 95 | ck_json = {} 96 | for pair in pairs: 97 | key, value = pair.split("=", 1) 98 | ck_json[key] = value 99 | return ck_json 100 | except Exception as e: 101 | print(f'❎Cookie解析错误: {e}') 102 | return {} 103 | 104 | 105 | def md5(text): 106 | """ 107 | md5加密 108 | """ 109 | hash_md5 = hashlib.md5() 110 | hash_md5.update(text.encode()) 111 | return hash_md5.hexdigest() 112 | 113 | 114 | def check_cookie(cookie): 115 | url = "https://waimai-guide.ele.me/h5/mtop.alsc.personal.queryminecenter/1.0/?jsv=2.6.2&appKey=12574478" 116 | headers = { 117 | "Cookie": cookie, 118 | "User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.87 Safari/537.36" 119 | } 120 | 121 | try: 122 | response = requests.get(url, headers=headers) 123 | if response.status_code == 200: 124 | cookie_jar = response.cookies 125 | token = cookie_jar.get('_m_h5_tk', '') 126 | token_cookie = "_m_h5_tk=" + token 127 | enc_token = cookie_jar.get('_m_h5_tk_enc', '') 128 | enc_token_cookie = "_m_h5_tk_enc=" + enc_token 129 | cookie = hbh5tk(token_cookie, enc_token_cookie, cookie) 130 | return cookie 131 | else: 132 | return None 133 | except Exception as e: 134 | print("解析ck错误") 135 | return None 136 | 137 | 138 | class TCS: 139 | def __init__(self, cki): 140 | self.stop = False 141 | self.ck = cki 142 | self.players = [] 143 | self.name = None 144 | self.openId = None 145 | self.gameId = None 146 | self.gameToken = None 147 | self.cki = self.tq(cki) 148 | self.uid = self.cki.get("unb") 149 | self.sid = self.cki.get("cookie2") 150 | self.name1 = get_ck_usid(cki) 151 | 152 | def tq(self, txt): 153 | try: 154 | txt = txt.replace(" ", "") 155 | pairs = txt.split(";")[:-1] 156 | ck_json = {} 157 | for i in pairs: 158 | ck_json[i.split("=")[0]] = i.split("=")[1] 159 | return ck_json 160 | except Exception as e: 161 | print(f'❎Cookie解析错误: {e}') 162 | return {} 163 | 164 | def req(self, api, data, v="1.0"): 165 | try: 166 | cookie = check_cookie(self.ck) 167 | headers = { 168 | "authority": "shopping.ele.me", 169 | "accept": "application/json", 170 | "accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7", 171 | "cache-control": "no-cache", 172 | "content-type": "application/x-www-form-urlencoded", 173 | "cookie": cookie, 174 | "user-agent": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G955U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Mobile Safari/537.36" 175 | } 176 | timestamp = int(time.time() * 1000) 177 | data_str = json.dumps(data) 178 | token = tq(cookie) 179 | token_part = token.split("_")[0] 180 | 181 | sign_str = f"{token_part}&{timestamp}&12574478&{data_str}" 182 | sign = md5(sign_str) 183 | url = f"https://guide-acs.m.taobao.com/h5/{api}/{v}/?jsv=2.6.1&appKey=12574478&t={timestamp}&sign={sign}&api={api}&v={v}&type=originaljson&dataType=json" 184 | data1 = urlencode({'data': data_str}) 185 | r = requests.post(url, headers=headers, data=data1) 186 | if r: 187 | return r 188 | else: 189 | return None 190 | except Exception as e: 191 | return None 192 | 193 | def login(self): 194 | api1 = 'mtop.alsc.user.detail.query' 195 | data1 = {} 196 | try: 197 | res1 = self.req(api1, data1, "1.0") 198 | if res1.json()['ret'][0] == 'SUCCESS::调用成功': 199 | self.name = res1.json()["data"]["encryptMobile"] 200 | api = 'mtop.koubei.interaction.center.common.queryintegralproperty.v2' 201 | data = {"templateIds": "[\"1404\"]"} 202 | try: 203 | res = self.req(api, data, "1.0") 204 | if res.json()['ret'][0] == 'SUCCESS::调用成功': 205 | print(f'[{self.name}] ✅登录成功,乐园币----[{res.json()["data"]["data"]["1404"]["count"]}]') 206 | return True 207 | else: 208 | if res.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 209 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 210 | return False 211 | else: 212 | print(f'[{self.name1}] ❌登录失败,原因:{res.text}') 213 | return False 214 | except Exception as e: 215 | print(f"[{self.name1}] ❎登录失败: {e}") 216 | return False 217 | else: 218 | if res1.json()['ret'][0] == 'FAIL_SYS_SESSION_EXPIRED::Session过期': 219 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 220 | return False 221 | else: 222 | print(f'[{self.name1}] ❌登录失败,原因:{res1.text}') 223 | return False 224 | except Exception as e: 225 | print(f"[{self.name1}] ❎登录失败: {e}") 226 | return False 227 | 228 | def getOpenId(self): 229 | api1 = 'mtop.alsc.playgame.mini.game.dispatch' 230 | data1 = { 231 | "bizMethod": "/init/init", 232 | "bizScene": "GREEDY_SNAKE", 233 | "bizParam": "{}" 234 | } 235 | try: 236 | res1 = self.req(api1, data1, "1.0") 237 | if res1.json()['ret'][0] == 'SUCCESS::调用成功': 238 | # print('获取Openid',res1.json()) 239 | openId = json.loads(res1.json()['data']['data']).get('openId') 240 | self.openId = openId 241 | return True 242 | else: 243 | print(f'[{self.name1}] ❌获取Openid失败,原因:{res1.text}') 244 | return False 245 | except Exception as e: 246 | print(f"[{self.name1}] ❌获取Openid失败,原因: {e}") 247 | return False 248 | 249 | def startgame(self): 250 | api = 'mtop.alsc.playgame.mini.game.dispatch' 251 | data = { 252 | "bizMethod": "/game/start", 253 | "bizScene": "GREEDY_SNAKE", 254 | "bizParam": "{}" 255 | } 256 | try: 257 | res = self.req(api, data, "1.0") 258 | if res is None: 259 | return None 260 | if res.json()["ret"][0] == "SUCCESS::调用成功": 261 | # print('开始游戏',res.json()) 262 | players = json.loads(res.json()['data']['data']).get('players') 263 | gameId = json.loads(res.json()['data']['data']).get('gameId') 264 | gameToken = json.loads(res.json()['data']['data']).get('gameToken') 265 | # print('游戏玩家',resJson) 266 | self.players = players 267 | self.gameId = gameId 268 | self.gameToken = gameToken 269 | return True 270 | else: 271 | if res.json()["ret"][0] == "FAIL_SYS_SESSION_EXPIRED::Session过期": 272 | print(f"[{self.name1}] ❎cookie已过期,请重新获取") 273 | return None 274 | else: 275 | print(f'[{self.name1}] ❎{res.json()["ret"][0]}') 276 | return None 277 | except Exception: 278 | print(f'❎请求错误') 279 | return None 280 | 281 | def gameScore(self): 282 | score = [] 283 | i = 0 284 | # num = random.randint(5, 10) 285 | num = 3 286 | while i < num: 287 | key = random.randint(1, 14) 288 | item = self.players[key] 289 | player = { 290 | "openId": item.get('playerId'), 291 | "score": random.randint(800, 100000) 292 | } 293 | score.append(player) 294 | i = i + 1 295 | 296 | return score 297 | 298 | def endgame(self, count, len): 299 | timestamp = int(datetime.datetime.now().timestamp() * 1000) 300 | signStr = f'{len}&{self.gameToken}&{timestamp}' 301 | md = hashlib.md5(signStr.encode()) 302 | gameSign = md.hexdigest() 303 | api = 'mtop.alsc.playgame.mini.game.dispatch' 304 | 305 | gameScore = json.dumps(self.gameScore()) 306 | 307 | bizParam = json.dumps({ 308 | "gameId": self.gameId, 309 | "gameResult": len, 310 | "time": timestamp, 311 | "gameSign": gameSign, 312 | "gameScore": gameScore, 313 | }) 314 | 315 | data = { 316 | "bizMethod": "/game/end", 317 | "bizParam": bizParam, 318 | "bizScene": "GREEDY_SNAKE" 319 | } 320 | 321 | try: 322 | res = self.req(api, data, "1.0") 323 | if res.json()["ret"][0] == "SUCCESS::调用成功": 324 | nested_data = json.loads(res.json()["data"]["data"]) 325 | value = nested_data["realGrantValue"] 326 | if value is None: 327 | print(f'[{self.name}] ❌第[{count}]次玩贪吃蛇失败,奖励上限') 328 | self.stop = True 329 | else: 330 | print(f'[{self.name}] ✅第[{count}]次玩贪吃蛇成功,获得乐园币--[{value}]') 331 | self.stop = False 332 | else: 333 | print(f'[{self.name}] ❌游戏结算错误,原因:{res.text}') 334 | self.stop = False 335 | except Exception: 336 | print(f'❎请求错误') 337 | self.stop = False 338 | 339 | def task(self): 340 | count = 1 341 | len = 19999 342 | while count < 7 and self.stop is False: 343 | len = len + 1 344 | try: 345 | if self.getOpenId(): 346 | if self.startgame(): 347 | self.endgame(count, len) 348 | else: 349 | print(f'[{self.name1}] ❌开始游戏失败') 350 | except Exception as e: 351 | print(f"[{self.name1}] ❌游戏失败,原因: {e}") 352 | time.sleep(random.randint(1, 3)) 353 | count = count + 1 354 | 355 | def main(self): 356 | if self.login(): 357 | print(f"----开始游戏----") 358 | self.task() 359 | 360 | 361 | if __name__ == '__main__': 362 | if 'elmck' in os.environ: 363 | cookie = os.environ.get('elmck') 364 | else: 365 | print("环境变量中不存在[elmck],启用本地变量模式") 366 | cookie = ck 367 | if cookie == "": 368 | print("本地变量为空,请设置其中一个变量后再运行") 369 | exit(-1) 370 | cookies = cookie.split("&") 371 | 372 | print(f"饿了么共获取到 {len(cookies)} 个账号") 373 | for i, ck in enumerate(cookies): 374 | print(f"======开始第{i + 1}个账号======") 375 | ck = reorder_ck(ck) 376 | TCS(ck).main() 377 | --------------------------------------------------------------------------------