diff --git a/Coca.py b/Coca.py deleted file mode 100644 index 5d272d8..0000000 --- a/Coca.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- encoding: utf-8 -*- -# @Time : 18:57 -# @Author : yuxian -# @Email : 1503889663@qq.com -# @File : Coca.py -# @SoftWare : PyCharm -# 可口可乐吧小程序,抓包authorization(全部内容 copy即可),填入环境变量Coca中,多账号换行或@隔开 -import json, os, hashlib, random, time, requests as r - - -def UF(): return f"Mozilla/5.0 (iPhone; CPU iPhone OS {f'{random.randint(12, 15)}.{random.randint(0, 6)}.{random.randint(0, 9)}'} like Mac OS X) AppleWebKit/{f'{random.randint(600, 700)}.{random.randint(1, 4)}.{random.randint(1, 5)}'} (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.20(0x16001422) NetType/WIFI Language/zh_CN" - - -def generate_random_string_and_timestamp(): - T = ''.join(random.choices('0123456789abcdefghijklmnopqrstuvwxyz', k=8)) - d = str(int(time.time() * 1000)) - return T, d - - -def sha256_encrypt(data): - hash_object = hashlib.sha256() - hash_object.update(data.encode('utf-8')) - hex_dig = hash_object.hexdigest() - return hex_dig - - -def get_header(url1): - T, d = generate_random_string_and_timestamp() - message = url1.replace("https://koplus.icoke.cn/cre-bff", "") - encrypted_data = sha256_encrypt(message + T + d + "apyuc3#7%m4*") - headers = {"x-sg-id": T, "x-sg-timestamp": d, "x-sg-signature": encrypted_data} - return headers - - -U = "https://koplus.icoke.cn/cre-bff/wechat/" -P = os.environ.get("Coca") -if P and P != "": - C = P.split("\n") if "\n" in P else P.split("@") - A = 1 - for B in C: - try: - H = { - "Host": "koplus.icoke.cn", - "Connection": "keep-alive", - "xweb_xhr": "1", - "Authorization": B, - "User-Agent": UF(), - "Content-Type": "application/json", - "Accept": "*/*", - "Accept-Language": "*", - "Sec-Fetch-Site": "cross-site", - "Sec-Fetch-Mode": "cors", - "Sec-Fetch-Dest": "empty", - "Referer": "https://servicewechat.com/wxa5811e0426a94686/364/page-frame.html", - "Accept-Encoding": "gzip, deflate, br" - } - url = f"{U}checkin" - H.update(get_header(url)) - signReq = r.post(url=url, headers=H) - signResp = json.loads(signReq.text) - print(f"🎉开始签到账号:{A}🎉") - A += 1 - if signResp["meta"]["transactionPoint"]: - print(f"⭕签到成功,获得{str(int(signResp['meta']['transactionPoint']) / 10)}个快乐瓶⭕") - elif signResp["meta"]["transactionPoint"] is None: - print("❗今日已签到,请勿重复签到❗") - else: - print("❌出现未知错误,签到失败❌") - time.sleep(3) - url = f"{U}profile" - H.update(get_header(url)) - qReq = r.get(url=url, headers=H) - qResp = json.loads(qReq.text) - print(f"🎉开始查询账号积分🎉") - if qResp["data"]: - print(f"🎆账号快乐瓶总额:{str(int(qResp['data']['point']) / 10)}🎆") - else: - print("❌出现未知错误,查询失败❌") - except: - print("⚠️⚠️⚠️脚本报错执行下一个账号⚠️⚠️⚠️") diff --git a/wxapp/可口可乐吧.js b/wxapp/可口可乐吧.js new file mode 100644 index 0000000..e934ed9 --- /dev/null +++ b/wxapp/可口可乐吧.js @@ -0,0 +1,288 @@ +/* +------------------------------------------ +@Author: sm +@Date: 2024.06.07 19:15 +@Description: 测试 +------------------------------------------ +#Notice: + 变量名kekoukeleba 抓小程序可口可乐吧 member-api.icoke.cn/api Headers中 authorization 去掉Bearer 多账号&连接 +⚠️【免责声明】 +------------------------------------------ +1、此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。 +2、由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。 +3、请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。 +4、此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。 +5、本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。 +6、如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。 +7、所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此脚本,即视为您已接受此免责声明。 +*/ + +const $ = new Env("可口可乐吧"); +let ckName = `kekoukeleba`; +const strSplitor = "#"; +const envSplitor = ["&", "\n"]; +const notify = $.isNode() ? require("./sendNotify") : ""; +const axios = require("axios"); +const defaultUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.31(0x18001e31) NetType/WIFI Language/zh_CN miniProgram" + +class Public { + async request(options) { + return await axios.request(options); + } +} +class Task extends Public { + constructor(env) { + + super(); + this.index = $.userIdx++ + let user = env.split("#"); + this.token = user[0]; + this.isSign = false; + } + async addSign() { + let options = { + method: "GET", + url: "https://member-api.icoke.cn/api/icoke-sign/icoke/mini/sign/main/sign", + headers: { + "accept": "application/json, text/plain, */*", + "accept-language": "zh-CN,zh;q=0.9", + "authorization": "Bearer " + this.token, + "content-type": "application/json", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "cross-site", + "xweb_xhr": "1", + "Referer": "https://servicewechat.com/wxa5811e0426a94686/421/page-frame.html", + "Referrer-Policy": "unsafe-url" + }, + + } + try { + let { data: res } = await this.request(options); + if (res.success == true) { + $.log(`签到成功 获得【${res.point}】快乐瓶`) + } else { + $.log(`签到失败`) + console.log(res); + } + } catch (e) { + console.log(e); + + } + } + async userInfo() { + let options = { + method: "GET", + url: "https://member-api.icoke.cn/api/icoke-customer/icoke/mini/customer/main/points", + headers: { + "accept": "application/json, text/plain, */*", + "accept-language": "zh-CN,zh;q=0.9", + "authorization": "Bearer " + this.token, + "content-type": "application/json", + "sec-fetch-dest": "empty", + "sec-fetch-mode": "cors", + "sec-fetch-site": "cross-site", + "xweb_xhr": "1", + "Referer": "https://servicewechat.com/wxa5811e0426a94686/421/page-frame.html", + "Referrer-Policy": "unsafe-url" + }, + + } + try { + let { data: res } = await this.request(options); + $.log(`目前还剩【${res.point}】瓶 `) + + } catch (e) { + console.log(e); + + } + } + async run() { + + await this.userInfo(); + + await this.addSign(); + + + + } + + +} + + + + + + + +!(async () => { + await getNotice() + $.checkEnv(ckName); + + for (let user of $.userList) { + // + + await new Task(user).run(); + + } + + +})() + .catch((e) => console.log(e)) + .finally(() => $.done()); + +async function getNotice() { + let options = { + url: `https://gitee.com/smallfawn/Note/raw/main/Notice.json`, + headers: { + "User-Agent": defaultUserAgent, + } + } + let { data: res } = await new Public().request(options); + return res +} + + +// prettier-ignore +function Env(t, s) { + return new (class { + constructor(t, s) { + this.userIdx = 1; + this.userList = []; + this.userCount = 0; + this.name = t; + this.notifyStr = []; + this.logSeparator = "\n"; + this.startTime = new Date().getTime(); + Object.assign(this, s); + this.log(`\ud83d\udd14${this.name},\u5f00\u59cb!`); + } + checkEnv(ckName) { + let userCookie = (this.isNode() ? process.env[ckName] : "") || ""; + this.userList = userCookie.split(envSplitor.find((o) => userCookie.includes(o)) || "&").filter((n) => n); + this.userCount = this.userList.length; + this.log(`共找到${this.userCount}个账号`); + } + async sendMsg() { + this.log("==============📣Center 通知📣==============") + let message = this.notifyStr.join(this.logSeparator); + if (this.isNode()) { + + await notify.sendNotify(this.name, message); + } else { + + } + } + isNode() { + return "undefined" != typeof module && !!module.exports; + } + + queryStr(options) { + return Object.entries(options) + .map( + ([key, value]) => + `${key}=${typeof value === "object" ? JSON.stringify(value) : value + }` + ) + .join("&"); + } + getURLParams(url) { + const params = {}; + const queryString = url.split("?")[1]; + if (queryString) { + const paramPairs = queryString.split("&"); + paramPairs.forEach((pair) => { + const [key, value] = pair.split("="); + params[key] = value; + }); + } + return params; + } + isJSONString(str) { + try { + return JSON.parse(str) && typeof JSON.parse(str) === "object"; + } catch (e) { + return false; + } + } + isJson(obj) { + var isjson = + typeof obj == "object" && + Object.prototype.toString.call(obj).toLowerCase() == + "[object object]" && + !obj.length; + return isjson; + } + + randomNumber(length) { + const characters = "0123456789"; + return Array.from( + { length }, + () => characters[Math.floor(Math.random() * characters.length)] + ).join(""); + } + randomString(length) { + const characters = "abcdefghijklmnopqrstuvwxyz0123456789"; + return Array.from( + { length }, + () => characters[Math.floor(Math.random() * characters.length)] + ).join(""); + } + uuid() { + return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace( + /[xy]/g, + function (c) { + var r = (Math.random() * 16) | 0, + v = c == "x" ? r : (r & 0x3) | 0x8; + return v.toString(16); + } + ); + } + time(t) { + let s = { + "M+": new Date().getMonth() + 1, + "d+": new Date().getDate(), + "H+": new Date().getHours(), + "m+": new Date().getMinutes(), + "s+": new Date().getSeconds(), + "q+": Math.floor((new Date().getMonth() + 3) / 3), + S: new Date().getMilliseconds(), + }; + /(y+)/.test(t) && + (t = t.replace( + RegExp.$1, + (new Date().getFullYear() + "").substr(4 - RegExp.$1.length) + )); + for (let e in s) { + new RegExp("(" + e + ")").test(t) && + (t = t.replace( + RegExp.$1, + 1 == RegExp.$1.length + ? s[e] + : ("00" + s[e]).substr(("" + s[e]).length) + )); + } + return t; + } + + log(content) { + this.notifyStr.push(content) + console.log(content) + } + wait(t) { + return new Promise((s) => setTimeout(s, t)); + } + done(t = {}) { + this.sendMsg(); + const s = new Date().getTime(), + e = (s - this.startTime) / 1e3; + this.log( + `\ud83d\udd14${this.name},\u7ed3\u675f!\ud83d\udd5b ${e}\u79d2` + ); + if (this.isNode()) { + process.exit(1); + } + } + })(t, s); +} \ No newline at end of file