吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 4345|回复: 49
收起左侧

[Python 转载] 云函数天翼云盘自动签到+抽奖 (增加了一个抽奖地址)

  [复制链接]
bake 发表于 2023-3-31 16:26
添加了一个从公众号活动页面扒的抽奖接口
[Python] 纯文本查看 复制代码
"""
[url=https://www.52pojie.cn/thread-1231190-1-1.html]https://www.52pojie.cn/thread-1231190-1-1.html[/url]

感谢作者开源天翼云签到部分源码:
https://github.com/t00t00-crypto/cloud189-action/blob/master/checkin.py 及 [login_function.py](https://github.com/Dawnnnnnn/Cloud189/blob/master/functions/login_function.py)
"""
import time
import re
# import json
import base64
import hashlib
# from urllib import parse

import rsa
import requests
import random
BI_RM = list("0123456789abcdefghijklmnopqrstuvwxyz")

B64MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

s = requests.Session()

# 在下面两行的引号内贴上账号(仅支持手机号)和密码
username = ""
password = ""

_ = """
if(username == "" or password == ""):
    username = input("账号:")
    password = input("密码:")
# """

assert username and password, "在第23、24行填入有效账号和密码"

# https://cp.xuthus.cc/ 申请key 并设置测试好酷推
xuthuskey = ""
# xuthuskey = "27a...........................7b"

if not xuthuskey:
    print("第36行的xuthuskey 为空,签到结果将不会通过酷推发到你的qq")


def int2char(a):
    return BI_RM[a]


def b64tohex(a):
    d = ""
    e = 0
    c = 0
    for i in range(len(a)):
        if list(a)[i] != "=":
            v = B64MAP.index(list(a)[i])
            if 0 == e:
                e = 1
                d += int2char(v >> 2)
                c = 3 & v
            elif 1 == e:
                e = 2
                d += int2char(c << 2 | v >> 4)
                c = 15 & v
            elif 2 == e:
                e = 3
                d += int2char(c)
                d += int2char(v >> 2)
                c = 3 & v
            else:
                e = 0
                d += int2char(c << 2 | v >> 4)
                d += int2char(15 & v)
    if e == 1:
        d += int2char(c << 2)
    return d


def rsa_encode(j_rsakey, string):
    rsa_key = f"-----BEGIN PUBLIC KEY-----\n{j_rsakey}\n-----END PUBLIC KEY-----"
    pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode())
    result = b64tohex((base64.b64encode(rsa.encrypt(f'{string}'.encode(), pubkey))).decode())
    return result


def calculate_md5_sign(params):
    return hashlib.md5('&'.join(sorted(params.split('&'))).encode('utf-8')).hexdigest()


def login(username, password):
    url = "https://cloud.189.cn/api/portal/loginUrl.action?redirectURL=https://cloud.189.cn/web/redirect.html"
    r = s.get(url)
    captchaToken = re.findall(r"captchaToken' value='(.+?)'", r.text)[0]
    lt = re.findall(r'lt = "(.+?)"', r.text)[0]
    returnUrl = re.findall(r"returnUrl = '(.+?)'", r.text)[0]
    paramId = re.findall(r'paramId = "(.+?)"', r.text)[0]
    j_rsakey = re.findall(r'j_rsaKey" value="(\S+)"', r.text, re.M)[0]
    s.headers.update({"lt": lt})

    username = rsa_encode(j_rsakey, username)
    password = rsa_encode(j_rsakey, password)
    url = "https://open.e.189.cn/api/logbox/oauth2/loginSubmit.do"
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/76.0',
        'Referer': 'https://open.e.189.cn/',
    }
    data = {
        "appKey": "cloud",
        "accountType": '01',
        "userName": f"{{RSA}}{username}",
        "password": f"{{RSA}}{password}",
        "validateCode": "",
        "captchaToken": captchaToken,
        "returnUrl": returnUrl,
        "mailSuffix": "@189.cn",
        "paramId": paramId
    }
    r = s.post(url, data=data, headers=headers, timeout=5)
    if (r.json()['result'] == 0):
        print(r.json()['msg'])
    else:
        print(r.json()['msg'])
    redirect_url = r.json()['toUrl']
    r = s.get(redirect_url)
    return s


def main():
    login(username, password)
    rand = str(round(time.time() * 1000))
    surl = f'https://api.cloud.189.cn/mkt/userSign.action?rand={rand}&clientType=TELEANDROID&version=8.6.3&model=SM-G930K'
    url = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN&activityId=ACT_SIGNIN'
    url2 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_SIGNIN_PHOTOS&activityId=ACT_SIGNIN'
    url3 = f'https://m.cloud.189.cn/v2/drawPrizeMarketDetails.action?taskId=TASK_2022_FLDFS_KJ&activityId=ACT_SIGNIN'
    headers = {
        'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
        "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
        "Host": "m.cloud.189.cn",
        "Accept-Encoding": "gzip, deflate",
    }
    response = s.get(surl, headers=headers)
    netdiskBonus = response.json()['netdiskBonus']
    if (response.json()['isSign'] == "false"):
        print(f"未签到,签到获得{netdiskBonus}M空间")
        res1 = f"未签到,签到获得{netdiskBonus}M空间"
    else:
        print(f"已经签到过了,签到获得{netdiskBonus}M空间")
        res1 = f"已经签到过了,签到获得{netdiskBonus}M空间"

    headers = {
        'User-Agent': 'Mozilla/5.0 (Linux; Android 5.1.1; SM-G930K Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/74.0.3729.136 Mobile Safari/537.36 Ecloud/8.6.3 Android/22 clientId/355325117317828 clientModel/SM-G930K imsi/460071114317824 clientChannelId/qq proVersion/1.0.6',
        "Referer": "https://m.cloud.189.cn/zhuanti/2016/sign/index.jsp?albumBackupOpened=1",
        "Host": "m.cloud.189.cn",
        "Accept-Encoding": "gzip, deflate",
    }
    response = s.get(url, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res2 = ""
    else:
        description = response.json()['description']
        print(f"抽奖获得{description}")
        res2 = f"抽奖获得{description}"
    response = s.get(url2, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res3 = ""
    else:
        description = response.json()['description']
        print(f"抽奖获得{description}")
        res3 = f"抽奖获得{description}"

    response = s.get(url3, headers=headers)
    if ("errorCode" in response.text):
        print(response.text)
        res3 = ""
    else:
        description = response.json()['description']
        print(f"链接3抽奖获得{description}")
        res3 = f"链接3抽奖获得{description}"    

    if xuthuskey.strip():
        _ = xuthuskey.strip()
        requests.get(f"https://push.xuthus.cc/send/{_}?c=func compute: {res1}, {res2}, {res3}")


def lambda_handler(event, context):  # aws default
    main()


def main_handler(event, context):  # tencent default
    main()


def handler(event, context):  # aliyun default
    main()


if __name__ == "__main__":
    time.sleep(random.randint(5, 25))
    main()

免费评分

参与人数 7吾爱币 +6 热心值 +6 收起 理由
lua11 + 1 + 1 谢谢@Thanks!
ShoreNinth + 1 谢谢@Thanks!
Yangzaipython + 1 谢谢@Thanks!
EHOOD + 1 + 1 我很赞同!
陈宇轩 + 1 + 1 刚好,终于等到第三个url了。拿走不谢。
sadanlei + 1 + 1 膜拜大佬!
haiyangnanzi + 1 + 1 小白不会用,大佬

查看全部评分

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

 楼主| bake 发表于 2023-4-3 16:08
wayne_23 发表于 2023-3-31 20:02
请问怎么用?小白不懂。

挂云函数或者githubAction,论坛里搜索使用方法
 楼主| bake 发表于 2023-5-11 11:16
本帖最后由 bake 于 2023-5-11 11:17 编辑
kover 发表于 2023-5-11 10:02
什么时候可以修复呢,静候佳音

已修复,增加钉钉推送,https://www.52pojie.cn/thread-1784111-1-1.html
drw 发表于 2023-3-31 17:41
EHOOD 发表于 2023-4-2 07:39
函数返回
{
    "errorMessage": "function invocation exception, error: catch a 'ModuleNotFoundError' exception: No module named 'pyasn1'",
    "errorType": "ModuleNotFoundError",
    "stackTrace": [
        "File \"./index.py\", line 206, in handler",
        "  main()",
        "File \"./index.py\", line 139, in main",
        "  login(username, password)",
        "File \"./index.py\", line 110, in login",
        "  username = rsa_encode(j_rsakey, username)",
        "File \"./index.py\", line 91, in rsa_encode",
        "  pubkey = rsa.PublicKey.load_pkcs1_openssl_pem(rsa_key.encode())",
        "File \"./rsa/key.py\", line 360, in load_pkcs1_openssl_pem",
        "  return cls.load_pkcs1_openssl_der(der)",
        "File \"./rsa/key.py\", line 371, in load_pkcs1_openssl_der",
        "  from rsa.asn1 import OpenSSLPubKey",
        "File \"./rsa/asn1.py\", line 20, in <module>",
        "  from pyasn1.type import univ, namedtype, tag"
    ]
}
请问这种错误怎么解决呀?我琢磨着也没用到pyasn1啊?
89684828 发表于 2023-5-12 08:07
支持一下,谢谢!
MPFENG 发表于 2023-3-31 16:34
等待成品。。。。
苏晓宇c 发表于 2023-3-31 16:46
MPFENG 发表于 2023-3-31 16:34
等待成品。。。。

这就是成品了,直接代码挂云函数。
1680252379978.jpg
lovekezi 发表于 2023-3-31 16:48
意思是要有服务器!
syz87 发表于 2023-3-31 16:50
看图上怎么都是50MB,我每天手动点最少只有7MB
zbr878458173 发表于 2023-3-31 16:50
lovekezi 发表于 2023-3-31 16:48
意思是要有服务器!

我记得之前有在github上跑的。
laisheen 发表于 2023-3-31 16:53
可以加个多账号吗?
lovekezi 发表于 2023-3-31 16:53
zbr878458173 发表于 2023-3-31 16:50
我记得之前有在github上跑的。

如果做成网页调用或者apk可能更受欢迎
我是吉哥 发表于 2023-3-31 16:55
如果做成网页调用或者apk可能更受欢迎
lingyi99 发表于 2023-3-31 17:03
要是有软件类型的就方便多了
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-3 01:38

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表