From da1ac298bd77d2efb2d6ae72a537c442367c4f0d Mon Sep 17 00:00:00 2001 From: Misty <43715693+yang7758258@users.noreply.github.com> Date: Wed, 26 Jun 2024 22:40:59 +0800 Subject: [PATCH] =?UTF-8?q?app=20=E7=AC=AC=E4=B8=80=E7=94=B5=E5=8A=A8=20au?= =?UTF-8?q?thor:=E8=BF=98=E7=8E=A9=E4=B8=AA=E5=B1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...54\344\270\200\347\224\265\345\212\250.py" | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 "\347\254\254\344\270\200\347\224\265\345\212\250.py" diff --git "a/\347\254\254\344\270\200\347\224\265\345\212\250.py" "b/\347\254\254\344\270\200\347\224\265\345\212\250.py" new file mode 100644 index 0000000..72c93c4 --- /dev/null +++ "b/\347\254\254\344\270\200\347\224\265\345\212\250.py" @@ -0,0 +1,100 @@ +import os +import requests +import time +import hashlib +import random + +# 获取青龙面板环境变量 dydd +dydd = os.environ.get('dydd', '') + +# 按换行符分割账号,并过滤空行 +accounts = [line.strip() for line in dydd.strip().split('\n') if line.strip()] + +url = "https://app2.d1ev.com/api/user/add-integral" + +# 公共参数 +params_base = { + 'app_id': "d1ev_app", + 'appName': "第一电动", + 'os': "android", + 'osVer': "9", + 'vName': "2.5.6", + 'vCode': "20506" +} + +headers = { + 'User-Agent': "Dalvik/2.1.0 (Linux; U; Android 9; PCRT00 Build/PQ3A.190605.06201646)", + 'Connection': "Keep-Alive", + 'Accept-Encoding': "gzip", + 'TE': "gzip, deflate; q=0.5" +} + +# 定义任务列表,每个任务包括任务类型和执行次数 +tasks = [ + {'type': 11, 'name': '签到', 'count': 1}, + {'type': 3, 'name': '分享', 'count': 3}, + {'type': 5, 'name': '点赞', 'count': 5}, + {'type': 2, 'name': '阅读', 'count': 1} +] + +for account in accounts: + # 分割账号为 uid 和 token + parts = account.split('#') + if len(parts) != 2: + print(f"跳过无效格式账号: {account}") + continue + + uid, token = parts + + # 生成当前时间戳 + current_timestamp = str(int(time.time())) + + for task in tasks: + task_type = task['type'] + task_name = task['name'] + task_count = task['count'] + + for _ in range(task_count): + if task_type == 3 or task_type == 5 or task_type == 2: # 分享、点赞和阅读任务 + # 生成随机的 targetId 和 targetType + target_id = f"2{random.randint(100000, 999999)}" + target_type = f"{random.randint(10, 99)}" + + # 签到签名 + sign_str = f"OMKCy2UxZwn8e4Ak{params_base['appName']}{params_base['app_id']}{params_base['os']}{params_base['osVer']}{target_id}{target_type}{current_timestamp}{token}{task_type}{uid}{params_base['vCode']}{params_base['vName']}" + else: + # 其他任务签名 + sign_str = f"OMKCy2UxZwn8e4Ak{params_base['appName']}{params_base['app_id']}{params_base['os']}{params_base['osVer']}{current_timestamp}{token}{task_type}{uid}{params_base['vCode']}{params_base['vName']}" + + # 计算 MD5 签名 + sign = hashlib.md5(sign_str.encode('utf-8')).hexdigest() + + # 定义带有动态值的参数 + params = { + 'timestamp': current_timestamp, + 'token': token, + 'uid': uid, + 'type': task_type, + 'sign': sign.upper(), + **params_base + } + + if task_type == 3 or task_type == 5 or task_type == 2: + params['targetId'] = target_id + params['targetType'] = target_type + + try: + # 发送 GET 请求 + response = requests.get(url, params=params, headers=headers) + response.raise_for_status() # 如果请求失败,则抛出异常 + + # 打印任务执行结果 + print(f"账号: {uid}, 任务: {task_name}, 响应: {response.text}") + except requests.exceptions.RequestException as e: + print(f"账号: {uid}, 任务: {task_name}, 请求失败: {e}") + + # 任务间隔5秒 + time.sleep(5) + + # 任务类型间隔10秒 + time.sleep(10) \ No newline at end of file