mirror of
https://github.com/XiaoGe-LiBai/yangmao.git
synced 2025-12-17 05:18:14 +08:00
dme
This commit is contained in:
164
顺丰.py → sf.py
164
顺丰.py → sf.py
@@ -9,7 +9,6 @@ from datetime import datetime, timedelta
|
||||
from sys import exit
|
||||
import requests
|
||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
from urllib.parse import unquote
|
||||
|
||||
# 禁用安全请求警告
|
||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||
@@ -35,7 +34,7 @@ def Log(cont=''):
|
||||
send_msg += f'{cont}\n'
|
||||
|
||||
|
||||
inviteId = ['']
|
||||
inviteId = ['A959FF988C64448198CDEB08FC84844F','0A5BCEB5EA454B878C34EB01A33AF080']
|
||||
|
||||
|
||||
class RUN:
|
||||
@@ -87,25 +86,17 @@ class RUN:
|
||||
result += char
|
||||
return result
|
||||
|
||||
def login(self, sfurl):
|
||||
try:
|
||||
# 对URL进行解码
|
||||
decoded_url = unquote(sfurl)
|
||||
|
||||
ress = self.s.get(decoded_url, headers=self.headers)
|
||||
# print(ress.text)
|
||||
self.user_id = self.s.cookies.get_dict().get('_login_user_id_', '')
|
||||
self.phone = self.s.cookies.get_dict().get('_login_mobile_', '')
|
||||
self.mobile = self.phone[:3] + "*" * 4 + self.phone[7:] if self.phone else ''
|
||||
|
||||
if self.phone:
|
||||
Log(f'用户:【{self.mobile}】登陆成功')
|
||||
return True
|
||||
else:
|
||||
Log(f'获取用户信息失败')
|
||||
return False
|
||||
except Exception as e:
|
||||
Log(f'登录异常: {str(e)}')
|
||||
def login(self, sfsyUrl):
|
||||
ress = self.s.get(sfsyUrl, headers=self.headers)
|
||||
# print(ress.text)
|
||||
self.user_id = self.s.cookies.get_dict().get('_login_user_id_', '')
|
||||
self.phone = self.s.cookies.get_dict().get('_login_mobile_', '')
|
||||
self.mobile = self.phone[:3] + "*" * 4 + self.phone[7:]
|
||||
if self.phone != '':
|
||||
Log(f'用户:【{self.mobile}】登陆成功')
|
||||
return True
|
||||
else:
|
||||
Log(f'获取用户信息失败')
|
||||
return False
|
||||
|
||||
def getSign(self):
|
||||
@@ -410,13 +401,13 @@ class RUN:
|
||||
time.sleep(2)
|
||||
|
||||
def EAR_END_2023_TaskList(self):
|
||||
print('\n>>>>>>开始年终集卡任务')
|
||||
print('\n>>>>>>开始32周年庆任务')
|
||||
# 任务列表
|
||||
json_data = {
|
||||
"activityCode": "YEAREND_2024",
|
||||
"activityCode": "ANNIVERSARY_2025",
|
||||
"channelType": "MINI_PROGRAM"
|
||||
}
|
||||
self.headers['channel'] = '24nzdb'
|
||||
self.headers['channel'] = '32annixcx'
|
||||
self.headers['platform'] = 'MINI_PROGRAM'
|
||||
self.headers['syscode'] = 'MCS-MIMP-CORE'
|
||||
|
||||
@@ -434,6 +425,9 @@ class RUN:
|
||||
continue
|
||||
if self.taskType == 'INTEGRAL_EXCHANGE':
|
||||
self.EAR_END_2023_ExchangeCard()
|
||||
elif self.taskType == 'PLAY_ACTIVITY_GAME':
|
||||
self.DRAGONBOAT_2024_index()
|
||||
self.DRAGONBOAT_2024_Game_init()
|
||||
elif self.taskType == 'CLICK_MY_SETTING':
|
||||
self.taskCode = item["taskCode"]
|
||||
self.addDeliverPrefer()
|
||||
@@ -492,34 +486,31 @@ class RUN:
|
||||
print(f'>【{self.title}】任务-{response.get("errorMessage")}')
|
||||
|
||||
def EAR_END_2023_ExchangeCard(self):
|
||||
print(f'>>>开始积分兑换年卡')
|
||||
print(f'>>>开始积分兑换找财神')
|
||||
json_data = {
|
||||
"exchangeNum": 2,
|
||||
"activityCode": "YEAREND_2024",
|
||||
"channelType": "MINI_PROGRAM"
|
||||
"activityCode": "ANNIVERSARY_2025",
|
||||
"exchangeNum": 1
|
||||
}
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonNoLoginPost/~memberNonactivity~yearEnd2024TaskService~integralExchange'
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2025FiftyPercentService~getPopInfo'
|
||||
response = self.do_request(url, data=json_data)
|
||||
if response.get('success') == True:
|
||||
receivedAccountList = response['obj']['receivedAccountList']
|
||||
for card in receivedAccountList:
|
||||
print(f'>获得:【{card["urrency"]}】卡【{card["amount"]}】张!')
|
||||
else:
|
||||
print(f'>【{self.title}】任务-{response.get("errorMessage")}')
|
||||
print(f'>【{self.title}】任务-已完成')
|
||||
|
||||
def EAR_END_2023_getAward(self):
|
||||
print(f'>>>开始抽卡')
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2024WealthCardService~fortuneWealth'
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2025ClaimService~claim'
|
||||
for l in range(10):
|
||||
for i in range(0, 3):
|
||||
json_data = {}
|
||||
json_data = {
|
||||
"cardType": i
|
||||
}
|
||||
response = self.do_request(url, data=json_data)
|
||||
# print(response)
|
||||
if response.get('success') == True:
|
||||
receivedAccountList = response['obj']['receivedAccountList']
|
||||
for card in receivedAccountList:
|
||||
print(f'>获得:【{card["currency"]}】卡【{card["amount"]}】张!')
|
||||
elif response.get('errorMessage') == '达到限流阈值,请稍后重试':
|
||||
elif response.get('errorMessage') == '用户账户余额不足':
|
||||
break
|
||||
elif response.get('errorMessage') == '用户信息失效,请退出重新进入':
|
||||
break
|
||||
@@ -528,27 +519,66 @@ class RUN:
|
||||
break
|
||||
time.sleep(3)
|
||||
|
||||
def EAR_END_2023_GuessIdiom(self):
|
||||
print(f'>>>开始猜成语')
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2024GuessIdiomService~win'
|
||||
for i in range(1, 11):
|
||||
json_data = {
|
||||
"index": i
|
||||
}
|
||||
response = self.do_request(url, data=json_data)
|
||||
if response.get('success') == True:
|
||||
print(f'第{i}关成功!')
|
||||
# def EAR_END_2023_GuessIdiom(self):
|
||||
# print(f'>>>开始猜成语')
|
||||
# url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2024GuessIdiomService~win'
|
||||
# for i in range(1, 11):
|
||||
# json_data = {
|
||||
# "index": i
|
||||
# }
|
||||
# response = self.do_request(url, data=json_data)
|
||||
# if response.get('success') == True:
|
||||
# print(f'第{i}关成功!')
|
||||
# receivedAccountList = response['obj']['receivedAccountList']
|
||||
# for card in receivedAccountList:
|
||||
# print(f'>获得:【{card["urrency"]}】卡【{card["amount"]}】张!')
|
||||
# else:
|
||||
# print(f'第{i}关失败!')
|
||||
|
||||
#查询新年回馈卡片数量
|
||||
def EAR_END_2023_query(self):
|
||||
print(f'>>>开始查询卡片数量')
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2025ClaimService~claimStatus'
|
||||
response = self.do_request(url, {})
|
||||
if response.get('success'):
|
||||
obj = response.get('obj', None)
|
||||
if obj == None: return False
|
||||
currentAccountList = obj.get('currentAccountList', [])
|
||||
if not currentAccountList:
|
||||
print("当前没有卡片")
|
||||
else:
|
||||
print(f'第{i}关失败!')
|
||||
print("当前卡片数量:")
|
||||
for card in currentAccountList:
|
||||
currency = card.get('currency')
|
||||
totalAmount = card.get('totalAmount')
|
||||
balance = card.get('balance')
|
||||
if currency == 'DAI_BI':
|
||||
currency_name = '坐以待币'
|
||||
elif currency == 'CHENG_GONG':
|
||||
currency_name = '成功人士'
|
||||
elif currency == 'GAN_FAN':
|
||||
currency_name = '干饭圣体'
|
||||
elif currency == 'DING_ZHU':
|
||||
currency_name = '都顶得住'
|
||||
elif currency == 'ZHI_SHUI':
|
||||
currency_name = '心如止水'
|
||||
else:
|
||||
currency_name = currency
|
||||
print(f"卡片名称:{currency_name},数量:{balance}")
|
||||
|
||||
totalFortuneTimes = obj.get('totalFortuneTimes', 0)
|
||||
print(f"总卡片数量:{totalFortuneTimes}")
|
||||
|
||||
return True
|
||||
else:
|
||||
print(f"查询失败:{response.get('errorMessage')}")
|
||||
return False
|
||||
|
||||
def EAR_END_2023_receiveTask(self):
|
||||
print(f'>>>开始领取【{self.title}】任务奖励')
|
||||
json_data = {
|
||||
"taskType": self.taskType,
|
||||
"activityCode": "YEAREND_2024",
|
||||
"activityCode": "ANNIVERSARY_2025",
|
||||
"channelType": "MINI_PROGRAM"
|
||||
}
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonNoLoginPost/~memberNonactivity~yearEnd2024TaskService~fetchMixTaskReward'
|
||||
@@ -1257,17 +1287,17 @@ class RUN:
|
||||
print(e)
|
||||
|
||||
def DRAGONBOAT_2024_index(self):
|
||||
print('====== 查询财神活动状态 ======')
|
||||
print('====== 查询32周年庆活动状态 ======')
|
||||
invite_user_id = random.choice([invite for invite in inviteId if invite != self.user_id])
|
||||
try:
|
||||
self.headers['channel'] = '24nzdb'
|
||||
self.headers['channel'] = '32annixcx'
|
||||
self.headers[
|
||||
'referer'] = f'https://mcs-mimp-web.sf-express.com/origin/a/mimp-activity/yearEnd2024?mobile={self.mobile}&userId={self.user_id}&path=/origin/a/mimp-activity/yearEnd2024&supportShare=&inviteUserId={invite_user_id}&from=newExpressWX'
|
||||
'referer'] = f'https://mcs-mimp-web.sf-express.com/origin/a/mimp-activity/anniversary2025?mobile={self.mobile}&userId={self.user_id}&path=/origin/a/mimp-activity/anniversary2025&supportShare=&inviteUserId={invite_user_id}&from=newExpressWX'
|
||||
payload = {}
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonNoLoginPost/~memberNonactivity~yearEnd2024IndexService~index'
|
||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonNoLoginPost/~memberNonactivity~anniversary2025IndexService~index'
|
||||
|
||||
response = self.do_request(url, payload)
|
||||
# print(response)
|
||||
print(response)
|
||||
if response.get('success'):
|
||||
obj = response.get('obj', [{}])
|
||||
acEndTime = obj.get('acEndTime', '')
|
||||
@@ -1590,7 +1620,7 @@ class RUN:
|
||||
if not self.login_res: return False
|
||||
# 执行签到任务
|
||||
self.sign()
|
||||
self.superWelfare_receiveRedPacket()
|
||||
# self.superWelfare_receiveRedPacket()
|
||||
self.get_SignTaskList()
|
||||
self.get_SignTaskList(True)
|
||||
|
||||
@@ -1601,14 +1631,14 @@ class RUN:
|
||||
self.honey_indexData(True)
|
||||
|
||||
|
||||
if self.DRAGONBOAT_2024_index():
|
||||
# if self.DRAGONBOAT_2024_index():
|
||||
#self.DRAGONBOAT_2024_weeklyGiftStatus()
|
||||
#self.DRAGONBOAT_2024_coinStatus()
|
||||
#self.DRAGONBOAT_2024_taskList()
|
||||
self.DRAGONBOAT_2024_Game_init()
|
||||
# self.DRAGONBOAT_2024_Game_init()
|
||||
#self.DRAGONBOAT_2024_coinStatus(True)
|
||||
|
||||
|
||||
|
||||
# #######################################
|
||||
# # # 获取当前季度结束日期
|
||||
# # activity_end_date = get_quarter_end_date()
|
||||
@@ -1618,6 +1648,7 @@ class RUN:
|
||||
target_time = datetime(2025, 4, 8, 19, 0)
|
||||
if datetime.now() < target_time:
|
||||
self.EAR_END_2023_TaskList()
|
||||
self.EAR_END_2023_query()
|
||||
#self.anniversary2024_task()
|
||||
else:
|
||||
print('周年庆活动已结束')
|
||||
@@ -1629,7 +1660,7 @@ class RUN:
|
||||
else:
|
||||
print('未到指定时间不执行会员日任务')
|
||||
|
||||
|
||||
|
||||
|
||||
self.sendMsg()
|
||||
return True
|
||||
@@ -1702,19 +1733,22 @@ if __name__ == '__main__':
|
||||
ENV_NAME = 'sfsyUrl'
|
||||
CK_NAME = 'url'
|
||||
print(f'''
|
||||
2025/1/4修复版,新增新年活动
|
||||
扫码获取URL网站:sm.linzixuan.work,选择复制编码Token即可
|
||||
格式:多账号用&分割
|
||||
✨✨✨ TG频道:https://t.me/fxmbb ✨✨✨
|
||||
✨✨✨ 更新时间2025.3.17✨✨✨
|
||||
点击“积分”,以下几种url之一:
|
||||
https://mcs-mimp-web.sf-express.com/mcs-mimp/share/weChat/shareGiftReceiveRedirect
|
||||
https://mcs-mimp-web.sf-express.com/mcs-mimp/share/app/shareRedirect
|
||||
多账号换行
|
||||
变量名:sfsyUrl
|
||||
|
||||
''')
|
||||
local_script_name = os.path.basename(__file__)
|
||||
local_version = '2025.01.04'
|
||||
local_version = '2024.06.02'
|
||||
token = os.getenv(ENV_NAME)
|
||||
# 将分隔符从\n改为&
|
||||
tokens = token.split('\n')
|
||||
# print(tokens)
|
||||
if len(tokens) > 0:
|
||||
print(f">>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||
for index, infos in enumerate(tokens):
|
||||
run_result = RUN(infos, index).main()
|
||||
if not run_result: continue
|
||||
9
快手答题.py
9
快手答题.py
@@ -1,9 +0,0 @@
|
||||
'''
|
||||
Powered By Beidu
|
||||
Create at [2024-12-24 17:02]
|
||||
ENV: ksdt_ck 多号@隔开,备注#ck(需要全部ck)
|
||||
|
||||
'''
|
||||
|
||||
import base64, zlib, lzma, bz2, gzip
|
||||
exec((lambda TGqOeCyJ: compile(TGqOeCyJ, '<string>', 'exec'))(zlib.decompress(lzma.decompress(bz2.decompress(gzip.decompress(base64.b64decode('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'))))).decode()))
|
||||
706
电信口令.py
Normal file
706
电信口令.py
Normal file
@@ -0,0 +1,706 @@
|
||||
# 非青龙下在文件开头添加账号配置,
|
||||
# process.env.chinaTelecomAccount = `
|
||||
# 13454545457#123456
|
||||
# 13454545457#456789
|
||||
# `.trim();
|
||||
|
||||
'''
|
||||
变量:chinaTelecomAccount
|
||||
变量格式: 手机号#服务密码
|
||||
多号创建多个变量或者换行、&隔开
|
||||
'''
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import ssl
|
||||
import time
|
||||
import json
|
||||
import httpx
|
||||
import base64
|
||||
import random
|
||||
import certifi
|
||||
import aiohttp
|
||||
import asyncio
|
||||
import logging
|
||||
import datetime
|
||||
import requests
|
||||
import binascii
|
||||
from http import cookiejar
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Cipher import DES3
|
||||
from Crypto.PublicKey import RSA
|
||||
from urllib.parse import urlparse
|
||||
from Crypto.Cipher import PKCS1_v1_5
|
||||
from Crypto.Util.Padding import pad, unpad
|
||||
from aiohttp import ClientSession, TCPConnector
|
||||
from tenacity import (
|
||||
retry,
|
||||
stop_after_attempt,
|
||||
wait_exponential,
|
||||
retry_if_exception_type
|
||||
)
|
||||
import pandas as pd
|
||||
|
||||
apptoken = ""
|
||||
|
||||
MAX_RETRIES = 3
|
||||
RATE_LIMIT = 10
|
||||
|
||||
class RateLimiter:
|
||||
def __init__(self, rate_limit):
|
||||
self.rate_limit = rate_limit
|
||||
self.tokens = rate_limit
|
||||
self.updated_at = time.monotonic()
|
||||
|
||||
async def acquire(self):
|
||||
while self.tokens < 1:
|
||||
self.add_new_tokens()
|
||||
await asyncio.sleep(0.1)
|
||||
self.tokens -= 1
|
||||
|
||||
def add_new_tokens(self):
|
||||
now = time.monotonic()
|
||||
time_since_update = now - self.updated_at
|
||||
new_tokens = time_since_update * self.rate_limit
|
||||
if new_tokens > 1:
|
||||
self.tokens = min(self.tokens + new_tokens, self.rate_limit)
|
||||
self.updated_at = now
|
||||
class AsyncSessionManager:
|
||||
def __init__(self, timeout=None):
|
||||
self.client = None
|
||||
self.timeout = timeout or httpx.Timeout(60.0, connect=30.0, read=30.0, write=30.0)
|
||||
|
||||
async def __aenter__(self):
|
||||
ssl_context = ssl.create_default_context(cafile=certifi.where())
|
||||
ssl_context.set_ciphers('DEFAULT@SECLEVEL=1')
|
||||
|
||||
self.client = httpx.AsyncClient(
|
||||
verify=ssl_context,
|
||||
limits=httpx.Limits(max_connections=100, max_keepalive_connections=20),
|
||||
timeout=self.timeout
|
||||
)
|
||||
return self.client
|
||||
|
||||
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
||||
if self.client:
|
||||
await self.client.aclose()
|
||||
|
||||
async def retry_request2(session, method, url, **kwargs):
|
||||
for attempt in range(MAX_RETRIES):
|
||||
try:
|
||||
response=await session.request(method, url, **kwargs)
|
||||
return await response
|
||||
except aiohttp.ClientError as e:
|
||||
if attempt == MAX_RETRIES - 1:
|
||||
raise
|
||||
await asyncio.sleep(2 ** attempt)
|
||||
|
||||
async def retry_request(session, method, url, **kwargs):
|
||||
for attempt in range(MAX_RETRIES):
|
||||
try:
|
||||
await asyncio.sleep(1)
|
||||
response=await session.request(method, url, **kwargs)
|
||||
return response.json()
|
||||
|
||||
except (aiohttp.ClientConnectionError, aiohttp.ServerTimeoutError) as e:
|
||||
print(f"请求失败,第 {attempt + 1} 次重试: {e}")
|
||||
if attempt == MAX_RETRIES - 1:
|
||||
raise
|
||||
await asyncio.sleep(2 ** attempt)
|
||||
|
||||
class BlockAll(cookiejar.CookiePolicy):
|
||||
return_ok = set_ok = domain_return_ok = path_return_ok = lambda self, *args, **kwargs: False
|
||||
netscape = True
|
||||
rfc2965 = hide_cookie2 = False
|
||||
|
||||
def printn(m):
|
||||
print(f'\n{m}')
|
||||
|
||||
context = ssl.create_default_context()
|
||||
context.set_ciphers('DEFAULT@SECLEVEL=1')
|
||||
context.check_hostname = False
|
||||
context.verify_mode = ssl.CERT_NONE
|
||||
|
||||
class DESAdapter(requests.adapters.HTTPAdapter):
|
||||
def init_poolmanager(self, *args, **kwargs):
|
||||
kwargs['ssl_context'] = context
|
||||
return super().init_poolmanager(*args, **kwargs)
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
ss = requests.session()
|
||||
ss.headers={"User-Agent":"Mozilla/5.0 (Linux; Android 13; 22081212C Build/TKQ1.220829.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.97 Mobile Safari/537.36","Referer":"https://wapact.189.cn:9001/JinDouMall/JinDouMall_independentDetails.html"}
|
||||
ss.mount('https://', DESAdapter())
|
||||
ss.cookies.set_policy(BlockAll())
|
||||
runTime = 0
|
||||
lock = asyncio.Lock()
|
||||
event = asyncio.Event()
|
||||
ready_count = 0
|
||||
diffValue = 0
|
||||
# current_time = datetime.datetime.now().strftime("%Y%m%d-%H-%M-%S")
|
||||
log_filename = f'.电信等级权益日志.log'
|
||||
logging.basicConfig(level=logging.CRITICAL,
|
||||
format='%(asctime)s -- %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S',
|
||||
filename=log_filename,
|
||||
filemode='a', encoding='utf-8')
|
||||
logger = logging.getLogger(__name__)
|
||||
ip_list = []
|
||||
load_token_file = 'chinaTelecom_cache.json'
|
||||
|
||||
try:
|
||||
with open(load_token_file, 'r') as f:
|
||||
load_token = json.load(f)
|
||||
except:
|
||||
load_token = {}
|
||||
key = b'1234567`90koiuyhgtfrdews'
|
||||
iv = 8 * b'\0'
|
||||
public_key_b64 = '''-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBkLT15ThVgz6/NOl6s8GNPofdWzWbCkWnkaAm7O2LjkM1H7dMvzkiqdxU02jamGRHLX/ZNMCXHnPcW/sDhiFCBN18qFvy8g6VYb9QtroI09e176s+ZCtiv7hbin2cCTj99iUpnEloZm19lwHyo69u5UMiPMpq0/XKBO8lYhN/gwIDAQAB
|
||||
-----END PUBLIC KEY-----'''
|
||||
|
||||
public_key_data = '''-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+ugG5A8cZ3FqUKDwM57GM4io6JGcStivT8UdGt67PEOihLZTw3P7371+N47PrmsCpnTRzbTgcupKtUv8ImZalYk65dU8rjC/ridwhw9ffW2LBwvkEnDkkKKRi2liWIItDftJVBiWOh17o6gfbPoNrWORcAdcbpk2L+udld5kZNwIDAQAB
|
||||
-----END PUBLIC KEY-----'''
|
||||
|
||||
def ttt(hour,minute,second):
|
||||
date = datetime.datetime.now()
|
||||
date_zero = datetime.datetime.now().replace(year=date.year, month=date.month, day=date.day, hour=hour, minute=int(minute),second=int(second))
|
||||
date_zero_time = int(time.mktime(date_zero.timetuple()))
|
||||
return date_zero_time
|
||||
def encrypt(text):
|
||||
cipher = DES3.new(key, DES3.MODE_CBC, iv)
|
||||
ciphertext = cipher.encrypt(pad(text.encode(), DES3.block_size))
|
||||
return ciphertext.hex()
|
||||
|
||||
def decrypt(text):
|
||||
ciphertext = bytes.fromhex(text)
|
||||
cipher = DES3.new(key, DES3.MODE_CBC, iv)
|
||||
plaintext = unpad(cipher.decrypt(ciphertext), DES3.block_size)
|
||||
return plaintext.decode()
|
||||
|
||||
def b64(plaintext):
|
||||
public_key = RSA.import_key(public_key_b64)
|
||||
cipher = PKCS1_v1_5.new(public_key)
|
||||
ciphertext = cipher.encrypt(plaintext.encode())
|
||||
return base64.b64encode(ciphertext).decode()
|
||||
|
||||
def encrypt_para2(plaintext):
|
||||
public_key = RSA.import_key(public_key_data)
|
||||
cipher = PKCS1_v1_5.new(public_key)
|
||||
ciphertext = cipher.encrypt(plaintext.encode())
|
||||
return ciphertext.hex()
|
||||
|
||||
def encrypt_para(plaintext):
|
||||
if not isinstance(plaintext, str):
|
||||
plaintext = json.dumps(plaintext)
|
||||
public_key = RSA.import_key(public_key_data)
|
||||
cipher = PKCS1_v1_5.new(public_key)
|
||||
ciphertext = cipher.encrypt(plaintext.encode())
|
||||
return binascii.hexlify(ciphertext).decode()
|
||||
|
||||
def encode_phone(text):
|
||||
encoded_chars = []
|
||||
for char in text:
|
||||
encoded_chars.append(chr(ord(char) + 2))
|
||||
return ''.join(encoded_chars)
|
||||
|
||||
def ophone(t):
|
||||
key = b'34d7cb0bcdf07523'
|
||||
utf8_key = key.decode('utf-8')
|
||||
utf8_t = t.encode('utf-8')
|
||||
cipher = AES.new(key, AES.MODE_ECB)
|
||||
ciphertext = cipher.encrypt(pad(utf8_t, AES.block_size))
|
||||
return ciphertext.hex()
|
||||
|
||||
def get_first_three(value):
|
||||
if isinstance(value, (int, float)):
|
||||
return int(str(value)[:3])
|
||||
elif isinstance(value, str):
|
||||
if len(value) >= 11: # 如果是手机号,显示前3位和后4位
|
||||
return value[:3] + value[3:7] + value[-4:] # 显示完整号码
|
||||
return str(value)[:3] # 其他字符串只返回前三位
|
||||
else:
|
||||
raise TypeError("非数字非字符串类型无法截取前三位")
|
||||
|
||||
def mask_middle_four(value):
|
||||
if isinstance(value, str):
|
||||
if len(value) >= 11:
|
||||
return value[:3] + "####" + value[-4:]
|
||||
else:
|
||||
raise ValueError("输入的字符串长度不足以截取中间四位")
|
||||
else:
|
||||
raise TypeError("输入类型错误,应为字符串")
|
||||
|
||||
def getApiTime(api_url):
|
||||
pass
|
||||
|
||||
def send(uid,content):
|
||||
|
||||
r = requests.post('https://wxpusher.zjiecode.com/api/send/message',json={"appToken":apptoken,"content":content,"contentType":1,"uids":[uid]}).json()
|
||||
return r
|
||||
|
||||
def userLoginNormal(phone,password):
|
||||
try:
|
||||
alphabet = 'abcdef0123456789'
|
||||
uuid = [''.join(random.sample(alphabet, 8)),''.join(random.sample(alphabet, 4)),'4'+''.join(random.sample(alphabet, 3)),''.join(random.sample(alphabet, 4)),''.join(random.sample(alphabet, 12))]
|
||||
timestamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
loginAuthCipherAsymmertric = 'iPhone 14 15.4.' + uuid[0] + uuid[1] + phone + timestamp + password[:6] + '0$$$0.'
|
||||
|
||||
# 打印请求信息
|
||||
print(f"\n开始登录请求 - 手机号: {get_first_three(phone)}")
|
||||
|
||||
r = ss.post('https://appgologin.189.cn:9031/login/client/userLoginNormal',
|
||||
json={
|
||||
"headerInfos": {
|
||||
"code": "userLoginNormal",
|
||||
"timestamp": timestamp,
|
||||
"broadAccount": "",
|
||||
"broadToken": "",
|
||||
"clientType": "#9.6.1#channel50#iPhone 14 Pro Max#",
|
||||
"shopId": "20002",
|
||||
"source": "110003",
|
||||
"sourcePassword": "Sid98s",
|
||||
"token": "",
|
||||
"userLoginName": phone
|
||||
},
|
||||
"content": {
|
||||
"attach": "test",
|
||||
"fieldData": {
|
||||
"loginType": "4",
|
||||
"accountType": "",
|
||||
"loginAuthCipherAsymmertric": b64(loginAuthCipherAsymmertric),
|
||||
"deviceUid": uuid[0] + uuid[1] + uuid[2],
|
||||
"phoneNum": encode_phone(phone),
|
||||
"isChinatelecom": "0",
|
||||
"systemVersion": "15.4.0",
|
||||
"authentication": password
|
||||
}
|
||||
}
|
||||
},
|
||||
verify=certifi.where()
|
||||
).json()
|
||||
|
||||
# 打印响应信息
|
||||
print(f"登录响应: {r}")
|
||||
|
||||
# 检查登录结果
|
||||
if r.get('responseData', {}).get('resultCode') != '0000':
|
||||
error_msg = r.get('responseData', {}).get('resultDesc', '未知错误')
|
||||
print(f"登录失败 - 错误信息: {error_msg}")
|
||||
return False
|
||||
|
||||
try:
|
||||
l = r.get('responseData', {}).get('data', {}).get('loginSuccessResult')
|
||||
except AttributeError:
|
||||
print("登录响应格式异常")
|
||||
l = None
|
||||
|
||||
if l:
|
||||
load_token[phone] = l
|
||||
with open(load_token_file, 'w') as f:
|
||||
json.dump(load_token, f)
|
||||
ticket = get_ticket(phone,l['userId'],l['token'])
|
||||
return ticket
|
||||
|
||||
print(f"登录失败 - 无法获取登录成功结果")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"登录过程发生异常: {str(e)}")
|
||||
return False
|
||||
|
||||
async def exchangeForDay(phone, session, runTime, rid, stime,ckvalue,jsexec):
|
||||
async def delayed_conversion(delay):
|
||||
await asyncio.sleep(delay)
|
||||
await conversionRights(phone, rid,session,ckvalue,jsexec)
|
||||
|
||||
tasks = [asyncio.create_task(delayed_conversion(i * stime)) for i in range(int(runTime))]
|
||||
await asyncio.gather(*tasks)
|
||||
def get_ticket(phone,userId,token):
|
||||
r = ss.post('https://appgologin.189.cn:9031/map/clientXML',data='<Request><HeaderInfos><Code>getSingle</Code><Timestamp>'+datetime.datetime.now().strftime("%Y%m%d%H%M%S")+'</Timestamp><BroadAccount></BroadAccount><BroadToken></BroadToken><ClientType>#9.6.1#channel50#iPhone 14 Pro Max#</ClientType><ShopId>20002</ShopId><Source>110003</Source><SourcePassword>Sid98s</SourcePassword><Token>'+token+'</Token><UserLoginName>'+phone+'</UserLoginName></HeaderInfos><Content><Attach>test</Attach><FieldData><TargetId>'+encrypt(userId)+'</TargetId><Url>4a6862274835b451</Url></FieldData></Content></Request>',headers={'user-agent': 'CtClient;10.4.1;Android;13;22081212C;NTQzNzgx!#!MTgwNTg1'},verify=certifi.where())
|
||||
tk = re.findall('<Ticket>(.*?)</Ticket>',r.text)
|
||||
if len(tk) == 0:
|
||||
return False
|
||||
return decrypt(tk[0])
|
||||
|
||||
async def exchange2(session, phone, title, aid, jsexec):
|
||||
printn(f"{str(datetime.datetime.now())[11:23]} {get_first_three(phone)}")
|
||||
await asyncio.sleep(5) #测试网络延迟,弃用
|
||||
return printn(f"{str(datetime.datetime.now())[11:23]} {get_first_three(phone)}")
|
||||
|
||||
|
||||
|
||||
async def getConversionRights(phone, aid):
|
||||
pass
|
||||
@retry(
|
||||
stop=stop_after_attempt(1),
|
||||
wait=wait_exponential(multiplier=1, min=4, max=10),
|
||||
retry_error_callback=lambda retry_state: print(f"Retrying conversionRights, attempt {retry_state.attempt_number}")
|
||||
)
|
||||
async def conversionRights(phone, aid,SS,ckvalue,jsexec):
|
||||
pass
|
||||
def sync_before_sleep(retry_state, phone, SS, ticket):
|
||||
pass
|
||||
|
||||
async def before_sleep(retry_state, phone, SS, ticket):
|
||||
pass
|
||||
|
||||
@retry(
|
||||
stop=stop_after_attempt(3),
|
||||
wait=wait_exponential(multiplier=1, min=4, max=10),
|
||||
retry=retry_if_exception_type((httpx.ReadTimeout, httpx.HTTPError, ZeroDivisionError)),
|
||||
before_sleep=lambda retry_state: sync_before_sleep(retry_state, retry_state.args[0], retry_state.args[1], retry_state.args[2])
|
||||
)
|
||||
async def getLevelRightsList(phone, SS, jsexec, **kwargs):
|
||||
pass
|
||||
|
||||
async def getSign(ticket,SS,ckvalue):
|
||||
try:
|
||||
response_data =await SS.get('https://wapside.189.cn:9001/jt-sign/ssoHomLogin?ticket=' + ticket,cookies=ckvalue)
|
||||
response_data = response_data.json()
|
||||
if response_data.get('resoultCode') == '0':
|
||||
sign = response_data.get('sign')
|
||||
return sign
|
||||
else:
|
||||
print(f"获取sign失败[{response_data.get('resoultCode')}]: {response_data}")
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return None
|
||||
|
||||
|
||||
async def parse_cookies(ck,rsCK):
|
||||
cookies = {}
|
||||
for part in ck.split(';'):
|
||||
part = part.strip()
|
||||
if '=' in part:
|
||||
key, value = part.split('=', 1)
|
||||
if 'path' not in key and 'expires' not in key and 'Secure' not in key and 'SameSite' not in key:
|
||||
cookies[key] = value
|
||||
cookies["yiUIIlbdQT3fO"] = rsCK
|
||||
return cookies
|
||||
async def ascii_add_2(number_str):
|
||||
transformed = ''.join(chr(ord(char) + 2) for char in number_str)
|
||||
return transformed
|
||||
all_results = []
|
||||
|
||||
async def dxTask(phone, ticket, phoneV):
|
||||
global diffValue, ready_count
|
||||
retry_count = 0
|
||||
max_retries = 3
|
||||
|
||||
results = []
|
||||
|
||||
def format_message(msg):
|
||||
"""格式化错误消息"""
|
||||
if "省编码校验失败" in msg:
|
||||
return "非本号省口令"
|
||||
elif "券码已使用" in msg:
|
||||
return "已使用"
|
||||
return msg
|
||||
|
||||
while retry_count < max_retries:
|
||||
try:
|
||||
async with AsyncSessionManager() as s:
|
||||
phone2V=await ascii_add_2(phone)
|
||||
if 0== 0:
|
||||
payload = {
|
||||
"appType": "02",
|
||||
"authCode": ticket,
|
||||
"loginType": "1"
|
||||
}
|
||||
s.headers.update({
|
||||
'Accept': "application/json, text/plain, */*",
|
||||
'Cache-Control': "no-cache",
|
||||
'appType': "02",
|
||||
'userId': "",
|
||||
'Content-Type': "application/json;charset=UTF-8",
|
||||
'sessionKey': "",
|
||||
'Origin': "https://wapact.189.cn:9001",
|
||||
'Referer': "https://wapact.189.cn:9001/flcj1/",
|
||||
})
|
||||
response=await s.post('https://wapact.189.cn:9001/yzf1/dispatch/login', data=json.dumps(payload))
|
||||
if response.status_code == 200:
|
||||
print(f"账户:{get_first_three(phone)} 登录兑换任务成功")
|
||||
login = response.json()
|
||||
if login['success'] == True:
|
||||
phone2V=await ascii_add_2(phone)
|
||||
useridv=login["result"]["userId"]
|
||||
sessionKey=login["result"]["sessionKey"]
|
||||
if useridv:
|
||||
for code in WELFARE_CODES:
|
||||
print("开始兑换口令码:",code)
|
||||
convertpayload = {
|
||||
"userId": useridv,
|
||||
"code": code,
|
||||
"telephone": phone2V,
|
||||
"isNewUser": "0"
|
||||
}
|
||||
|
||||
s.headers.update({
|
||||
'userId':useridv,
|
||||
'sessionKey': sessionKey,
|
||||
})
|
||||
response=await s.post('https://wapact.189.cn:9001/yzf1/welfare/convert', data=json.dumps(convertpayload))
|
||||
if response.status_code == 200:
|
||||
convert=response.json()
|
||||
if convert.get('success') == True:
|
||||
results.append({
|
||||
'phone': get_first_three(phone),
|
||||
'code': code,
|
||||
'status': '✓',
|
||||
'message': '成功',
|
||||
'time': datetime.datetime.now().strftime("%H:%M:%S")
|
||||
})
|
||||
else:
|
||||
results.append({
|
||||
'phone': get_first_three(phone),
|
||||
'code': code,
|
||||
'status': '✗',
|
||||
'message': format_message(convert.get('errorMsg')),
|
||||
'time': datetime.datetime.now().strftime("%H:%M:%S")
|
||||
})
|
||||
|
||||
|
||||
welfarelistUrl=f"https://wapact.189.cn:9001/yzf1/welfare/list?userId={useridv}&telephone={phone2V}"+"&state=0&size=100&page=0"#state=1所有完成的,state=0查看未完成
|
||||
print("领取可能不及时到账,延迟5秒再去奖券查找可领取的奖品。")
|
||||
await asyncio.sleep(5)
|
||||
response=await s.get(welfarelistUrl)
|
||||
|
||||
if response.status_code == 200:
|
||||
datavv=response.json()
|
||||
if datavv.get('success') != True:
|
||||
print("领取异常:",datavv)
|
||||
return
|
||||
if datavv.get('result') is not None and len(datavv['result']) > 0 and datavv['result'][0] is not None:
|
||||
dataVVVVList=datavv['result']
|
||||
for dataVVVV in dataVVVVList:
|
||||
if dataVVVV['name'] is not None and '元' in dataVVVV['name']:
|
||||
taskId = dataVVVV["id"]
|
||||
print("开始领取", dataVVVV['name'])
|
||||
verifypayload = {
|
||||
"userId": useridv,
|
||||
"id": taskId,
|
||||
"telephone": phone2V,
|
||||
"source": "1"
|
||||
}
|
||||
await asyncio.sleep(5)
|
||||
try:
|
||||
response = await s.post(
|
||||
'https://wapact.189.cn:9001/yzf1/welfare/verify',
|
||||
data=json.dumps(verifypayload)
|
||||
)
|
||||
if response.status_code == 200:
|
||||
verify = response.json()
|
||||
if verify.get('success') == True:
|
||||
results.append({
|
||||
'phone': get_first_three(phone),
|
||||
'code': dataVVVV['name'],
|
||||
'status': '✓',
|
||||
'message': '成功',
|
||||
'time': datetime.datetime.now().strftime("%H:%M:%S")
|
||||
})
|
||||
else:
|
||||
results.append({
|
||||
'phone': get_first_three(phone),
|
||||
'code': dataVVVV['name'],
|
||||
'status': '✗',
|
||||
'message': format_message(verify.get('errorMsg')),
|
||||
'time': datetime.datetime.now().strftime("%H:%M:%S")
|
||||
})
|
||||
except Exception as e:
|
||||
print(f"验证请求失败: {str(e)}")
|
||||
else:
|
||||
print("奖券已无可领取奖品或延迟不到账稍后重试:", datavv)
|
||||
else:
|
||||
print("领取失败:", datavv)
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
retry_count += 1
|
||||
if retry_count >= max_retries:
|
||||
print(f"账号 {get_first_three(phone)} 达到最大重试次数,跳过")
|
||||
break
|
||||
print(f"账号 {get_first_three(phone)} 发生错误: {str(e)}, 第 {retry_count} 次重试")
|
||||
await asyncio.sleep(5 * retry_count)
|
||||
if results:
|
||||
global all_results
|
||||
all_results.extend(results)
|
||||
|
||||
|
||||
async def get_session(session_pool):
|
||||
return session_pool[random.randint(0, len(session_pool) - 1)]
|
||||
async def xbkset_request(ss,url):
|
||||
response=await ss.get(url)
|
||||
if response.status_code == 200:
|
||||
rsCK = re.findall('SESSION=([^;]+)',response.headers['Set-Cookie'])[0]
|
||||
return response.json(), rsCK
|
||||
else:
|
||||
print("瑞数失败")
|
||||
return response.json(),None
|
||||
return response.json(), None
|
||||
|
||||
async def addVotingRecord(session,phone, ticket):
|
||||
codeValue="ACTCODE20241212V8LHJF5Y"
|
||||
restfulurl="https://wapact.189.cn:9001/mas-pub-web/spm/restful"
|
||||
restfulurl+=f"?method=setRedisPagesJson&activityCode={codeValue}&pageId=&activityId=&phoneNum=&previewType=&subPageLinkCode=&isPreview="
|
||||
session.headers.update({
|
||||
'activityCode': codeValue,
|
||||
'yxai': codeValue,
|
||||
'ticket': ticket,
|
||||
})
|
||||
dataxb, SESSION = await xbkset_request(session, restfulurl)
|
||||
|
||||
url = "https://wapact.189.cn:9001/mas-pub-web/component/addVotingRecord"
|
||||
payload = {
|
||||
"groupId": 2067,
|
||||
"contentId": "1b7b42c3a7824005bad832d3a2d925a5"
|
||||
}
|
||||
headers = {
|
||||
'Host': "wapact.189.cn:9001",
|
||||
'User-Agent': "CtClient;11.3.0;Android;12;Redmi K30 Pro;MDM3MzE2!#!MTMxODk",
|
||||
'Accept': "application/json, text/plain, */*",
|
||||
'Accept-Encoding': "gzip, deflate, br, zstd",
|
||||
'Content-Type': "application/json",
|
||||
'sec-ch-ua-platform': "\"Android\"",
|
||||
'activityCode': "ACTCODE20241212V8LHJF5Y",
|
||||
'sec-ch-ua': "\"Android WebView\";v=\"131\", \"Chromium\";v=\"131\", \"Not_A Brand\";v=\"24\"",
|
||||
'sec-ch-ua-mobile': "?1",
|
||||
'id': "",
|
||||
'wyopenid': "",
|
||||
'Content-Type': "application/json;charset=UTF-8",
|
||||
'activityId': "",
|
||||
'ticket': str(ticket),
|
||||
'wyDataStr': "",
|
||||
'masEnv': "android",
|
||||
'yxai': "ACTCODE20241212V8LHJF5Y",
|
||||
'wycorpId': "",
|
||||
'Origin': "https://wapact.189.cn:9001",
|
||||
'X-Requested-With': "com.ct.client",
|
||||
'Sec-Fetch-Site': "same-origin",
|
||||
'Sec-Fetch-Mode': "cors",
|
||||
'Sec-Fetch-Dest': "empty",
|
||||
'Accept-Language': "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
||||
'Cookie': f'SESSION={SESSION}'
|
||||
}
|
||||
res=await session.post(url, data=json.dumps(payload), headers=headers)
|
||||
if res.status_code == 200:
|
||||
res = res.json()
|
||||
if res.get("code") is not None:
|
||||
if res.get("msg") is not None:
|
||||
print("👍")
|
||||
pass
|
||||
time.sleep(3)
|
||||
|
||||
async def AI_Yun1(phone, ticket):
|
||||
global diffValue, ready_count
|
||||
timeout_config = httpx.Timeout(30.0, connect=60.0, read=60.0)
|
||||
async with AsyncSessionManager( timeout=timeout_config) as session:
|
||||
await addVotingRecord(session,phone, ticket)
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
async def main(isTrue):
|
||||
tasks = []
|
||||
|
||||
phone_list = PHONES.split('\n')
|
||||
total_tasks = len(phone_list)
|
||||
print(f"总任务数:{total_tasks}")
|
||||
semaphore = asyncio.Semaphore(5)
|
||||
|
||||
async def wrapped_task(phone_info, ticket, phoneV):
|
||||
async with semaphore:
|
||||
currtime = datetime.datetime.now()
|
||||
if currtime > datetime.datetime.strptime("2025-02-21 00:00:00", "%Y-%m-%d %H:%M:%S"):
|
||||
pass
|
||||
else:
|
||||
await AI_Yun1(phone_info.split('#')[0], ticket) # 使用#分割后的手机号
|
||||
await dxTask(phone_info.split('#')[0], ticket, phoneV) # 使用#分割后的手机号
|
||||
|
||||
for index, phoneV in enumerate(phone_list, start=1):
|
||||
print(f"正在处理任务 {index}/{total_tasks}")
|
||||
|
||||
# 使用#分割手机号和密码
|
||||
if '#' not in phoneV:
|
||||
print('账号格式错误,应为: 手机号#服务密码')
|
||||
continue
|
||||
|
||||
phone, password = phoneV.split('#')
|
||||
if not phone.isdigit() or len(phone) != 11:
|
||||
print(f'手机号格式错误: {phone}')
|
||||
continue
|
||||
|
||||
if not password.isdigit() or len(password) != 6:
|
||||
print(f'服务密码格式错误: {password},应为6位数字')
|
||||
continue
|
||||
|
||||
ticket = False
|
||||
|
||||
if phone in load_token:
|
||||
print(f'\n{phone} 使用缓存登录')
|
||||
ticket = get_ticket(phone, load_token[phone]['userId'], load_token[phone]['token'])
|
||||
|
||||
if not ticket:
|
||||
print(f'\n{phone} 使用密码登录')
|
||||
ticket = userLoginNormal(phone, password)
|
||||
|
||||
if ticket:
|
||||
tasks.append(asyncio.create_task(wrapped_task(phoneV, ticket, load_token[phone])))
|
||||
await asyncio.sleep(1)
|
||||
else:
|
||||
print(f'\n{phone} 登录失败')
|
||||
try:
|
||||
await asyncio.gather(*tasks, return_exceptions=True)
|
||||
if all_results:
|
||||
df = pd.DataFrame(all_results)
|
||||
pd.set_option('display.max_colwidth', 30)
|
||||
from tabulate import tabulate
|
||||
stats_df = df.groupby('phone').agg({
|
||||
'status': lambda x: f"成功:{len([s for s in x if s=='✓'])} 失败:{len([s for s in x if s=='✗'])}"
|
||||
}).reset_index()
|
||||
stats_df.columns = ['手机号', '统计结果']
|
||||
|
||||
print("\n执行结果:")
|
||||
print(tabulate(df, headers='keys', tablefmt='grid', showindex=False))
|
||||
|
||||
print("\n统计结果:")
|
||||
print(tabulate(stats_df, headers='keys', tablefmt='grid', showindex=False))
|
||||
|
||||
except Exception as e:
|
||||
print(f"任务执行出错: {str(e)}")
|
||||
|
||||
|
||||
|
||||
|
||||
WELFARE_CODE=os.environ.get('dx_kl') or "心有灵犀,绑定福利,事事如意,2025加油,草长莺飞,888,年末狂欢,年末回馈"
|
||||
WELFARE_CODES = WELFARE_CODE.split(',')
|
||||
|
||||
# 处理账号字符串,移除空行并清理每行的空白字符
|
||||
phone_list = [line.strip() for line in chinaTelecomAccount.split('\n') if line.strip()]
|
||||
|
||||
PHONES = os.environ.get('chinaTelecomAccount') or os.environ.get('PHONES1') or '\n'.join(phone_list)
|
||||
|
||||
if __name__ == "__main__":
|
||||
pd.set_option('display.max_columns', None)
|
||||
pd.set_option('display.width', None)
|
||||
pd.set_option('display.max_colwidth', None)
|
||||
|
||||
global timeValue, timeDiff
|
||||
# print("开始等待场次时间:")
|
||||
h = datetime.datetime.now().hour
|
||||
# print("当前小时为: " + str(h))
|
||||
random_m = random.randint(1, 59)
|
||||
wttime = ttt(1, 59, 1)
|
||||
if 1 + 1 == 12:
|
||||
isTRUE = True
|
||||
else:
|
||||
isTRUE = False
|
||||
|
||||
if wttime > time.time():
|
||||
wTime = wttime - time.time()
|
||||
print("未到时间,计算后差异:" + str(wTime) + "秒")
|
||||
if isTRUE:
|
||||
time.sleep(wTime)
|
||||
print("开始抢购")
|
||||
|
||||
asyncio.run(main(isTRUE))
|
||||
|
||||
|
||||
515
电信金豆换话费.py
Normal file
515
电信金豆换话费.py
Normal file
@@ -0,0 +1,515 @@
|
||||
# 非青龙下在文件开头添加账号配置,
|
||||
# process.env.chinaTelecomAccount = `
|
||||
# 13454545457#123456
|
||||
# 13454545457#456789
|
||||
# `.trim();
|
||||
'''
|
||||
变量:chinaTelecomAccount
|
||||
变量格式: 手机号#服务密码
|
||||
多号创建多个变量或者换行、&隔开
|
||||
'''
|
||||
import requests
|
||||
import re
|
||||
import time
|
||||
import json
|
||||
import random
|
||||
import datetime
|
||||
import base64
|
||||
import threading
|
||||
import ssl
|
||||
import execjs
|
||||
import os
|
||||
import sys
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from Crypto.PublicKey import RSA
|
||||
from Crypto.Cipher import PKCS1_v1_5
|
||||
from Crypto.Cipher import DES3
|
||||
from Crypto.Util.Padding import pad, unpad
|
||||
from Crypto.Util.strxor import strxor
|
||||
from Crypto.Cipher import AES
|
||||
from http import cookiejar # Python 2: import cookielib as cookiejar
|
||||
from requests.adapters import HTTPAdapter
|
||||
from requests.packages.urllib3.util.ssl_ import create_urllib3_context
|
||||
|
||||
|
||||
class BlockAll(cookiejar.CookiePolicy):
|
||||
return_ok = set_ok = domain_return_ok = path_return_ok = lambda self, *args, **kwargs: False
|
||||
netscape = True
|
||||
rfc2965 = hide_cookie2 = False
|
||||
|
||||
def printn(m):
|
||||
print(f'\n{m}')
|
||||
ORIGIN_CIPHERS = ('DEFAULT@SECLEVEL=1')
|
||||
|
||||
ip_list = []
|
||||
class DESAdapter(HTTPAdapter):
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
A TransportAdapter that re-enables 3DES support in Requests.
|
||||
"""
|
||||
CIPHERS = ORIGIN_CIPHERS.split(':')
|
||||
random.shuffle(CIPHERS)
|
||||
CIPHERS = ':'.join(CIPHERS)
|
||||
self.CIPHERS = CIPHERS + ':!aNULL:!eNULL:!MD5'
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
def init_poolmanager(self, *args, **kwargs):
|
||||
context = create_urllib3_context(ciphers=self.CIPHERS)
|
||||
kwargs['ssl_context'] = context
|
||||
return super(DESAdapter, self).init_poolmanager(*args, **kwargs)
|
||||
|
||||
def proxy_manager_for(self, *args, **kwargs):
|
||||
context = create_urllib3_context(ciphers=self.CIPHERS)
|
||||
kwargs['ssl_context'] = context
|
||||
return super(DESAdapter, self).proxy_manager_for(*args, **kwargs)
|
||||
|
||||
|
||||
requests.packages.urllib3.disable_warnings()
|
||||
ssl_context = ssl.create_default_context()
|
||||
ssl_context.check_hostname = False
|
||||
ssl_context.verify_mode = ssl.CERT_NONE
|
||||
ssl_context.set_ciphers('DEFAULT@SECLEVEL=0')
|
||||
ss = requests.session()
|
||||
ss.ssl=ssl_context
|
||||
ss.headers={"User-Agent":"Mozilla/5.0 (Linux; Android 13; 22081212C Build/TKQ1.220829.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.97 Mobile Safari/537.36","Referer":"https://wapact.189.cn:9001/JinDouMall/JinDouMall_independentDetails.html"}
|
||||
ss.mount('https://', DESAdapter())
|
||||
yc = 0.1
|
||||
wt = 0
|
||||
kswt = -3
|
||||
yf = datetime.datetime.now().strftime("%Y%m")
|
||||
|
||||
|
||||
jp = {"9":{},"12":{},"13":{},"23":{}}
|
||||
|
||||
|
||||
try:
|
||||
with open('电信金豆换话费.log') as fr:
|
||||
dhjl = json.load(fr)
|
||||
except:
|
||||
dhjl = {}
|
||||
if yf not in dhjl:
|
||||
dhjl[yf] = {}
|
||||
|
||||
|
||||
|
||||
|
||||
wxp={}
|
||||
errcode = {
|
||||
"0":"兑换成功",
|
||||
"412":"兑换次数已达上限",
|
||||
"413":"商品已兑完",
|
||||
"420":"未知错误",
|
||||
"410":"该活动已失效~",
|
||||
"Y0001":"当前等级不足,去升级兑当前话费",
|
||||
"Y0002":"使用翼相连网络600分钟或连接并拓展网络500分钟可兑换此奖品",
|
||||
"Y0003":"使用翼相连共享流量400M或共享WIFI:2GB可兑换此奖品",
|
||||
"Y0004":"使用翼相连共享流量2GB可兑换此奖品",
|
||||
"Y0005":"当前等级不足,去升级兑当前话费",
|
||||
"E0001":"您的网龄不足10年,暂不能兑换"
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#加密参数
|
||||
key = b'1234567`90koiuyhgtfrdews'
|
||||
iv = 8 * b'\0'
|
||||
|
||||
public_key_b64 = '''-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBkLT15ThVgz6/NOl6s8GNPofdWzWbCkWnkaAm7O2LjkM1H7dMvzkiqdxU02jamGRHLX/ZNMCXHnPcW/sDhiFCBN18qFvy8g6VYb9QtroI09e176s+ZCtiv7hbin2cCTj99iUpnEloZm19lwHyo69u5UMiPMpq0/XKBO8lYhN/gwIDAQAB
|
||||
-----END PUBLIC KEY-----'''
|
||||
|
||||
public_key_data = '''-----BEGIN PUBLIC KEY-----
|
||||
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC+ugG5A8cZ3FqUKDwM57GM4io6JGcStivT8UdGt67PEOihLZTw3P7371+N47PrmsCpnTRzbTgcupKtUv8ImZalYk65dU8rjC/ridwhw9ffW2LBwvkEnDkkKKRi2liWIItDftJVBiWOh17o6gfbPoNrWORcAdcbpk2L+udld5kZNwIDAQAB
|
||||
-----END PUBLIC KEY-----'''
|
||||
|
||||
|
||||
def t(h):
|
||||
date = datetime.datetime.now()
|
||||
date_zero = datetime.datetime.now().replace(year=date.year, month=date.month, day=date.day, hour=h, minute=59, second=59)
|
||||
date_zero_time = int(time.mktime(date_zero.timetuple()))
|
||||
return date_zero_time
|
||||
|
||||
|
||||
|
||||
def encrypt(text):
|
||||
cipher = DES3.new(key, DES3.MODE_CBC, iv)
|
||||
ciphertext = cipher.encrypt(pad(text.encode(), DES3.block_size))
|
||||
return ciphertext.hex()
|
||||
|
||||
def decrypt(text):
|
||||
ciphertext = bytes.fromhex(text)
|
||||
cipher = DES3.new(key, DES3.MODE_CBC, iv)
|
||||
plaintext = unpad(cipher.decrypt(ciphertext), DES3.block_size)
|
||||
return plaintext.decode()
|
||||
|
||||
|
||||
|
||||
def b64(plaintext):
|
||||
public_key = RSA.import_key(public_key_b64)
|
||||
cipher = PKCS1_v1_5.new(public_key)
|
||||
ciphertext = cipher.encrypt(plaintext.encode())
|
||||
return base64.b64encode(ciphertext).decode()
|
||||
|
||||
def encrypt_para(plaintext):
|
||||
public_key = RSA.import_key(public_key_data)
|
||||
cipher = PKCS1_v1_5.new(public_key)
|
||||
ciphertext = cipher.encrypt(plaintext.encode())
|
||||
return ciphertext.hex()
|
||||
|
||||
|
||||
def encode_phone(text):
|
||||
encoded_chars = []
|
||||
for char in text:
|
||||
encoded_chars.append(chr(ord(char) + 2))
|
||||
return ''.join(encoded_chars)
|
||||
|
||||
def ophone(t):
|
||||
key = b'34d7cb0bcdf07523'
|
||||
utf8_key = key.decode('utf-8')
|
||||
utf8_t = t.encode('utf-8')
|
||||
cipher = AES.new(key, AES.MODE_ECB)
|
||||
ciphertext = cipher.encrypt(pad(utf8_t, AES.block_size))
|
||||
return ciphertext.hex()
|
||||
|
||||
def send(uid,content):
|
||||
r = requests.post('https://wxpusher.zjiecode.com/api/send/message',json={"appToken":appToken,"content":content,"contentType":1,"uids":[uid]}).json()
|
||||
return r
|
||||
|
||||
|
||||
def userLoginNormal(phone,password):
|
||||
alphabet = 'abcdef0123456789'
|
||||
uuid = [''.join(random.sample(alphabet, 8)),''.join(random.sample(alphabet, 4)),'4'+''.join(random.sample(alphabet, 3)),''.join(random.sample(alphabet, 4)),''.join(random.sample(alphabet, 12))]
|
||||
timestamp=datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
loginAuthCipherAsymmertric = 'iPhone 14 15.4.' + uuid[0] + uuid[1] + phone + timestamp + password[:6] + '0$$$0.'
|
||||
|
||||
r = ss.post('https://appgologin.189.cn:9031/login/client/userLoginNormal',json={"headerInfos": {"code": "userLoginNormal", "timestamp": timestamp, "broadAccount": "", "broadToken": "", "clientType": "#9.6.1#channel50#iPhone 14 Pro Max#", "shopId": "20002", "source": "110003", "sourcePassword": "Sid98s", "token": "", "userLoginName": phone}, "content": {"attach": "test", "fieldData": {"loginType": "4", "accountType": "", "loginAuthCipherAsymmertric": b64(loginAuthCipherAsymmertric), "deviceUid": uuid[0] + uuid[1] + uuid[2], "phoneNum": encode_phone(phone), "isChinatelecom": "0", "systemVersion": "15.4.0", "authentication": password}}}).json()
|
||||
|
||||
|
||||
|
||||
l = r['responseData']['data']['loginSuccessResult']
|
||||
|
||||
if l:
|
||||
load_token[phone] = l
|
||||
with open(load_token_file, 'w') as f:
|
||||
json.dump(load_token, f)
|
||||
ticket = get_ticket(phone,l['userId'],l['token'])
|
||||
return ticket
|
||||
|
||||
return False
|
||||
def get_ticket(phone,userId,token):
|
||||
r = ss.post('https://appgologin.189.cn:9031/map/clientXML',data='<Request><HeaderInfos><Code>getSingle</Code><Timestamp>'+datetime.datetime.now().strftime("%Y%m%d%H%M%S")+'</Timestamp><BroadAccount></BroadAccount><BroadToken></BroadToken><ClientType>#9.6.1#channel50#iPhone 14 Pro Max#</ClientType><ShopId>20002</ShopId><Source>110003</Source><SourcePassword>Sid98s</SourcePassword><Token>'+token+'</Token><UserLoginName>'+phone+'</UserLoginName></HeaderInfos><Content><Attach>test</Attach><FieldData><TargetId>'+encrypt(userId)+'</TargetId><Url>4a6862274835b451</Url></FieldData></Content></Request>',headers={'user-agent': 'CtClient;10.4.1;Android;13;22081212C;NTQzNzgx!#!MTgwNTg1'})
|
||||
|
||||
#printn(phone, '获取ticket', re.findall('<Reason>(.*?)</Reason>',r.text)[0])
|
||||
|
||||
tk = re.findall('<Ticket>(.*?)</Ticket>',r.text)
|
||||
if len(tk) == 0:
|
||||
return False
|
||||
|
||||
|
||||
return decrypt(tk[0])
|
||||
|
||||
|
||||
|
||||
def queryInfo(phone,s):
|
||||
global rs
|
||||
a = 1
|
||||
while a < 10:
|
||||
if rs:
|
||||
bd = js.call('main').split('=')
|
||||
ck[bd[0]] = bd[1]
|
||||
|
||||
r = s.get('https://wapact.189.cn:9001/gateway/golden/api/queryInfo',cookies=ck).json()
|
||||
|
||||
try:
|
||||
printn(f'{phone} 金豆余额 {r["biz"]["amountTotal"]}')
|
||||
amountTotal= r["biz"]["amountTotal"]
|
||||
except:
|
||||
amountTotal = 0
|
||||
if amountTotal< 3000:
|
||||
if rs == 1:
|
||||
bd = js.call('main').split('=')
|
||||
ck [bd[0]] = bd[1]
|
||||
|
||||
|
||||
res = s.post('http://wapact.189.cn:9000/gateway/stand/detail/exchange',json={"activityId":jdaid},cookies=ck).text
|
||||
|
||||
if '$_ts=window' in res:
|
||||
first_request()
|
||||
rs = 1
|
||||
|
||||
time.sleep(3)
|
||||
else:
|
||||
return r
|
||||
a += 1
|
||||
|
||||
|
||||
return r
|
||||
|
||||
|
||||
def exchange(phone,s,title,aid, uid):
|
||||
|
||||
try:
|
||||
bd = js.call('main').split('=')
|
||||
ck [bd[0]] = bd[1]
|
||||
r = s.post('https://wapact.189.cn:9001/gateway/standExchange/detailNew/exchange',json={"activityId":aid},cookies=ck)
|
||||
printn(f"响应码: {r.status_code}")
|
||||
|
||||
if '$_ts=window' in r.text:
|
||||
|
||||
first_request(r.text)
|
||||
return
|
||||
r = r.json()
|
||||
|
||||
if r["code"] == 0:
|
||||
if r["biz"] != {} and r["biz"]["resultCode"] in errcode:
|
||||
#printn(str(datetime.datetime.now())[11:22], phone, title,errcode[r["biz"]["resultCode"]])
|
||||
printn(f'{str(datetime.datetime.now())[11:22]} {phone} {title} {errcode[r["biz"]["resultCode"]]}')
|
||||
|
||||
|
||||
if r["biz"]["resultCode"] in ["0","412"]:
|
||||
if r["biz"]["resultCode"] == "0":
|
||||
msg = phone+":"+title+"兑换成功"
|
||||
|
||||
send(uid, msg)
|
||||
if phone not in dhjl[yf][title]:
|
||||
dhjl[yf][title] += "#"+phone
|
||||
with open('电信金豆换话费.log', 'w') as f:
|
||||
json.dump(dhjl, f, ensure_ascii=False)
|
||||
|
||||
|
||||
else:
|
||||
#printn(str(datetime.datetime.now())[11:22], phone, r["message"])
|
||||
printn(f'{str(datetime.datetime.now())[11:22]} {phone} {r}')
|
||||
|
||||
except Exception as e:
|
||||
#print(e)
|
||||
pass
|
||||
|
||||
|
||||
def dh(phone,s,title,aid,wt, uid):
|
||||
|
||||
while wt > time.time():
|
||||
pass
|
||||
|
||||
printn(f"{str(datetime.datetime.now())[11:22]} {phone} {title} 开始兑换")
|
||||
|
||||
if rs:
|
||||
bd = js.call('main').split('=')
|
||||
ck [bd[0]] = bd[1]
|
||||
for cs in range(cfcs):
|
||||
threading.Thread(target=exchange,args=(phone,s,title,aid, uid)).start()
|
||||
#time.sleep(5)
|
||||
|
||||
|
||||
|
||||
def lottery(s):
|
||||
for cishu in range(3):
|
||||
try:
|
||||
if rs:
|
||||
bd = js.call('main').split('=')
|
||||
ck [bd[0]] = bd[1]
|
||||
else:
|
||||
cookie = {}
|
||||
r = s.post('https://wapact.189.cn:9001/gateway/golden/api/lottery',json={"activityId":"6384b49b1e44396da4f1e4a3"},cookies=ck)
|
||||
except:
|
||||
pass
|
||||
time.sleep(3)
|
||||
|
||||
def aes_ecb_encrypt(plaintext, key):
|
||||
key = key.encode('utf-8')
|
||||
if len(key) not in [16, 24, 32]:
|
||||
raise ValueError("密钥长度必须为16/24/32字节")
|
||||
|
||||
# 对明文进行PKCS7填充
|
||||
padded_data = pad(plaintext.encode('utf-8'), AES.block_size)
|
||||
#padded_data = plaintext.encode('utf-8')
|
||||
# 创建AES ECB加密器
|
||||
cipher = AES.new(key, AES.MODE_ECB)
|
||||
|
||||
# 加密并返回Base64编码结果
|
||||
ciphertext = cipher.encrypt(padded_data)
|
||||
return base64.b64encode(ciphertext).decode('utf-8')
|
||||
def ks(phone, ticket, uid):
|
||||
global wt
|
||||
|
||||
wxp[phone] = uid
|
||||
s = requests.session()
|
||||
s.headers={"User-Agent":"Mozilla/5.0 (Linux; Android 13; 22081212C Build/TKQ1.220829.002) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.97 Mobile Safari/537.36","Referer":"https://wapact.189.cn:9001/JinDouMall/JinDouMall_independentDetails.html"}
|
||||
s.cookies.set_policy(BlockAll())
|
||||
s.mount('https://', DESAdapter())
|
||||
s.timeout = 30
|
||||
if rs:
|
||||
bd = js.call('main').split('=')
|
||||
ck [bd[0]] = bd[1]
|
||||
|
||||
data = aes_ecb_encrypt(json.dumps({"ticket":ticket,"backUrl":"https%3A%2F%2Fwapact.189.cn%3A9001","platformCode":"P201010301","loginType":2}), 'telecom_wap_2018')
|
||||
|
||||
login = ss.post('https://wapact.189.cn:9001/unified/user/login',data=data, headers={"Content-Type":"application/json;charset=UTF-8","Accept":"application/json, text/javascript, */*; q=0.01"}, cookies=ck).json()
|
||||
# login = s.post('https://wapact.189.cn:9001/unified/user/login',json={"ticket":ticket,"backUrl":"https%3A%2F%2Fwapact.189.cn%3A9001","platformCode":"P201010301","loginType":2}, cookies=ck).json()
|
||||
if login['code'] == 0:
|
||||
printn(phone+" 获取token成功")
|
||||
s.headers["Authorization"] = "Bearer " + login["biz"]["token"]
|
||||
|
||||
queryInfo(phone,s)
|
||||
|
||||
|
||||
if rs:
|
||||
bd = js.call('main').split('=')
|
||||
ck [bd[0]] = bd[1]
|
||||
|
||||
queryBigDataAppGetOrInfo = s.get('https://waphub.189.cn/gateway/golden/goldGoods/getGoodsList??floorType=0&userType=1&page&1&order=2&tabOrder=',cookies=ck).json()
|
||||
# printn(queryBigDataAppGetOrInfo)
|
||||
for i in queryBigDataAppGetOrInfo["biz"]["ExchangeGoodslist"]:
|
||||
if '话费' not in i["title"]:continue
|
||||
|
||||
if '0.5元' in i["title"] or '5元' in i["title"]:
|
||||
jp["9"][i["title"]] = i["id"]
|
||||
elif '1元' in i["title"] or '10元' in i["title"]:
|
||||
jp["13"][i["title"]] = i["id"]
|
||||
else:
|
||||
jp["12"][i["title"]] = i["id"]
|
||||
|
||||
|
||||
|
||||
h = datetime.datetime.now().hour
|
||||
if 11 > h > 1:
|
||||
h = 9
|
||||
|
||||
elif 23 > h > 1:
|
||||
h = 13
|
||||
|
||||
else:
|
||||
h = 23
|
||||
|
||||
if len(sys.argv) ==2:
|
||||
h = int(sys.argv[1])
|
||||
#h=23
|
||||
d = jp[str(h)]
|
||||
|
||||
wt = t(h) + kswt
|
||||
|
||||
if jp["12"] != {}:
|
||||
d.update(jp["12"])
|
||||
wt = 0
|
||||
|
||||
for di in d:
|
||||
#if '5' in di:
|
||||
if di not in dhjl[yf]:
|
||||
dhjl[yf][di] = ""
|
||||
if phone in dhjl[yf][di] :
|
||||
printn(f"{phone} {di} 已兑换")
|
||||
|
||||
else:
|
||||
|
||||
printn(f"{phone} {di}")
|
||||
if wt - time.time() > 20 * 60:
|
||||
print("等待时间超过20分钟")
|
||||
return
|
||||
|
||||
|
||||
threading.Thread(target=dh,args=(phone,s,di,d[di],wt, uid)).start()
|
||||
|
||||
|
||||
else:
|
||||
|
||||
printn(f"{phone} 获取token {login['message']}")
|
||||
|
||||
|
||||
|
||||
def first_request(res=''):
|
||||
global js, fw
|
||||
url = 'https://wapact.189.cn:9001/gateway/stand/detail/exchange'
|
||||
if res == '':
|
||||
response = ss.get(url)
|
||||
res = response.text
|
||||
soup = BeautifulSoup(res, 'html.parser')
|
||||
scripts = soup.find_all('script')
|
||||
for script in scripts:
|
||||
if 'src' in str(script):
|
||||
rsurl = re.findall('src="([^"]+)"', str(script))[0]
|
||||
|
||||
if '$_ts=window' in script.get_text():
|
||||
ts_code = script.get_text()
|
||||
|
||||
|
||||
urls = url.split('/')
|
||||
rsurl = urls[0] + '//' + urls[2] + rsurl
|
||||
#print(rsurl)
|
||||
ts_code += ss.get(rsurl).text
|
||||
content_code = soup.find_all('meta')[1].get('content')
|
||||
with open("瑞数通杀.js") as f:
|
||||
js_code_ym = f.read()
|
||||
js_code = js_code_ym.replace('content_code', content_code).replace("'ts_code'", ts_code)
|
||||
js = execjs.compile(js_code)
|
||||
|
||||
for cookie in ss.cookies:
|
||||
ck[cookie.name] = cookie.value
|
||||
return content_code, ts_code, ck
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
global wt,rs
|
||||
r = ss.get('https://wapact.189.cn:9001/gateway/stand/detailNew/exchange')
|
||||
if '$_ts=window' in r.text:
|
||||
rs = 1
|
||||
print("瑞数加密已开启")
|
||||
first_request()
|
||||
else:
|
||||
print("瑞数加密已关闭")
|
||||
rs = 0
|
||||
if os.environ.get('jdhf')!= None:
|
||||
chinaTelecomAccount = os.environ.get('jdhf')
|
||||
else:
|
||||
chinaTelecomAccount = jdhf
|
||||
|
||||
for i in chinaTelecomAccount.split('&'):
|
||||
|
||||
i = i.split('@')
|
||||
phone = i[0]
|
||||
password = i[1]
|
||||
uid = i[-1]
|
||||
ticket = False
|
||||
|
||||
#ticket = get_userTicket(phone)
|
||||
|
||||
if phone in load_token:
|
||||
printn(f'{phone} 使用缓存登录')
|
||||
ticket = get_ticket(phone,load_token[phone]['userId'],load_token[phone]['token'])
|
||||
|
||||
if ticket == False:
|
||||
printn(f'{phone} 使用密码登录')
|
||||
ticket = userLoginNormal(phone,password)
|
||||
|
||||
if ticket:
|
||||
threading.Thread(target=ks,args=(phone, ticket, uid)).start()
|
||||
|
||||
time.sleep(1)
|
||||
else:
|
||||
printn(f'{phone} 登录失败')
|
||||
|
||||
#手机号@密码@wxpusheruid
|
||||
jdhf = ""
|
||||
#重发次数
|
||||
cfcs = 15
|
||||
#wxpusher推送appToken
|
||||
appToken = ""
|
||||
jdaid = '60dd79533dc03d3c76bdde30'
|
||||
ck = {}
|
||||
load_token_file = 'chinaTelecom_cache.json'
|
||||
try:
|
||||
with open(load_token_file, 'r') as f:
|
||||
load_token = json.load(f)
|
||||
except:
|
||||
load_token = {}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user