mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 13:48:03 +08:00
🔨 修复【和彩云】签到
This commit is contained in:
parent
0e1da6eafa
commit
2e180534ef
@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
@ -7,17 +8,21 @@ from urllib import parse
|
||||
import requests
|
||||
from requests import utils
|
||||
|
||||
import rsa
|
||||
|
||||
|
||||
class CaiYunCheckIn:
|
||||
def __init__(self, check_item):
|
||||
self.check_item = check_item
|
||||
self.user_agent = "Mozilla/5.0 (Linux; Android 10; M2007J3SC Build/QKQ1.191222.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36 MCloudApp/7.6.0"
|
||||
self.public_key = """-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCJ6kiv4v8ZcbDiMmyTKvGzxoPR3fTLj/uRuu6dUypy6zDW+EerThAYON172YigluzKslU1PD9+PzPPHLU/cv81q6KYdT+B5w29hlKkk5tNR0PcCAM/aRUQZu9abnl2aAFQow576BRvIS460urnju+Bu1ZtV+oFM+yQu04OSnmOpwIDAQAB
|
||||
-----END PUBLIC KEY-----"""
|
||||
|
||||
@staticmethod
|
||||
def get_encrypt_time(session):
|
||||
payload = parse.urlencode({"op": "currentTimeMillis"})
|
||||
resp = session.post(
|
||||
url="http://caiyun.feixin.10086.cn:7070/portal/ajax/tools/opRequest.action", data=payload
|
||||
url="https://caiyun.feixin.10086.cn:7071/portal/ajax/tools/opRequest.action", data=payload
|
||||
).json()
|
||||
if resp.get("code") != 10000:
|
||||
print("获取时间戳失败: ", resp["msg"])
|
||||
@ -25,19 +30,21 @@ class CaiYunCheckIn:
|
||||
return resp.get("result", 0)
|
||||
|
||||
def get_ticket(self, session):
|
||||
payload = {"sourceId": 1003, "type": 1, "encryptTime": self.get_encrypt_time(session=session)}
|
||||
resp = requests.post(url="https://proxy.xuthus.cc/api/10086_calc_sign", data=payload)
|
||||
resp = resp.json()
|
||||
if resp.get("code") != 200:
|
||||
ticket = False, "加密失败: ", resp.get("msg")
|
||||
else:
|
||||
ticket = True, resp.get("data")
|
||||
return ticket
|
||||
payload = json.dumps({"sourceId": 1003, "type": 1, "encryptTime": self.get_encrypt_time(session=session)})
|
||||
pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(self.public_key)
|
||||
crypto = b""
|
||||
divide = int(len(payload) / 117)
|
||||
divide = divide if (divide > 0) else divide + 1
|
||||
line = divide if (len(payload) % 117 == 0) else divide + 1
|
||||
for i in range(line):
|
||||
crypto += rsa.encrypt(payload[i * 117: (i + 1) * 117].encode(), pubkey)
|
||||
crypto1 = base64.b64encode(crypto)
|
||||
return crypto1.decode()
|
||||
|
||||
@staticmethod
|
||||
def user_info(session):
|
||||
resp = session.get(url="https://caiyun.feixin.10086.cn:7071/portal/newsignin/index.jsp").text
|
||||
account = re.findall(r'var loginAccount = \"(.*?)\";', resp)
|
||||
account = re.findall(r"var loginAccount = \"(.*?)\";", resp)
|
||||
if account:
|
||||
account = account[0]
|
||||
else:
|
||||
@ -45,72 +52,34 @@ class CaiYunCheckIn:
|
||||
return account
|
||||
|
||||
def sign(self, session):
|
||||
flag, ticket = self.get_ticket(session=session)
|
||||
if flag:
|
||||
payload = parse.urlencode({"op": "receive", "data": ticket, })
|
||||
resp = session.post(
|
||||
url="http://caiyun.feixin.10086.cn:7070/portal/ajax/common/caiYunSignIn.action",
|
||||
data=payload,
|
||||
).json()
|
||||
if resp["code"] != 10000:
|
||||
msg = "签到失败:" + resp["msg"]
|
||||
else:
|
||||
msg = f'月签到天数: {resp["result"]["monthDays"]}\n当前总积分:{resp["result"]["totalPoints"]}'
|
||||
return msg
|
||||
else:
|
||||
return ticket
|
||||
|
||||
def draw(self, session):
|
||||
payload = parse.urlencode({"op": "luckDraw", "data": self.get_ticket(session=session)})
|
||||
ticket = self.get_ticket(session=session)
|
||||
payload = parse.urlencode({"op": "receive", "data": ticket})
|
||||
resp = session.post(
|
||||
url="http://caiyun.feixin.10086.cn:7070/portal/ajax/common/caiYunSignIn.action",
|
||||
data=payload,
|
||||
url="https://caiyun.feixin.10086.cn:7071/portal/ajax/common/caiYunSignIn.action", data=payload,
|
||||
).json()
|
||||
if resp["code"] != 10000:
|
||||
return f"抽奖失败: {resp['msg']}"
|
||||
msg = "签到失败:" + resp["msg"]
|
||||
else:
|
||||
if resp["result"]["type"] == "40160":
|
||||
return "抽奖成功: 小狗电器小型手持床铺除螨仪"
|
||||
elif resp["result"]["type"] == "40175":
|
||||
return "抽奖成功: 飞科男士剃须刀"
|
||||
elif resp["result"]["type"] == "40120":
|
||||
return "抽奖成功: 京东京造电动牙刷"
|
||||
elif resp["result"]["type"] == "40140":
|
||||
return "抽奖成功: 10-100M随机长期存储空间"
|
||||
elif resp["result"]["type"] == "40165":
|
||||
return "抽奖成功: 夏新蓝牙耳机"
|
||||
elif resp["result"]["type"] == "40170":
|
||||
return "抽奖成功: 欧莱雅葡萄籽护肤套餐"
|
||||
else:
|
||||
return "抽奖成功: 谢谢参与"
|
||||
msg = f'月签到天数: {resp["result"]["monthDays"]}\n当前总积分:{resp["result"]["totalPoints"]}'
|
||||
return msg
|
||||
|
||||
def main(self):
|
||||
caiyun_referer = self.check_item.get("caiyun_referer")
|
||||
caiyun_draw = int(self.check_item.get("caiyun_draw", False))
|
||||
caiyun_cookie = {
|
||||
item.split("=")[0]: item.split("=")[1] for item in self.check_item.get("caiyun_cookie").split("; ")
|
||||
}
|
||||
|
||||
session = requests.session()
|
||||
requests.utils.add_dict_to_cookiejar(session.cookies, caiyun_cookie)
|
||||
session.headers.update({
|
||||
"Host": "caiyun.feixin.10086.cn:7070",
|
||||
"Accept": "*/*",
|
||||
"X-Requested-With": "XMLHttpRequest",
|
||||
"User-Agent": self.user_agent,
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Origin": "http://caiyun.feixin.10086.cn:7070",
|
||||
"Referer": caiyun_referer,
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8",
|
||||
})
|
||||
session.headers.update(
|
||||
{
|
||||
"User-Agent": "Mozilla/5.0 (Linux; Android 10; M2007J3SC Build/QKQ1.191222.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/83.0.4103.106 Mobile Safari/537.36 MCloudApp/7.6.0",
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"Origin": "https://caiyun.feixin.10086.cn:7071",
|
||||
"Referer": "https://caiyun.feixin.10086.cn:7071/portal/newsignin/index.jsp",
|
||||
}
|
||||
)
|
||||
username = self.user_info(session=session)
|
||||
sign_msg = self.sign(session=session)
|
||||
if caiyun_draw:
|
||||
draw_msg = self.draw(session=session)
|
||||
else:
|
||||
draw_msg = ""
|
||||
msg = f"用户信息: {username}\n{sign_msg}\n{draw_msg}".strip()
|
||||
msg = f"用户信息: {username}\n{sign_msg}".strip()
|
||||
return msg
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user