-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathjhdfw_qd.py
More file actions
90 lines (79 loc) · 3.7 KB
/
jhdfw_qd.py
File metadata and controls
90 lines (79 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# -------------------------------
# @Author : Code.K
# cron "5 9 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('建行大富翁进阶打卡CC豆')
# 活动信息: 建行大富翁进阶打卡 得CC豆 功能:每日自动签到 领豆
# 活动地址:https://lsjr.ccb.com/msmp/ecpweb/page/ty/dailysign/index.html
# 微信打开 抓 lsjr.ccb.com 该域名 headers 里的 token值 ey*****************
# 环境变量:jhdfwtoken 填抓到的 ey*****************
import random
import os
import sys
import platform
import subprocess
import time
from functools import partial
import concurrent.futures
token = os.environ.get("jhdfwtoken")
if token is None:
print(f'⛔️未获取到ck:请检查变量是否填写 变量名:jhdfwtoken')
exit(0)
if '@' in token:
tokens = token.split('@')
else:
tokens = [token]
print(f'✅获取到{len(tokens)}个账号')
file_url = 'https://mirror.ghproxy.com/https://raw.githubusercontent.com/Code-KKK/pycode/main/compiled/'
def check_environment(file_name):
v, o, a = sys.version_info, platform.system(), platform.machine()
print(f"Python版本: {v.major}.{v.minor}.{v.micro}, 操作系统类型: {o}, 处理器架构: {a}")
if (v.minor in [8,9,10,11]) and o.lower() in ['linux'] and a.lower() in ['x86_64','aarch64']:
print("当前环境符合运行要求")
if o.lower() == 'linux':
file_name += '.so'
main_run(file_name, v.minor, o.lower(), a.lower())
else:
if not (v.minor in [8,9,10,11]):
print("不符合运行要求: Python版本不是 3.8 ~ 3.11")
if not (o.lower() in ['linux']):
print(f"不符合运行要求: 操作系统类型[{o}] 支持:Linux")
if not (a.lower() in ['x86_64']):
print(f"不符合运行要求: 当前处理器架构[{a}] 仅支持:x86_64,aarch64")
def main_run(file_name, py_v, os_info, cpu_info):
if cpu_info == 'aarch64':
print('当前aarch64架构,如遇青龙容器运行报错,请先在青龙-依赖管理-Linux,添加gcc-aarch64-linux-gnu')
if os.path.exists(file_name):
file_name_ = os.path.splitext(file_name)[0]
Code_module = __import__(file_name_)
with concurrent.futures.ThreadPoolExecutor(max_workers=1) as executor:
for num in range(len(tokens)):
runzh = num + 1
run = Code_module.CCBDFW(tokens[num],runzh)
executor.submit(run.main)
time.sleep(random.randint(2, 3))
else:
print(f"不存在{file_name}功能模块,准备下载模块文件")
download_file(file_name, py_v, os_info, cpu_info,file_url)
def download_file(file_name, py_v, os_info, cpu_info, url):
file_name_ = os.path.splitext(file_name)[0]
if os_info == 'linux':
url = url + f'{file_name_}/{file_name_}.cp3{py_v}-{cpu_info}-{os_info}.so'
if os_info == 'windows':
url = url + f'{file_name_}/{file_name_}.cp3{py_v}-win_{cpu_info}.pyd'
try:
print(url)
result = subprocess.run(['curl', '-I', '-s', '-o', '/dev/null', '-w', '%{http_code}', url], capture_output=True, text=True)
if result.stdout.strip() == '404':
print('服务器文件不存在,已停止下载')
else:
print('服务器文件存在,将开始下载')
subprocess.run(["curl",'-#',"-o", file_name, url], check=True)
print(f"{file_name}文件下载成功~开始执行~")
check_environment(file_name_)
except subprocess.CalledProcessError:
print("下载失败,请检查 URL 或 网络问题。")
if __name__ == '__main__':
print = partial(print, flush=True)
check_environment("jhdfw")