mirror of
https://github.com/XiaoGe-LiBai/yangmao.git
synced 2025-12-19 04:44:34 +08:00
删除
This commit is contained in:
2322
zgdx中国电信.js
2322
zgdx中国电信.js
File diff suppressed because it is too large
Load Diff
451
电信兑换.py
451
电信兑换.py
@@ -1,451 +0,0 @@
|
|||||||
"""
|
|
||||||
新电信抢话费
|
|
||||||
|
|
||||||
群里发的,未测试好,自测
|
|
||||||
修改内容如下“
|
|
||||||
1.删除内置的一个手机账号
|
|
||||||
2.修改环境变量名保持和拉菲电信金豆本环境变量一致
|
|
||||||
3.恢复瑞数通杀.js调用地址,确实也不知道是啥。398、399行注释
|
|
||||||
|
|
||||||
环境变量chinaTelecomAccount,值为:账号#密码
|
|
||||||
|
|
||||||
cron: 57 9,13,23 * * *
|
|
||||||
const $ = new Env("新电信抢话费");
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
import ssl
|
|
||||||
import time
|
|
||||||
import json
|
|
||||||
import execjs
|
|
||||||
import base64
|
|
||||||
import random
|
|
||||||
import certifi
|
|
||||||
import aiohttp
|
|
||||||
import asyncio
|
|
||||||
import certifi
|
|
||||||
import datetime
|
|
||||||
import requests
|
|
||||||
import binascii
|
|
||||||
from lxml import etree
|
|
||||||
from http import cookiejar
|
|
||||||
from Crypto.Cipher import AES
|
|
||||||
from Crypto.Cipher import DES3
|
|
||||||
from Crypto.PublicKey import RSA
|
|
||||||
from Crypto.Cipher import PKCS1_v1_5
|
|
||||||
from Crypto.Util.Padding import pad, unpad
|
|
||||||
from aiohttp import ClientSession, TCPConnector
|
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
|
||||||
run_num=os.environ.get('reqNUM') or "80"
|
|
||||||
|
|
||||||
diffValue=2
|
|
||||||
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):
|
|
||||||
self.session = None
|
|
||||||
self.connector = None
|
|
||||||
|
|
||||||
async def __aenter__(self):
|
|
||||||
ssl_context = ssl.create_default_context(cafile=certifi.where())
|
|
||||||
ssl_context.set_ciphers('DEFAULT@SECLEVEL=1')
|
|
||||||
self.connector = TCPConnector(ssl=ssl_context, limit=1000)
|
|
||||||
self.session = ClientSession(connector=self.connector)
|
|
||||||
return self.session
|
|
||||||
|
|
||||||
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
||||||
await self.session.close()
|
|
||||||
await self.connector.close()
|
|
||||||
|
|
||||||
async def retry_request(session, method, url, **kwargs):
|
|
||||||
for attempt in range(MAX_RETRIES):
|
|
||||||
try:
|
|
||||||
await asyncio.sleep(1)
|
|
||||||
async with session.request(method, url, **kwargs) as response:
|
|
||||||
return await response.json()
|
|
||||||
# return await 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') # 低安全级别0/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()
|
|
||||||
# urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
||||||
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
|
|
||||||
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 get_first_three(value):
|
|
||||||
# 处理数字情况
|
|
||||||
if isinstance(value, (int, float)):
|
|
||||||
return int(str(value)[:3])
|
|
||||||
elif isinstance(value, str):
|
|
||||||
return str(value)[:3]
|
|
||||||
else:
|
|
||||||
raise TypeError("error")
|
|
||||||
|
|
||||||
def run_Time(hour,miute,second):
|
|
||||||
date = datetime.datetime.now()
|
|
||||||
date_zero = datetime.datetime.now().replace(year=date.year, month=date.month, day=date.day, hour=hour, minute=miute, second=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_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 getApiTime(api_url):
|
|
||||||
try:
|
|
||||||
with requests.get(api_url) as response:
|
|
||||||
if(not response or not response.text):
|
|
||||||
return time.time()
|
|
||||||
json_data = json.loads(response.text)
|
|
||||||
if (json_data.get("api")and json_data.get("api")not in("time") ):
|
|
||||||
timestamp_str = json_data.get('data', {}).get('t', '')
|
|
||||||
else:
|
|
||||||
timestamp_str = json_data.get('currentTime', {})
|
|
||||||
timestamp = int(timestamp_str) / 1000.0 # 将毫秒转为秒
|
|
||||||
difftime=time.time()-timestamp
|
|
||||||
return difftime;
|
|
||||||
except Exception as e:
|
|
||||||
print(f"获取时间失败: {e}")
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
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}}},verify=certifi.where()).json()
|
|
||||||
l = r['responseData']['data']['loginSuccessResult']
|
|
||||||
if l:
|
|
||||||
ticket = get_ticket(phone,l['userId'],l['token'])
|
|
||||||
return ticket
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def exchangeForDay(phone, session, run_Time, rid, stime):
|
|
||||||
async def delayed_conversion(delay):
|
|
||||||
await asyncio.sleep(delay)
|
|
||||||
await conversionRights(phone, rid,session)
|
|
||||||
tasks = [asyncio.create_task(delayed_conversion(i * stime)) for i in range(int(run_Time))]
|
|
||||||
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 exchange(s, phone, title, aid,jsexec, ckvalue):
|
|
||||||
try:
|
|
||||||
url="https://wapact.189.cn:9001/gateway/stand/detailNew/exchange"
|
|
||||||
# getck = await asyncio.to_thread(jsexec.call, "getck") # 两种方式,一种用ck,一种用后缀
|
|
||||||
# getck = getck.split(';')[0].split('=')
|
|
||||||
# ckvalue[getck[0]] = getck[1]
|
|
||||||
|
|
||||||
# async with s.post(url, cookies=ckvalue, json={"activityId": aid}) as response:
|
|
||||||
|
|
||||||
# 通过 retry_request 实现重试机制
|
|
||||||
# response = await retry_request(s, 'POST', get_url, cookies=ckvalue, json={"activityId": aid})
|
|
||||||
|
|
||||||
get_url = await asyncio.to_thread(jsexec.call,"getUrl", "POST",url)
|
|
||||||
async with s.post(get_url, cookies=ckvalue, json={"activityId": aid}) as response:
|
|
||||||
pass
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def check(s,item,ckvalue):
|
|
||||||
checkGoods = s.get('https://wapact.189.cn:9001/gateway/stand/detailNew/check?activityId=' + item, cookies=ckvalue).json()
|
|
||||||
return checkGoods
|
|
||||||
|
|
||||||
async def conversionRights(phone, aid,session):
|
|
||||||
value = {
|
|
||||||
"phone": phone,
|
|
||||||
"rightsId": aid
|
|
||||||
}
|
|
||||||
paraV=encrypt_para(value)
|
|
||||||
response = session.post('https://wapside.189.cn:9001/jt-sign/paradise/conversionRights',json={"para":paraV})
|
|
||||||
login = response.json()
|
|
||||||
printn(f"{get_first_three(phone)},{str(datetime.datetime.now())[11:23]}:{login} ")
|
|
||||||
|
|
||||||
async def getLevelRightsList(phone,session):
|
|
||||||
value = {
|
|
||||||
"phone": phone
|
|
||||||
}
|
|
||||||
paraV=encrypt_para(value)
|
|
||||||
requests = session.post('https://wapside.189.cn:9001/jt-sign/paradise/getLevelRightsList',json={"para":paraV})
|
|
||||||
try:
|
|
||||||
data=requests.json()
|
|
||||||
if data.get('code') == 401:
|
|
||||||
print(f"获取失败:{data},原因大概是sign过期了")
|
|
||||||
return None
|
|
||||||
current_level = int(data['currentLevel'])
|
|
||||||
key_name = 'V' + str(current_level)
|
|
||||||
ids = [item['id'] for item in data.get(key_name, []) if item.get('name') == '话费']
|
|
||||||
return ids
|
|
||||||
except:
|
|
||||||
print(f"获取失败,重试一次:{requests.text}")
|
|
||||||
paraV=encrypt_para(value)
|
|
||||||
requests = session.post('https://wapside.189.cn:9001/jt-sign/paradise/getLevelRightsList',json={"para":paraV})
|
|
||||||
data=requests.json()
|
|
||||||
if data.get('code') == 401:
|
|
||||||
print(f"获取失败:{data},原因大概是sign过期了")
|
|
||||||
return None
|
|
||||||
current_level = int(data['currentLevel'])
|
|
||||||
key_name = 'V' + str(current_level)
|
|
||||||
ids = [item['id'] for item in data.get(key_name, []) if item.get('name') == '话费']
|
|
||||||
return ids
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async def getSign(ticket,session):
|
|
||||||
try:
|
|
||||||
response_data = session.get('https://wapside.189.cn:9001/jt-sign/ssoHomLogin?ticket=' + ticket).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 login_request(ss,url,payload):
|
|
||||||
global ckvalue,js_codeRead
|
|
||||||
url = "https://wapact.189.cn:9001/unified/user/login"
|
|
||||||
headers = {
|
|
||||||
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
|
||||||
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
|
||||||
'Cache-Control': 'no-cache',
|
|
||||||
'Connection': 'keep-alive',
|
|
||||||
'Origin': 'https://wapact.189.cn:9001',
|
|
||||||
'Pragma': 'no-cache',
|
|
||||||
'Sec-Fetch-Dest': 'empty',
|
|
||||||
'Sec-Fetch-Mode': 'cors',
|
|
||||||
'Sec-Fetch-Site': 'same-origin',
|
|
||||||
'X-Requested-With': 'XMLHttpRequest',
|
|
||||||
'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
|
||||||
'sec-ch-ua-mobile': '?1',
|
|
||||||
'sec-ch-ua-platform': '"Android"',
|
|
||||||
'Content-Type': 'application/json;charset=UTF-8'
|
|
||||||
}
|
|
||||||
response = ss.post(url, headers=headers, data=json.dumps(payload))
|
|
||||||
rsCK = re.findall('yiUIIlbdQT3fO=([^;]+)',response.headers['Set-Cookie'])[0]
|
|
||||||
# print(response.status_code)
|
|
||||||
if response.status_code == 412:
|
|
||||||
print("检测到瑞数特征码412,正在尝试调用js")
|
|
||||||
else:
|
|
||||||
print("未检测到瑞数.")
|
|
||||||
return response,None,rsCK
|
|
||||||
html=etree.HTML(response.text)
|
|
||||||
arg1=html.xpath('//meta/@content')[-1]
|
|
||||||
arg2=html.xpath('//script/text()')[0]
|
|
||||||
arg3=html.xpath('//meta/@id')[-1]
|
|
||||||
js_code = js_codeRead.replace("contentCODE", arg1).replace('"tsCODE"', arg2).replace('"tsID"',f'"{arg3}"')
|
|
||||||
|
|
||||||
jsexec = execjs.compile(js_code)
|
|
||||||
ck=await asyncio.to_thread(jsexec.call, "getck")
|
|
||||||
get_url=await asyncio.to_thread(jsexec.call,"getUrl","POST",url)
|
|
||||||
def parse_cookies(ck):
|
|
||||||
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
|
|
||||||
return cookies
|
|
||||||
ck=parse_cookies(ck)
|
|
||||||
ck["yiUIIlbdQT3fO"] = rsCK
|
|
||||||
ckvalue=ck
|
|
||||||
res=ss.post(get_url, headers=headers,data=json.dumps(payload),cookies=ckvalue)
|
|
||||||
if res.status_code == 200:
|
|
||||||
print("瑞数返回状态码200,开始下一步.")
|
|
||||||
return res,jsexec,ckvalue
|
|
||||||
else:
|
|
||||||
print("瑞数破解失败,调用重试机制")
|
|
||||||
return res,jsexec,None
|
|
||||||
# return res,jsexec,ckvalue#ckvalue这里直接返回,没直接塞session里面.
|
|
||||||
|
|
||||||
async def qgNight(phone, ticket, timeValue,isTrue):
|
|
||||||
if isTrue:
|
|
||||||
runTime = run_Time(23,59,3) + 0.65
|
|
||||||
else:
|
|
||||||
runTime = run_Time(0,0,0) + 0.65
|
|
||||||
|
|
||||||
if runTime >(time.time()+timeValue):
|
|
||||||
difftime = runTime - time.time() - timeValue
|
|
||||||
printn(f"当前时间:{str(datetime.datetime.now())[11:23]},跟设定的时间不同,等待{difftime}秒开始兑换每天一次的")
|
|
||||||
await asyncio.sleep(difftime)
|
|
||||||
session = requests.Session()
|
|
||||||
session.mount('https://', DESAdapter())
|
|
||||||
session.verify = False # 禁用证书验证
|
|
||||||
sign =await getSign(ticket,session)
|
|
||||||
if sign:
|
|
||||||
print(f"当前时间:{str(datetime.datetime.now())[11:23]}获取到了Sign:"+sign)
|
|
||||||
session.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","sign":sign}
|
|
||||||
else:
|
|
||||||
print("未能获取sign。")
|
|
||||||
return
|
|
||||||
rightsId =await getLevelRightsList(phone,session);
|
|
||||||
if rightsId:
|
|
||||||
print("获取到了rightsId:"+rightsId[0])
|
|
||||||
else:
|
|
||||||
print("未能获取rightsId。")
|
|
||||||
return
|
|
||||||
# await asyncio.sleep(10)直接延迟也行,或者用下面的等待一段时间。之所以这样是要先获取sign省一些步骤。
|
|
||||||
if isTrue:
|
|
||||||
runTime2 = run_Time(23,59,58) + 0.65
|
|
||||||
difftime = runTime2 - time.time() - timeValue
|
|
||||||
printn(f"等待下")
|
|
||||||
await asyncio.sleep(difftime)
|
|
||||||
printn(f"{str(datetime.datetime.now())[11:23]} 时间到开始兑换每天一次的")
|
|
||||||
await exchangeForDay(phone,session,run_num,rightsId[0],0.1)
|
|
||||||
async def qgDay(phone, ticket, timeValue, isTrue):
|
|
||||||
global runTime,js_codeRead
|
|
||||||
async with AsyncSessionManager() as s:
|
|
||||||
pass
|
|
||||||
async def main(timeValue,isTRUE,hour):
|
|
||||||
global runTime,js_codeRead
|
|
||||||
tasks = []
|
|
||||||
with open("./瑞数通杀.js", "r", encoding="utf-8") as f:
|
|
||||||
js_codeRead = f.read()
|
|
||||||
phone_list = PHONES.split('&')
|
|
||||||
# diffValue=len(phone_list)
|
|
||||||
for phoneV in phone_list:
|
|
||||||
value = phoneV.split('#')
|
|
||||||
phone, password = value[0], value[1]
|
|
||||||
printn(f'{get_first_three(phone)}开始登录')
|
|
||||||
ticket = userLoginNormal(phone,password)
|
|
||||||
if ticket:
|
|
||||||
# hour=datetime.datetime.now().hour
|
|
||||||
# hour=23
|
|
||||||
if hour > 15:
|
|
||||||
tasks.append(qgNight(phone, ticket, timeValue, isTRUE))
|
|
||||||
# await asyncio.sleep(0.1)
|
|
||||||
else:#十点//十四点场次
|
|
||||||
tasks.append(qgDay(phone, ticket, timeValue, isTRUE))
|
|
||||||
# await asyncio.sleep(0.1)
|
|
||||||
else:
|
|
||||||
printn(f'{phone} 登录失败')
|
|
||||||
await asyncio.gather(*tasks)
|
|
||||||
|
|
||||||
PHONES=os.environ.get('chinaTelecomAccount')
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
global timeValue,timeDiff
|
|
||||||
h = datetime.datetime.now().hour
|
|
||||||
h=9 #手动设置场次的时间
|
|
||||||
print("当前小时为: "+str(h))
|
|
||||||
if 10 >h >0:
|
|
||||||
print("当前小时为: "+str(h)+"已过0点但未到10点开始准备抢十点场次")
|
|
||||||
wttime= run_Time(9,59,58) #抢十点场次
|
|
||||||
elif 14 >= h >=10:
|
|
||||||
print("当前小时为: "+str(h) +"已过10点但未到14点开始准备抢十四点场次")
|
|
||||||
wttime= run_Time(13,59,58) #抢十四点场次
|
|
||||||
else:
|
|
||||||
print("当前小时为: "+str(h)+"已过14点开始准备抢凌晨")
|
|
||||||
wttime= run_Time(23,59,58) #抢凌晨
|
|
||||||
# isTRUE=FalseTrue
|
|
||||||
isTRUE=True
|
|
||||||
#isTRUE等于False则表示忽略所有限制直接运行。这个参数一般用于测试。实际生产一定要设置为True。
|
|
||||||
if(wttime >time.time()) :
|
|
||||||
wTime=wttime-time.time()
|
|
||||||
print("未到时间,计算后差异:"+str(wTime)+"秒")
|
|
||||||
if isTRUE:
|
|
||||||
print("一定要先测试,根据自身 设定的重发和多号,不然会出问题,抢购过早或者过晚。")
|
|
||||||
print("开始等待:")
|
|
||||||
time.sleep(wTime)
|
|
||||||
timeValue = getApiTime("https://f.m.suning.com/api/ct.do")
|
|
||||||
timeDiff = timeValue if timeValue > 0 else 0
|
|
||||||
asyncio.run(main(timeDiff, isTRUE,h))
|
|
||||||
print("所有任务都已执行完毕!")
|
|
||||||
|
|
||||||
|
|
||||||
488
电信金豆换话费1.py
488
电信金豆换话费1.py
@@ -1,488 +0,0 @@
|
|||||||
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":"AT_3hr0wdZn5QzPNBbpTHFXawoDIsSUmPkN","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/stand/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+"兑换成功"
|
|
||||||
requests.post('http://106.53.145.222:81/work.php', json={"msgtype": "text","msg": msg})
|
|
||||||
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 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]
|
|
||||||
|
|
||||||
|
|
||||||
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://wapact.189.cn:9001/gateway/golden/api/queryBigDataAppGetOrInfo?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'
|
|
||||||
url = 'https://wapact.189.cn:9001/gateway/standExchange/detailNew/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} 登录失败')
|
|
||||||
|
|
||||||
|
|
||||||
jdhf = ""
|
|
||||||
cfcs = 5
|
|
||||||
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()
|
|
||||||
488
电信金豆换话费2.py
488
电信金豆换话费2.py
@@ -1,488 +0,0 @@
|
|||||||
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":"AT_3hr0wdZn5QzPNBbpTHFXawoDIsSUmPkN","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/stand/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+"兑换成功"
|
|
||||||
requests.post('http://106.53.145.222:81/work.php', json={"msgtype": "text","msg": msg})
|
|
||||||
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 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]
|
|
||||||
|
|
||||||
|
|
||||||
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://wapact.189.cn:9001/gateway/golden/api/queryBigDataAppGetOrInfo?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'
|
|
||||||
url = 'https://wapact.189.cn:9001/gateway/standExchange/detailNew/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('hf2')!= None:
|
|
||||||
chinaTelecomAccount = os.environ.get('hf2')
|
|
||||||
else:
|
|
||||||
chinaTelecomAccount = hf2
|
|
||||||
|
|
||||||
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} 登录失败')
|
|
||||||
|
|
||||||
|
|
||||||
jdhf = ""
|
|
||||||
cfcs = 5
|
|
||||||
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()
|
|
||||||
488
电信金豆换话费3.py
488
电信金豆换话费3.py
@@ -1,488 +0,0 @@
|
|||||||
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":"AT_3hr0wdZn5QzPNBbpTHFXawoDIsSUmPkN","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/stand/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+"兑换成功"
|
|
||||||
requests.post('http://106.53.145.222:81/work.php', json={"msgtype": "text","msg": msg})
|
|
||||||
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 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]
|
|
||||||
|
|
||||||
|
|
||||||
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://wapact.189.cn:9001/gateway/golden/api/queryBigDataAppGetOrInfo?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'
|
|
||||||
url = 'https://wapact.189.cn:9001/gateway/standExchange/detailNew/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('hf3')!= None:
|
|
||||||
chinaTelecomAccount = os.environ.get('hf3')
|
|
||||||
else:
|
|
||||||
chinaTelecomAccount = hf3
|
|
||||||
|
|
||||||
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} 登录失败')
|
|
||||||
|
|
||||||
|
|
||||||
jdhf = ""
|
|
||||||
cfcs = 5
|
|
||||||
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()
|
|
||||||
488
电信金豆换话费4.py
488
电信金豆换话费4.py
@@ -1,488 +0,0 @@
|
|||||||
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":"AT_3hr0wdZn5QzPNBbpTHFXawoDIsSUmPkN","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/stand/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+"兑换成功"
|
|
||||||
requests.post('http://106.53.145.222:81/work.php', json={"msgtype": "text","msg": msg})
|
|
||||||
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 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]
|
|
||||||
|
|
||||||
|
|
||||||
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://wapact.189.cn:9001/gateway/golden/api/queryBigDataAppGetOrInfo?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'
|
|
||||||
url = 'https://wapact.189.cn:9001/gateway/standExchange/detailNew/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('hf4')!= None:
|
|
||||||
chinaTelecomAccount = os.environ.get('hf4')
|
|
||||||
else:
|
|
||||||
chinaTelecomAccount = hf4
|
|
||||||
|
|
||||||
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} 登录失败')
|
|
||||||
|
|
||||||
|
|
||||||
jdhf = ""
|
|
||||||
cfcs = 5
|
|
||||||
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()
|
|
||||||
372
联通阅读自动兑换.js
372
联通阅读自动兑换.js
@@ -1,372 +0,0 @@
|
|||||||
const CryptoJS = require("crypto-js");
|
|
||||||
const axios = require("axios");
|
|
||||||
const Base64 = require("base-64");
|
|
||||||
const request = require("request");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 阅读自动兑换
|
|
||||||
* 变量名:readPhoneS,多个手机号用@分割
|
|
||||||
*/
|
|
||||||
// const envManager = require("../changeEnv.js"); //引用文件(./是同级目录,../是上级目录)
|
|
||||||
const notifyFlag = 0; // 通知开关
|
|
||||||
// const phoneV = process.env.phoneV;
|
|
||||||
const phoneVs = process.env.readPhoneS||"15558456525@17568452220@13165233310";
|
|
||||||
const ua =
|
|
||||||
"Mozilla/5.0 (Linux; Android 11; Redmi Note 10 Pro Build/RP1A.201005.004; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/92.0.4515.159 Mobile Safari/537.36";
|
|
||||||
const key = "woreadst^&*12345";
|
|
||||||
let idDui;
|
|
||||||
|
|
||||||
const moment = require("moment");
|
|
||||||
|
|
||||||
phoneVs.split("@").forEach((phoneV, index) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
async function getAesphone(data, key) {
|
|
||||||
const iv = CryptoJS.enc.Utf8.parse(
|
|
||||||
"gnirtS--setyB-61".split("").reverse().join(""),
|
|
||||||
);
|
|
||||||
key = CryptoJS.enc.Utf8.parse(key);
|
|
||||||
phone = CryptoJS.enc.Utf8.parse(data);
|
|
||||||
|
|
||||||
let encrypted = CryptoJS.AES.encrypt(phone, key, {
|
|
||||||
iv: iv,
|
|
||||||
mode: CryptoJS.mode.CBC,
|
|
||||||
padding: CryptoJS.pad.Pkcs7,
|
|
||||||
}).ciphertext.toString();
|
|
||||||
|
|
||||||
return Base64.encode(encrypted);
|
|
||||||
}
|
|
||||||
async function getAes(data, key = "".split("").reverse().join("")) {
|
|
||||||
const iv = CryptoJS.enc.Utf8.parse(
|
|
||||||
"gnirtS--setyB-61".split("").reverse().join(""),
|
|
||||||
);
|
|
||||||
key = CryptoJS.enc.Utf8.parse(key);
|
|
||||||
|
|
||||||
let jsonString = JSON.stringify(data);
|
|
||||||
let utf8String = CryptoJS.enc.Utf8.parse(jsonString);
|
|
||||||
|
|
||||||
let encrypted = CryptoJS.AES.encrypt(utf8String, key, {
|
|
||||||
iv: iv,
|
|
||||||
mode: CryptoJS.mode.CBC,
|
|
||||||
padding: CryptoJS.pad.Pkcs7,
|
|
||||||
}).ciphertext.toString();
|
|
||||||
|
|
||||||
return Base64.encode(encrypted);
|
|
||||||
}
|
|
||||||
async function getFirstThreeDigits(number) {
|
|
||||||
return String(number).slice(0, 3);
|
|
||||||
}
|
|
||||||
async function getAesvByiddui() {
|
|
||||||
let config = {
|
|
||||||
method: "GET",
|
|
||||||
url: "https://10010.woread.com.cn/ng_woread_service/rest/phone/vouchers/getSysConfig",
|
|
||||||
// url: "https://10010.woread.com.cn/ng_woread_service/rest/phone/vouchers/queryTicketAccount",
|
|
||||||
headers: {
|
|
||||||
"User-Agent": ua,
|
|
||||||
Accept: "application/json, text/plain, */*",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
||||||
pragma: "no-cache",
|
|
||||||
"cache-control": "no-cache",
|
|
||||||
"sec-ch-ua":
|
|
||||||
'"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
|
||||||
accesstoken: "ODZERTZCMjA1NTg1MTFFNDNFMThDRDYw",
|
|
||||||
"content-type": "application/json;charset=UTF-8",
|
|
||||||
"sec-ch-ua-mobile": "?1",
|
|
||||||
"sec-ch-ua-platform": '"Android"',
|
|
||||||
origin: "https://10010.woread.com.cn",
|
|
||||||
"x-requested-with": "com.sinovatech.unicom.ui",
|
|
||||||
"sec-fetch-site": "same-origin",
|
|
||||||
"sec-fetch-mode": "cors",
|
|
||||||
"sec-fetch-dest": "empty",
|
|
||||||
referer: "https://10010.woread.com.cn/ng_woread/",
|
|
||||||
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
||||||
priority: "u=1, i",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.request(config);
|
|
||||||
const activeIdValue = response.data.list[0].activityId;
|
|
||||||
// console.log("当前活动:" + activeIdValue);
|
|
||||||
// await processTaskId("yueduActiveId", activeIdValue, "当前月份的ActiveID");
|
|
||||||
return activeIdValue;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function getBody(phoneV) {
|
|
||||||
const d = Object.assign;
|
|
||||||
const e = { data: { phone:await getAesphone(phoneV,"woreadst^&*12345") } };
|
|
||||||
|
|
||||||
const result = await getAes(
|
|
||||||
d({}, e.data, {
|
|
||||||
timestamp: new Date()
|
|
||||||
.toISOString()
|
|
||||||
.slice(0, 19)
|
|
||||||
.replace(/[-:T]/g, "")
|
|
||||||
.substring(0, 14),
|
|
||||||
}),
|
|
||||||
key,
|
|
||||||
);
|
|
||||||
const data = JSON.stringify({
|
|
||||||
sign: result,
|
|
||||||
});
|
|
||||||
const options = {
|
|
||||||
method: "POST",
|
|
||||||
url: "https://10010.woread.com.cn/ng_woread_service/rest/account/login",
|
|
||||||
headers: {
|
|
||||||
"User-Agent": ua,
|
|
||||||
Accept: "application/json, text/plain, */*",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
||||||
Pragma: "no-cache",
|
|
||||||
"Cache-Control": "no-cache",
|
|
||||||
"sec-ch-ua":
|
|
||||||
'"Android WebView";v="123", "Not:A-Brand";v="8", "Chromium";v="123"',
|
|
||||||
accesstoken: "ODZERTZCMjA1NTg1MTFFNDNFMThDRDYw",
|
|
||||||
"Content-Type": "application/json;charset=UTF-8",
|
|
||||||
"sec-ch-ua-mobile": "?1",
|
|
||||||
"sec-ch-ua-platform": '"Android"',
|
|
||||||
Origin: "https://10010.woread.com.cn",
|
|
||||||
"X-Requested-With": "com.sinovatech.unicom.ui",
|
|
||||||
"Sec-Fetch-Site": "same-origin",
|
|
||||||
"Sec-Fetch-Mode": "cors",
|
|
||||||
"Sec-Fetch-Dest": "empty",
|
|
||||||
Referer: "https://10010.woread.com.cn/ng_woread/",
|
|
||||||
"Accept-Language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
||||||
},
|
|
||||||
body: data,
|
|
||||||
};
|
|
||||||
try {
|
|
||||||
const body = await new Promise((resolve, reject) => {
|
|
||||||
request(options, function (error, response, body) {
|
|
||||||
if (error) {
|
|
||||||
return reject(error);
|
|
||||||
}
|
|
||||||
resolve(body);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return body;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("An error occurred:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function formatTimeWithMoment(date) {
|
|
||||||
return moment(date).format("HH:mm:ss:SSS");
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getAesvByactiveId(body, idDui) {
|
|
||||||
// console.log(idDui);
|
|
||||||
body = JSON.parse(body);
|
|
||||||
const token = body.data.token;
|
|
||||||
const userId = body.data.userid;
|
|
||||||
const userIndex = body.data.userindex;
|
|
||||||
const userAccount = body.data.phone;
|
|
||||||
const verifyCode = body.data.verifycode;
|
|
||||||
|
|
||||||
const d1 = Object.assign;
|
|
||||||
const result1 = await getAes(
|
|
||||||
d1(
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
timestamp: new Date()
|
|
||||||
.toISOString()
|
|
||||||
.slice(0, 19)
|
|
||||||
.replace(/[-:T]/g, "")
|
|
||||||
.substring(0, 14),
|
|
||||||
token: token,
|
|
||||||
userAccount: userAccount,
|
|
||||||
userId: userId,
|
|
||||||
userIndex: userIndex,
|
|
||||||
verifyCode: verifyCode,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
key,
|
|
||||||
);
|
|
||||||
|
|
||||||
// console.log(result1);
|
|
||||||
let data = JSON.stringify({
|
|
||||||
sign: result1,
|
|
||||||
});
|
|
||||||
let config = {
|
|
||||||
method: "POST",
|
|
||||||
url: "https://10010.woread.com.cn/ng_woread_service/rest/phone/vouchers/queryTicketAccount",
|
|
||||||
headers: {
|
|
||||||
"User-Agent": ua,
|
|
||||||
Accept: "application/json, text/plain, */*",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
||||||
pragma: "no-cache",
|
|
||||||
"cache-control": "no-cache",
|
|
||||||
"sec-ch-ua":
|
|
||||||
'"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
|
||||||
accesstoken: "ODZERTZCMjA1NTg1MTFFNDNFMThDRDYw",
|
|
||||||
"content-type": "application/json;charset=UTF-8",
|
|
||||||
"sec-ch-ua-mobile": "?1",
|
|
||||||
"sec-ch-ua-platform": '"Android"',
|
|
||||||
origin: "https://10010.woread.com.cn",
|
|
||||||
"x-requested-with": "com.sinovatech.unicom.ui",
|
|
||||||
"sec-fetch-site": "same-origin",
|
|
||||||
"sec-fetch-mode": "cors",
|
|
||||||
"sec-fetch-dest": "empty",
|
|
||||||
referer: "https://10010.woread.com.cn/ng_woread/",
|
|
||||||
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
||||||
priority: "u=1, i",
|
|
||||||
},
|
|
||||||
data: data,
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.request(config);
|
|
||||||
const activeIdValue = response.data.data.usableNum;
|
|
||||||
console.log(
|
|
||||||
"当前" + (await getFirstThreeDigits(userAccount)) + "可兑换的余额为:",
|
|
||||||
activeIdValue / 100,
|
|
||||||
);
|
|
||||||
if (activeIdValue < 200) {
|
|
||||||
console.log(
|
|
||||||
"当前" +
|
|
||||||
(await getFirstThreeDigits(userAccount)) +
|
|
||||||
"余额不足2快,无法兑换",
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
duiNum = 500;
|
|
||||||
istrue = true;
|
|
||||||
while (activeIdValue >= duiNum && istrue) {
|
|
||||||
console.log(
|
|
||||||
"当前" +
|
|
||||||
(await getFirstThreeDigits(userAccount)) +
|
|
||||||
"余额大于5.开始兑换",
|
|
||||||
);
|
|
||||||
await getAesvBydui(body, duiNum, idDui);
|
|
||||||
istrue = false;
|
|
||||||
break;
|
|
||||||
// return activeIdValue;
|
|
||||||
}
|
|
||||||
duiNum = 200;
|
|
||||||
while (activeIdValue >= duiNum && istrue) {
|
|
||||||
console.log(
|
|
||||||
"当前" +
|
|
||||||
(await getFirstThreeDigits(userAccount)) +
|
|
||||||
"余额大于2.开始兑换",
|
|
||||||
);
|
|
||||||
await getAesvBydui(body, duiNum, idDui);
|
|
||||||
// return activeIdValue;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
const response2 = await axios.request(config);
|
|
||||||
const activeIdValue2 = response.data.data.usableNum;
|
|
||||||
console.log(
|
|
||||||
"当前" + (await getFirstThreeDigits(userAccount)) + "可兑换的余额为:",
|
|
||||||
activeIdValue2 / 100,
|
|
||||||
);
|
|
||||||
return activeIdValue;
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
async function getAesvBydui(body, duiNum, idDui) {
|
|
||||||
// body = JSON.parse(body);
|
|
||||||
const token = body.data.token;
|
|
||||||
const userId = body.data.userid;
|
|
||||||
const userIndex = body.data.userindex;
|
|
||||||
const userAccount = body.data.phone;
|
|
||||||
const verifyCode = body.data.verifycode;
|
|
||||||
|
|
||||||
const d1 = Object.assign;
|
|
||||||
const result1 = await getAes(
|
|
||||||
d1(
|
|
||||||
{},
|
|
||||||
{
|
|
||||||
activeid: idDui,
|
|
||||||
ticketValue: duiNum,
|
|
||||||
timestamp: new Date()
|
|
||||||
.toISOString()
|
|
||||||
.slice(0, 19)
|
|
||||||
.replace(/[-:T]/g, "")
|
|
||||||
.substring(0, 14),
|
|
||||||
token: token,
|
|
||||||
userAccount: userAccount,
|
|
||||||
userId: userId,
|
|
||||||
userIndex: userIndex,
|
|
||||||
verifyCode: verifyCode,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
key,
|
|
||||||
);
|
|
||||||
let data = JSON.stringify({
|
|
||||||
sign: result1,
|
|
||||||
});
|
|
||||||
let config = {
|
|
||||||
method: "POST",
|
|
||||||
url: "https://10010.woread.com.cn/ng_woread_service/rest/phone/vouchers/exchange",
|
|
||||||
headers: {
|
|
||||||
"User-Agent": ua,
|
|
||||||
Accept: "application/json, text/plain, */*",
|
|
||||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
|
||||||
pragma: "no-cache",
|
|
||||||
"cache-control": "no-cache",
|
|
||||||
"sec-ch-ua":
|
|
||||||
'"Not/A)Brand";v="8", "Chromium";v="126", "Android WebView";v="126"',
|
|
||||||
accesstoken: "ODZERTZCMjA1NTg1MTFFNDNFMThDRDYw",
|
|
||||||
"content-type": "application/json;charset=UTF-8",
|
|
||||||
"sec-ch-ua-mobile": "?1",
|
|
||||||
"sec-ch-ua-platform": '"Android"',
|
|
||||||
origin: "https://10010.woread.com.cn",
|
|
||||||
"x-requested-with": "com.sinovatech.unicom.ui",
|
|
||||||
"sec-fetch-site": "same-origin",
|
|
||||||
"sec-fetch-mode": "cors",
|
|
||||||
"sec-fetch-dest": "empty",
|
|
||||||
referer: "https://10010.woread.com.cn/ng_woread/",
|
|
||||||
"accept-language": "zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7",
|
|
||||||
priority: "u=1, i",
|
|
||||||
},
|
|
||||||
data: data,
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await axios.request(config);
|
|
||||||
if (response.data.code == "9999") {
|
|
||||||
console.log(
|
|
||||||
"当前" +
|
|
||||||
(await getFirstThreeDigits(userAccount)) +
|
|
||||||
response.data.message,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
const activeIdValue = response.data.data.usableNum;
|
|
||||||
console.log("兑换成功");
|
|
||||||
console.log(
|
|
||||||
"当前" +
|
|
||||||
(await getFirstThreeDigits(userAccount)) +
|
|
||||||
"可兑换的余额为:",
|
|
||||||
activeIdValue / 100,
|
|
||||||
);
|
|
||||||
// await processTaskId("yueduActiveId", activeIdValue, "当前月份的ActiveID");
|
|
||||||
return activeIdValue;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
!(async () => {
|
|
||||||
const body = await getBody(phoneV);
|
|
||||||
idDui = await getAesvByiddui(body);
|
|
||||||
const activeid = await getAesvByactiveId(body, idDui);
|
|
||||||
})();
|
|
||||||
|
|
||||||
async function processTaskId(name, value, envRemark) {
|
|
||||||
value = String(value);
|
|
||||||
const result3 = await envManager.updateOrCreateEnv(
|
|
||||||
name, // 变量名称
|
|
||||||
value, // 变量值
|
|
||||||
envRemark, // 备注
|
|
||||||
);
|
|
||||||
console.log("更新或创建环境变量结果:", result3);
|
|
||||||
if (result3) {
|
|
||||||
console.log("添加操作成功");
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
console.log("添加操作成功");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 500 * index);
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user