Add Turnstile Solver and config files
- TurnstileSolver.bat: 启动脚本 - api_solver.py: Turnstile 验证码解决器 - browser_configs.py: 浏览器配置 - db_results.py: 结果存储
This commit is contained in:
8
.gitignore
vendored
8
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
# 环境配置
|
||||
# 环境配置(包含私人信息)
|
||||
.env
|
||||
|
||||
# Python
|
||||
@@ -18,9 +18,3 @@ keys/
|
||||
.ace-tool/
|
||||
.claude/
|
||||
.playwright-mcp/
|
||||
|
||||
# 本地测试文件
|
||||
*.bat
|
||||
api_solver.py
|
||||
browser_configs.py
|
||||
db_results.py
|
||||
|
||||
1
TurnstileSolver.bat
Normal file
1
TurnstileSolver.bat
Normal file
@@ -0,0 +1 @@
|
||||
python api_solver.py --browser_type camoufox --thread 5 --debug
|
||||
1027
api_solver.py
Normal file
1027
api_solver.py
Normal file
File diff suppressed because it is too large
Load Diff
17
browser_configs.py
Normal file
17
browser_configs.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import random
|
||||
|
||||
class browser_config:
|
||||
@staticmethod
|
||||
def get_random_browser_config(browser_type):
|
||||
# 返回: 浏览器名, 版本, User-Agent, Sec-CH-UA
|
||||
versions = ["120.0.0.0", "121.0.0.0", "122.0.0.0", "124.0.0.0"]
|
||||
ver = random.choice(versions)
|
||||
ua = f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{ver} Safari/537.36"
|
||||
sec_ch_ua = f'"Not(A:Brand";v="99", "Google Chrome";v="{ver.split(".")[0]}", "Chromium";v="{ver.split(".")[0]}"'
|
||||
return "chrome", ver, ua, sec_ch_ua
|
||||
|
||||
@staticmethod
|
||||
def get_browser_config(name, version):
|
||||
ua = f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/{version} Safari/537.36"
|
||||
sec_ch_ua = f'"Google Chrome";v="{version}", "Chromium";v="{version}"'
|
||||
return ua, sec_ch_ua
|
||||
27
db_results.py
Normal file
27
db_results.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import time
|
||||
import asyncio
|
||||
|
||||
# 内存数据库,用于临时存储验证码结果
|
||||
results_db = {}
|
||||
|
||||
async def init_db():
|
||||
print("[系统] 结果数据库初始化成功 (内存模式)")
|
||||
|
||||
async def save_result(task_id, task_type, data):
|
||||
# 存储结果,如果 data 是字典则存入,否则构造字典
|
||||
results_db[task_id] = data
|
||||
print(f"[系统] 任务 {task_id} 状态更新: {data.get('value', '正在处理')}")
|
||||
|
||||
async def load_result(task_id):
|
||||
return results_db.get(task_id)
|
||||
|
||||
async def cleanup_old_results(days_old=7):
|
||||
# 简单的清理逻辑
|
||||
now = time.time()
|
||||
to_delete = []
|
||||
for tid, res in results_db.items():
|
||||
if isinstance(res, dict) and now - res.get('createTime', now) > days_old * 86400:
|
||||
to_delete.append(tid)
|
||||
for tid in to_delete:
|
||||
del results_db[tid]
|
||||
return len(to_delete)
|
||||
Reference in New Issue
Block a user