This commit is contained in:
jiahuigithub authored and GitHub committed 2025-12-08 16:56:25 +08:00
1 parent 77b4a2f5fe
commit 7c39f477ec
3 files changed
+1732 -186

No files matched your search

+1298
View File
File diff suppressed because it is too large. Load diff
+226
View File
@@ -0,0 +1,226 @@
/**
* 脚本:wqwl_new_蒙娜丽莎.js
* 作者:wqwlkj 裙:960690899
* 描述:微信小程序蒙娜丽莎,抓包请求参数webChatID,CustomerID,CustomerName,tokenStr(登录或者签到才有)格式:webChatID1#CustomerID1#CustomerName1#tokenStr#备注1
* 环境变量:wqwl_mnls,多个换行或新建多个变量(不能混合使用)
* 环境变量描述:
* cron: 15 1 9 * * *
*/
//签到ck是24小时过期,可以不玩
/**
* 入口:https://gitee.com/cobbWmy/img/raw/master/mengnalisha.jpg
* 写本不易走个头呗
*/
//环境变量
const ckName = 'wqwl_mnls';
//脚本名称
const scriptName = '微信小程序蒙娜丽莎';
//本地版本
const version = 1.0;
//是否需要文件存储
const isNeedFile = true;
//ck长度
const ckLength = 4;
//日志是否需要具体时间
const isNeedTimes = false;
const proxy = process.env["wqwl_daili"] || '';
const isProxy = process.env["wqwl_useProxy"] || false;
const bfs = process.env["wqwl_bfs"] || 4;
const isNotify = process.env["wqwl_isNotify"] || true;
const isDebug = process.env["wqwl_isDebug"] || 2;
/**
* 其他全局环境变量说明
* wqwl_daili:代理链接,需要返回单挑txt格式
* wqwl_useProxy:是否用代理,默认使用(填了代理链接)
* wqwl_bfs:并发数,默认4
* wqwl_isNotify:是否进行通知
* wqwl_isDebug:是否调试输出请求
*/
const axios = require('axios');
const fs = require('fs');
const qs = require('qs');
let wqwlkj;
// 先下载依赖文件
async function downloadRequire() {
const filePath = 'wqwl_require.js';
const url = 'https://raw.githubusercontent.com/298582245/wqwl_qinglong/refs/heads/main/wqwl_require.js';
if (fs.existsSync(filePath)) {
console.log('✅wqwl_require.js已存在,无需重新下载,如有报错请重新下载覆盖\n');
wqwlkj = require('./wqwl_require');
return true;
} else {
console.log('正在下载wqwl_require.js,请稍等...\n');
console.log(`如果下载过慢,可以手动下载wqwl_require.js,并保存为wqwl_require.js,并重新运行脚本`);
console.log('地址:' + url);
try {
const res = await axios.get(url);
fs.writeFileSync(filePath, res.data);
console.log('✅ 下载完成\n');
wqwlkj = require('./wqwl_require');
return true;
} catch (e) {
console.log('❌ 下载失败,请手动下载wqwl_require.js\n');
console.log('地址:' + url);
return false;
}
}
}
// 立即执行下载并等待完成
!(async function () {
const downloadIsSuccess = await downloadRequire();
if (!downloadIsSuccess) {
console.log('❌ 依赖文件下载失败,脚本终止');
process.exit(1);
}
if (!wqwlkj.WQWLBase || !wqwlkj.WQWLBaseTask) {
console.log('❌ wqwl_require.js 未发现WQWLBase类、WQWLBaseTask类,请重新下载新版本');
process.exit(1);
}
class Task extends wqwlkj.WQWLBaseTask {
constructor(ck, index, base) {
// 调用父类构造函数
super(ck, index, base);
this.baseUrl = 'https://mcs.monalisagroup.com.cn/member/doAction';
}
async init() {
const ckData = this.ck.split('#')
// console.log(ckData)
if (ckData.length < ckLength) {
this.sendMessage(`${this.index + 1} 环境变量有误,请检查环境变量是否正确`, true);
return false;
}
else if (ckData.length === ckLength) {
this.remark = `${ckData[0].slice(0, 8)}-${this.index}`;
}
else {
this.remark = ckData[ckLength];
}
this.webChatID = ckData[0]
this.CustomerID = ckData[1]
this.CustomerName = ckData[2]
this.tokenStr = ckData[3]
if (this.proxyConfig && this.isProxy) {
this.proxy = await wqwlkj.getProxy(this.index, this.proxyConfig)
this.sendMessage(`✅ 使用代理:${this.proxy}`)
}
else {
this.proxy = ''
this.sendMessage(`⚠️ 不使用代理`)
}
if (isNeedFile) {
if (!this.base.fileData[this.remark])
this.base.fileData[this.remark] = {}
let ua;
if (!this.base.fileData[this.remark]['ua']) {
this.base.fileData[this.remark]['ua'] = this.base.wqwlkj.generateRandomUA()
}
ua = this.base.fileData[this.remark]['ua']
this.sendMessage(`🎲 使用ua:${ua.slice(0, 50)}`)
this.headers = {
Connection: 'keep-alive',
'xweb_xhr': '1',
'User-Agent': ua,
'Content-Type': 'application/x-www-form-urlencoded',
Accept: '*/*',
'Sec-Fetch-Site': 'cross-site',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
Referer: 'https://servicewechat.com/wxce6a8f654e81b7a4/459/page-frame.html',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Accept-Encoding': 'gzip, deflate'
}
}
return true
}
async checkin() {
const methodName = '签到'
const method = async () => {
const options = {
url: `${this.baseUrl}`,
method: "POST",
data: qs.stringify({
action: 'sign',
CustomerID: this.CustomerID,
CustomerName: this.CustomerName,
StoreID: 0,
OrganizationID: 0,
brand: 'MON',
tokenStr: this.tokenStr
}
)
}
const res = await this.request(options, 0)
if (res?.status === 0) {
this.sendMessage(`✅ [${methodName}] 成功,获得:${res?.resultInfo}积分`, true)
}
else {
throw new Error(`接口返回:${res?.status === 7 ? '今日已经签到过啦' : (res?.msg || res?.errmsg || "未知错误信息")}`)
}
}
return await this.safeExecute(method, methodName)
}
async info() {
const methodName = '个人信息'
const method = async () => {
const options = {
url: `${this.baseUrl}`,
method: "POST",
data: qs.stringify({
action: 'getCustomer',
webChatID: this.webChatID,
brand: 'MON',
}
)
}
const res = await this.request(options, 0)
if (res?.status === 0) {
this.sendMessage(`✅ [${methodName}] 成功,当前积分:${res?.resultInfo[0]?.Integral}`, true)
}
else {
throw new Error(`接口返回:${res?.msg || res?.errmsg || "未知错误信息"}`)
}
}
return await this.safeExecute(method, methodName)
}
async main() {
const init = await this.init()
if (!init) return;
await this.checkin()
await this.base.wqwlkj.sleep(3)
await this.info()
}
}
if (wqwlkj.WQWLBase && wqwlkj.WQWLBaseTask) {
const base = new wqwlkj.WQWLBase(wqwlkj, ckName, scriptName, version, isNeedFile, proxy, isProxy, bfs, isNotify, isDebug, isNeedTimes);
await base.runTasks(Task);
}
else {
// 如果 wqwl_require.js 没有导出 WQWLBase,可能需要手动处理
console.log('❌ wqwl_require.js 未发现WQWLBase类、WQWLBaseTask类,请重新下载新版本');
console.log('地址:' + url);
}
})();
+208 -186
View File
@@ -1,197 +1,219 @@
# -*- coding: utf-8 -*-
# @Time : 2025-11-28
# @Author : chmodxxoo(整合版本)
# @Version :4.1
# @Desc : 蒙娜丽莎小程序:自动获取token → 自动签到,一体化脚本(日志调试 + 精简推送)
import os
import time
import random
import requests
import json
import os
import logging
from datetime import datetime
import sys
try:
from notify import send
except ImportError:
print("未找到 notify.py,将仅在控制台输出日志。")
def send(title, content):
print(f"--- 通知 ---\n{title}\n{content}\n-------------")
# ======================================================
# 第 1 部分:获取 code → tokenStr
# ======================================================
ENV_NAMES = {
"wxid": "soy_wxid_data",
"code_url": "soy_codeurl_data"
}
message_list = []
def get_env(name):
v = os.getenv(name, "").strip()
if not v:
message_list.append(f"❌ 环境变量[{name}]为空!")
return None
#message_list.append(f"✅ 成功读取环境变量[{name}]")
return v
def get_wxid_list():
data = get_env(ENV_NAMES["wxid"])
if not data:
return []
return [x.strip() for x in data.split("\n") if x.strip()]
def get_code(wxid, code_url):
"""用 wxid 换取 code"""
headers = {"Content-Type": "application/json"}
payload = {"appid": "wxce6a8f654e81b7a4", "wxid": wxid}
try:
r = requests.post(code_url, json=payload, headers=headers, timeout=15).json()
if r.get("status") is True:
code = r.get("Data", {}).get("code")
if code:
print(f"[INFO] wxid[{wxid}] 获取 code 成功")
return code
except Exception as e:
print(f"[ERROR] wxid[{wxid}] 获取 code 失败:{e}")
return None
def get_customer_token(code):
"""调用 doAction 获取 CustomerID + tokenStr"""
url = "https://mcs.monalisagroup.com.cn/member/doAction"
headers = {
'Accept-Encoding': 'gzip,compress,br,deflate',
'content-type': 'application/x-www-form-urlencoded',
'Connection': 'keep-alive',
'Referer': 'https://servicewechat.com/wxce6a8f654e81b7a4/462/page-frame.html',
'Host': 'mcs.monalisagroup.com.cn',
'User-Agent': 'Mozilla/5.0'
}
data = (
f"brand=MON&webChatName=%E5%BE%AE%E4%BF%A1%E7%94%A8%E6%88%B7&telephone=&code={code}&remarks=&action=addCustomer"
f"&customerName=%E5%BE%AE%E4%BF%A1%E7%94%A8%E6%88%B7&storeID=&address=-&Province=&City=&Region="
)
try:
r = requests.post(url, headers=headers, data=data, timeout=15).json()
if "tokenStr" in r and r.get("resultInfo"):
customer_id = r["resultInfo"][0]["CustomerID"]
tokenStr = r["tokenStr"]
print(f"[INFO] 获取成功:CustomerID={customer_id} tokenStr={tokenStr}")
return f"{customer_id}#{tokenStr}"
except Exception as e:
print(f"[ERROR] 获取 tokenStr 失败:{e}")
return None
# ======================================================
# 第 2 部分:签到模块
# ======================================================
class MNLS:
def __init__(self, index, account):
self.index = index
self.customerId, self.tokenStr = account.split("#")
self.mobile = ""
self.score = 0
self.msg = ""
self.headers = {
class MonalisaSign:
def __init__(self):
self.base_url = "https://mcs.monalisagroup.com.cn"
self.session = requests.Session()
# 配置日志
logging.basicConfig(
level=logging.INFO,
format='%(asctime)s - %(levelname)s - %(message)s'
)
self.logger = logging.getLogger(__name__)
def parse_environment_config(self):
"""
从环境变量 MNLS 解析配置,支持多个账号
Returns:
list: 包含多个账号配置的列表,每个元素是包含 customer_id 和 token_str 的字典
"""
env_value = os.getenv('MNLS')
if not env_value:
raise ValueError("环境变量 MNLS 未设置")
# 支持多个账号,用&分隔
accounts = []
account_strings = env_value.split('&')
for i, account_str in enumerate(account_strings):
account_str = account_str.strip()
if not account_str:
continue
parts = account_str.split('#')
if len(parts) != 2:
raise ValueError(f"第 {i+1} 个账号格式错误,应为 CustomerID#tokenStr")
accounts.append({
"customer_id": parts[0].strip(),
"token_str": parts[1].strip(),
"index": i + 1 # 账号序号,用于标识
})
if not accounts:
raise ValueError("未找到有效的账号配置")
return accounts
def sign_in(self, customer_id, token_str, account_index=1):
"""
执行签到操作
Args:
customer_id (str): 用户ID
token_str (str): token字符串
account_index (int): 账号序号
Returns:
dict: 签到结果
"""
# 请求URL
url = f"{self.base_url}/member/doAction"
# 严格按照抓包中的请求体格式
data = {
"action": "sign",
"CustomerID": customer_id,
"CustomerName": "微信用户", # 固定为"微信用户"
"StoreID": "0",
"OrganizationID": "0",
"Brand": "MON",
"tokenStr": token_str
}
# 严格按照抓包中的请求头
headers = {
"Host": "mcs.monalisagroup.com.cn",
"Connection": "keep-alive",
"User-Agent": "Mozilla/5.0",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://servicewechat.com/wxce6a8f654e81b7a4/462/page-frame.html",
"Accept-Encoding": "gzip,compress,br,deflate"
"Accept-Encoding": "gzip,compress,br,deflate",
"User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.65(0x1800412e) NetType/WIFI Language/zh_CN",
"Referer": "https://servicewechat.com/wxce6a8f654e81b7a4/459/page-frame.html"
}
def hide_phone(self, phone):
if not phone or len(phone) != 11:
return phone
return phone[:3] + "****" + phone[7:]
def get_info(self):
url = "https://mcs.monalisagroup.com.cn/member/doAction"
data = f"brand=MON&customerID={self.customerId}&action=getCustInfoByID"
try:
r = requests.post(url, headers=self.headers, data=data).json()
if r.get("status") == 0:
info = r["resultInfo"][0]
self.mobile = self.hide_phone(info["Telephone"])
self.score = info["Integral"]
print(f"[INFO] 账号{self.index} 信息获取成功:手机号={self.mobile} 积分={self.score}")
return True
except Exception as e:
print(f"[ERROR] 账号{self.index} 获取信息失败:{e}")
return False
def sign(self):
url = "https://mcs.monalisagroup.com.cn/member/doAction"
data = (
f"brand=MON&action=sign&CustomerID={self.customerId}&CustomerName=%E5%BE%AE%E4%BF%A1%E7%94%A8%E6%88%B7&"
f"StoreID=0&OrganizationID=0&ItemType=002&Brand=MON&tokenStr={self.tokenStr}"
)
try:
r = requests.post(url, headers=self.headers, data=data).json()
if r.get("status") == 0:
self.msg = f"签到成功,获得积分:{r.get('resultInfo')}"
elif r.get("status") == 7:
self.msg = "今天已经签到过了"
self.logger.info(f"开始签到 - 账号{account_index} - 用户ID: {customer_id}")
# 发送POST请求
response = self.session.post(
url,
data=data,
headers=headers,
timeout=10
)
# 记录响应信息
self.logger.info(f"账号{account_index} - HTTP状态码: {response.status_code}")
self.logger.info(f"账号{account_index} - 响应内容: {response.text}")
# 解析响应
if response.status_code == 200:
result = response.json()
self.logger.info(f"账号{account_index} - 签到结果: {result}")
return {
"success": True,
"status": result.get("status"),
"resultInfo": result.get("resultInfo"),
"integralStatus": result.get("integralStatus"),
"raw_response": result
}
else:
self.msg = f"签到失败:{r}"
print(f"[INFO] 账号{self.index} 签到状态:{self.msg}")
except Exception as e:
self.msg = f"签到异常:{e}"
print(f"[ERROR] 账号{self.index} 签到异常:{e}")
self.logger.error(f"账号{account_index} - 请求失败,状态码: {response.status_code}")
return {
"success": False,
"error": f"HTTP错误: {response.status_code}",
"raw_response": response.text
}
except requests.exceptions.RequestException as e:
self.logger.error(f"账号{account_index} - 网络请求异常: {str(e)}")
return {
"success": False,
"error": f"网络异常: {str(e)}"
}
except json.JSONDecodeError as e:
self.logger.error(f"账号{account_index} - JSON解析失败: {str(e)}")
return {
"success": False,
"error": f"响应格式错误: {str(e)}",
"raw_response": response.text if 'response' in locals() else None
}
def run(self):
self.get_info()
self.sign()
self.get_info() # 更新积分
return f"账号{self.index} → {self.msg},积分:{self.score}"
def main():
"""主函数"""
sign_client = MonalisaSign()
try:
# 从环境变量解析配置
accounts = sign_client.parse_environment_config()
print(f"✅ 成功读取 {len(accounts)} 个账号配置")
# 记录总体结果
all_success = True
results = []
# 循环执行每个账号的签到
for account in accounts:
print(f"\n====== 开始处理账号 {account['index']} ======")
print(f"用户ID: {account['customer_id']}")
# 执行签到
result = sign_client.sign_in(
customer_id=account["customer_id"],
token_str=account["token_str"],
account_index=account["index"]
)
# 记录结果
result["account_index"] = account["index"]
result["customer_id"] = account["customer_id"]
results.append(result)
# 输出当前账号结果
if result["success"]:
print(f"🎉 账号{account['index']} 签到成功!")
print(f"状态码: {result.get('status')}")
print(f"结果信息: {result.get('resultInfo')}")
print(f"积分状态: {result.get('integralStatus')}")
else:
print(f"❌ 账号{account['index']} 签到失败!")
print(f"错误信息: {result.get('error')}")
all_success = False
print(f"====== 账号 {account['index']} 处理完成 ======\n")
# 输出汇总结果
print("\n" + "="*50)
print("📊 签到汇总结果:")
success_count = sum(1 for r in results if r["success"])
print(f"成功: {success_count}/{len(accounts)}")
for result in results:
status = "✅ 成功" if result["success"] else "❌ 失败"
print(f"账号{result['account_index']}: {status}")
if not result["success"]:
print(f" 错误: {result.get('error')}")
# 根据结果设置退出码
if not all_success:
print("\n⚠️ 有账号签到失败,请检查!")
sys.exit(1)
else:
print("\n🎉 所有账号签到成功!")
sys.exit(0)
except ValueError as e:
print(f"❌ 配置错误: {e}")
print("\n请按以下格式设置环境变量 MNLS:")
print("单个账号:")
print("export MNLS=\"CustomerID#tokenStr\"")
print("多个账号(用&分隔):")
print("export MNLS=\"CustomerID1#tokenStr1&CustomerID2#tokenStr2&CustomerID3#tokenStr3\"")
print("示例:")
print("export MNLS=\"1725675#f294ee23-ba20-43f1-9bef-222e92e07809\"")
print("export MNLS=\"1725675#f294ee23-ba20-43f1-9bef-222e92e07809&1725676#abcd1234-ef56-78gh-90ij-klmnopqrstuv&1725677#wxyz9876-54fe-32dc-10ba-abcdefghijkl\"")
sys.exit(1)
except Exception as e:
print(f"❌ 程序执行异常: {e}")
sys.exit(1)
# ======================================================
# 主流程整合
# ======================================================
if __name__ == "__main__":
code_url = get_env(ENV_NAMES["code_url"])
wxid_list = get_wxid_list()
if not code_url or not wxid_list:
print("\n".join(message_list))
exit(0)
account_list = []
print("\n===== 开始获取 CustomerID#tokenStr =====")
for wxid in wxid_list:
code = get_code(wxid, code_url)
if not code:
continue
account = get_customer_token(code)
if account:
account_list.append(account)
time.sleep(random.uniform(1, 2))
if not account_list:
print("❌ 未获取到任何账号 tokenStr")
exit(0)
# ======================================================
# 进入自动签到
# ======================================================
print("\n===== 开始签到 =====")
msg_final = []
for idx, acc in enumerate(account_list, start=1):
result = MNLS(idx, acc).run()
msg_final.append(result)
time.sleep(random.uniform(2, 4))
# 控制台输出完整日志
output = "\n".join(message_list + msg_final)
print(output)
# 最终推送:只包含签到结果和积分
send("蒙娜丽莎自动签到结果", "\n".join(msg_final))
main()