|
@@ -1,285 +0,0 @@
|
|
|
-import base64
|
|
|
|
|
-import datetime
|
|
|
|
|
-import json
|
|
|
|
|
-import logging
|
|
|
|
|
-import os.path
|
|
|
|
|
-import time
|
|
|
|
|
-import requests
|
|
|
|
|
-import ddddocr
|
|
|
|
|
-
|
|
|
|
|
-# 配置日志
|
|
|
|
|
-logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
|
-
|
|
|
|
|
-# 配置文件路径
|
|
|
|
|
-CONFIG_FILE = "config.json"
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 初始化配置
|
|
|
|
|
-def init_config():
|
|
|
|
|
- if not os.path.exists(CONFIG_FILE):
|
|
|
|
|
- with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
|
|
|
- json.dump({}, f)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 读取配置
|
|
|
|
|
-def load_config():
|
|
|
|
|
- with open(CONFIG_FILE, "r", encoding="utf-8") as f:
|
|
|
|
|
- return json.load(f)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 保存配置
|
|
|
|
|
-def save_config(config):
|
|
|
|
|
- with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
|
|
|
- json.dump(config, f, indent=4)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取版本号
|
|
|
|
|
-def get_version(config):
|
|
|
|
|
- if "version" not in config:
|
|
|
|
|
- # 这里可以添加获取版本号的逻辑
|
|
|
|
|
- config["version"] = "1.1.3"
|
|
|
|
|
- save_config(config)
|
|
|
|
|
- return config["version"]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取App ID
|
|
|
|
|
-def get_app_id(config):
|
|
|
|
|
- if "appid" not in config:
|
|
|
|
|
- response = requests.get(
|
|
|
|
|
- f"https://www.aeropres.in/chromeapi/dawn/v1/appid/getappid?app_v={get_version(config)}",
|
|
|
|
|
- proxies=config.get("proxy"),
|
|
|
|
|
- headers={
|
|
|
|
|
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"},
|
|
|
|
|
- verify=False,
|
|
|
|
|
- timeout=15
|
|
|
|
|
- )
|
|
|
|
|
- if response.status_code != 200:
|
|
|
|
|
- raise Exception("获取appid失败")
|
|
|
|
|
- config["appid"] = response.json()["data"]["appid"]
|
|
|
|
|
- save_config(config)
|
|
|
|
|
- return config["appid"]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取Puzzle ID
|
|
|
|
|
-def get_puzzle_id(config):
|
|
|
|
|
- app_id = get_app_id(config)
|
|
|
|
|
- headers = {
|
|
|
|
|
- "Accept": "*/*",
|
|
|
|
|
- "Accept-Encoding": "gzip, deflate, br, zstd",
|
|
|
|
|
- "Accept-Language": "zh-CN,zh;q=0.9",
|
|
|
|
|
- "Origin": "chrome-extension://fpdkjdnhkakefebpekbdhillbhonfjjp",
|
|
|
|
|
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
|
|
|
|
|
- "priority": "u=1, i",
|
|
|
|
|
- "sec-ch-ua": '"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
|
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
|
- "sec-ch-ua-platform": '"Windows"',
|
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
|
- "sec-fetch-site": "cross-site",
|
|
|
|
|
- }
|
|
|
|
|
- response = requests.get(
|
|
|
|
|
- f"https://www.aeropres.in/chromeapi/dawn/v1/puzzle/get-puzzle?appid={app_id}",
|
|
|
|
|
- proxies=config.get("proxy"),
|
|
|
|
|
- headers=headers,
|
|
|
|
|
- verify=False,
|
|
|
|
|
- timeout=15
|
|
|
|
|
- )
|
|
|
|
|
- if response.status_code not in [200, 201]:
|
|
|
|
|
- raise Exception("获取puzzle_id失败")
|
|
|
|
|
- res_json = response.json()
|
|
|
|
|
- if not res_json.get('success', False):
|
|
|
|
|
- raise Exception("获取puzzle_id结果失败")
|
|
|
|
|
- return res_json["puzzle_id"]
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取Puzzle Code
|
|
|
|
|
-def get_puzzle_code(config):
|
|
|
|
|
- puzzle_id = get_puzzle_id(config)
|
|
|
|
|
- headers = {
|
|
|
|
|
- "Accept": "*/*",
|
|
|
|
|
- "Accept-Encoding": "gzip, deflate, br, zstd",
|
|
|
|
|
- "Accept-Language": "zh-CN,zh;q=0.9",
|
|
|
|
|
- "Origin": "chrome-extension://fpdkjdnhkakefebpekbdhillbhonfjjp",
|
|
|
|
|
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
|
|
|
|
|
- "priority": "u=1, i",
|
|
|
|
|
- "sec-ch-ua": '"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
|
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
|
- "sec-ch-ua-platform": '"Windows"',
|
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
|
- "sec-fetch-site": "cross-site",
|
|
|
|
|
- }
|
|
|
|
|
- response = requests.get(
|
|
|
|
|
- f"https://www.aeropres.in/chromeapi/dawn/v1/puzzle/get-puzzle-image?puzzle_id={puzzle_id}&appid={get_app_id(config)}",
|
|
|
|
|
- proxies=config.get("proxy"),
|
|
|
|
|
- headers=headers,
|
|
|
|
|
- verify=False,
|
|
|
|
|
- timeout=15
|
|
|
|
|
- )
|
|
|
|
|
- if response.status_code != 200:
|
|
|
|
|
- raise Exception("获取puzzle_url失败")
|
|
|
|
|
- res_json = response.json()
|
|
|
|
|
- if not res_json.get('success', False):
|
|
|
|
|
- raise Exception("获取puzzle_url结果失败")
|
|
|
|
|
- imgBase64 = res_json["imgBase64"]
|
|
|
|
|
- data = base64.b64decode(imgBase64)
|
|
|
|
|
- return get_code_with_img(puzzle_id, img_data=data)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取验证码
|
|
|
|
|
-def get_code_with_img(puzzle_id, img_data):
|
|
|
|
|
- print(puzzle_id)
|
|
|
|
|
- with open(f'{str(int(time.time()))}.jpg', 'wb') as file:
|
|
|
|
|
- file.write(img_data)
|
|
|
|
|
- return False
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取Token
|
|
|
|
|
-def get_token(config):
|
|
|
|
|
- if "token" not in config:
|
|
|
|
|
- retry_count = config.get('retry', 3)
|
|
|
|
|
- code = ""
|
|
|
|
|
- puzzle_id = ""
|
|
|
|
|
- while retry_count > 0:
|
|
|
|
|
- try:
|
|
|
|
|
- puzzle_id = get_puzzle_id(config)
|
|
|
|
|
- code = get_puzzle_code(config)
|
|
|
|
|
- break
|
|
|
|
|
- except Exception as e:
|
|
|
|
|
- logging.error(f"获取token失败,{e}")
|
|
|
|
|
- retry_count -= 1
|
|
|
|
|
- if not code or not puzzle_id:
|
|
|
|
|
- return False
|
|
|
|
|
- data = {
|
|
|
|
|
- "username": config.get("username", ""),
|
|
|
|
|
- "password": config.get("password", ""),
|
|
|
|
|
- "logindata": {"_v": {"version": get_version(config)},
|
|
|
|
|
- "datetime": datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")[:-3]},
|
|
|
|
|
- "puzzle_id": puzzle_id,
|
|
|
|
|
- "ans": code,
|
|
|
|
|
- "appid": get_app_id(config),
|
|
|
|
|
- }
|
|
|
|
|
- headers = {
|
|
|
|
|
- "Accept": "*/*",
|
|
|
|
|
- "Accept-Encoding": "gzip, deflate, br, zstd",
|
|
|
|
|
- "Accept-Language": "zh-CN,zh;q=0.9",
|
|
|
|
|
- "Origin": "chrome-extension://fpdkjdnhkakefebpekbdhillbhonfjjp",
|
|
|
|
|
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
|
|
|
|
|
- "priority": "u=1, i",
|
|
|
|
|
- "sec-ch-ua": '"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
|
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
|
- "sec-ch-ua-platform": '"Windows"',
|
|
|
|
|
- "sec-fetch-dest": "empty",
|
|
|
|
|
- "sec-fetch-mode": "cors",
|
|
|
|
|
- "sec-fetch-site": "cross-site",
|
|
|
|
|
- }
|
|
|
|
|
- retry_count = config.get('retry', 3)
|
|
|
|
|
- while retry_count > 0:
|
|
|
|
|
- try:
|
|
|
|
|
- response = requests.post(
|
|
|
|
|
- f"https://www.aeropres.in/chromeapi/dawn/v1/user/login/v2?appid={get_app_id(config)}",
|
|
|
|
|
- json=data,
|
|
|
|
|
- proxies=config.get("proxy"),
|
|
|
|
|
- verify=False,
|
|
|
|
|
- timeout=15,
|
|
|
|
|
- headers=headers
|
|
|
|
|
- )
|
|
|
|
|
- if response.status_code != 200:
|
|
|
|
|
- raise Exception("获取token失败")
|
|
|
|
|
- res_json = response.json()
|
|
|
|
|
- if not res_json.get('success', False):
|
|
|
|
|
- raise Exception("获取token结果失败")
|
|
|
|
|
- config["token"] = res_json["data"]["token"]
|
|
|
|
|
- save_config(config)
|
|
|
|
|
- break
|
|
|
|
|
- except Exception as e:
|
|
|
|
|
- logging.error(f"获取token失败,{e}")
|
|
|
|
|
- retry_count -= 1
|
|
|
|
|
- return config.get("token", "")
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 获取积分
|
|
|
|
|
-def get_point(config):
|
|
|
|
|
- headers = {
|
|
|
|
|
- "Authorization": f"Bearer {config.get('token', '')}",
|
|
|
|
|
- "Content-Type": "application/json",
|
|
|
|
|
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
|
|
|
|
|
- "sec-ch-ua": '"Not(A:Brand";v="99", "Google Chrome";v="133", "Chromium";v="133"',
|
|
|
|
|
- "sec-ch-ua-mobile": "?0",
|
|
|
|
|
- "sec-ch-ua-platform": '"Windows"',
|
|
|
|
|
- }
|
|
|
|
|
- response = requests.get(
|
|
|
|
|
- f"https://www.aeropres.in/api/atom/v1/userreferral/getpoint?appid={get_app_id(config)}",
|
|
|
|
|
- headers=headers,
|
|
|
|
|
- proxies=config.get("proxy"),
|
|
|
|
|
- verify=False,
|
|
|
|
|
- timeout=15
|
|
|
|
|
- )
|
|
|
|
|
- if response.status_code != 200:
|
|
|
|
|
- raise Exception(f"获取积分失败,{response.text}")
|
|
|
|
|
- if not response.json().get('success', False):
|
|
|
|
|
- raise Exception(f"获取积分失败,{response.json()}")
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 保持活跃
|
|
|
|
|
-def keep_alive(config):
|
|
|
|
|
- headers = {
|
|
|
|
|
- "Authorization": f"Bearer {config.get('token', '')}",
|
|
|
|
|
- "Content-Type": "application/json",
|
|
|
|
|
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
|
|
|
|
|
- }
|
|
|
|
|
- data = {
|
|
|
|
|
- "username": config.get("username", ""),
|
|
|
|
|
- "extensionid": "fpdkjdnhkakefebpekbdhillbhonfjjp",
|
|
|
|
|
- "numberoftabs": 0,
|
|
|
|
|
- "_v": get_version(config)
|
|
|
|
|
- }
|
|
|
|
|
- response = requests.post(
|
|
|
|
|
- f"https://www.aeropres.in/chromeapi/dawn/v1/userreward/keepalive?appid={get_app_id(config)}",
|
|
|
|
|
- json=data,
|
|
|
|
|
- headers=headers,
|
|
|
|
|
- proxies=config.get("proxy"),
|
|
|
|
|
- verify=False,
|
|
|
|
|
- timeout=15
|
|
|
|
|
- )
|
|
|
|
|
- if response.status_code != 200:
|
|
|
|
|
- raise Exception(f"保持活跃失败,{response.text}")
|
|
|
|
|
- if not response.json().get('success', False):
|
|
|
|
|
- raise Exception(f"保持活跃失败,{response.json()}")
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-# 主函数
|
|
|
|
|
-def main():
|
|
|
|
|
- init_config()
|
|
|
|
|
- config = load_config()
|
|
|
|
|
- while True:
|
|
|
|
|
- token = get_token(config)
|
|
|
|
|
- if not token:
|
|
|
|
|
- time.sleep(60)
|
|
|
|
|
- del config['token']
|
|
|
|
|
- save_config(config)
|
|
|
|
|
- continue
|
|
|
|
|
- retry_count = 5
|
|
|
|
|
- while retry_count > 0:
|
|
|
|
|
- err = False
|
|
|
|
|
- try:
|
|
|
|
|
- get_point(config)
|
|
|
|
|
- except Exception as e:
|
|
|
|
|
- logging.error(f"获取积分失败,{e}")
|
|
|
|
|
- err = True
|
|
|
|
|
- try:
|
|
|
|
|
- keep_alive(config)
|
|
|
|
|
- except Exception as e:
|
|
|
|
|
- logging.error(f"保持活跃失败,{e}")
|
|
|
|
|
- err = True
|
|
|
|
|
- if not err:
|
|
|
|
|
- retry_count = 5
|
|
|
|
|
- else:
|
|
|
|
|
- retry_count -= 1
|
|
|
|
|
- if retry_count <= 0:
|
|
|
|
|
- break
|
|
|
|
|
- time.sleep(5 * 60)
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-if __name__ == '__main__':
|
|
|
|
|
- main()
|
|
|