本帖最后由 天轩科技 于 2024-12-12 08:09 编辑
看到 @xiaoxiaoY520 发的GO版的 签到脚本 https://www.52pojie.cn/thread-1990351-1-1.html
写了一个python脚本。方便其他习惯用python的小伙伴们挂青龙面板上。
使用方法在脚本 第70行 跟 第72行 处 填写账号密码即可 。(强烈建议不要设置跟其他平台账号一样的密码!!)
[Python] 纯文本查看 复制代码 import json,requests,hashlib
class MossFrp_Sign:
def __init__(self):
self.Login_url = "https://https.ghs.wiki:7002/API?void=post"
self.token = ''
self.headers = {
'Accept': 'application/json',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Access-Control-Allow-Origin': '*',
'Connection': 'keep-alive',
'Content-Type': 'application/json',
'Origin': 'https://www.mossfrp.top',
'Referer': 'https://www.mossfrp.top/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'cross-site',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36',
'access-control-max-age': '864000',
'sec-ch-ua': '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"'
}
def Crypto_PWD(self,PWD):
return hashlib.sha256(PWD.encode()).hexdigest()
def Login(self,account,password):
pwd = self.Crypto_PWD(password)
payload = json.dumps({
"type": "login",
"loginType": "email",
"account": account,
"password": pwd,
"encryption": "true"
})
response = requests.post(self.Login_url, headers=self.headers, data=payload)
res_body = response.json()
if response.status_code == 200 and 'token' in res_body:
print(res_body['token'])
return res_body['token']
elif res_body['message'] == 'Unknown user or invalid password.':
print(f'请检查您的账号或密码是否正确')
return False
def Get_Person_Infomation(self):
payload = json.dumps({
"type": "userInfo",
"token": self.token
})
response = requests.post(self.Login_url, headers=self.headers, data=payload).json()
print(f'恭喜你!【{response["userInfo"]["username"]}】登录成功!\n 账号ID:{response["userInfo"]["userID"]} \n 邮 箱 :{response["userInfo"]["email"]}\n 当前账号银币为:{response["userInfo"]["silver"]}')
def SignIn(self):
payload = json.dumps({
"type": "signIn",
"token": self.token
})
response = requests.post(self.Login_url, headers=self.headers, data=payload).json()
if response['status'] == '200':
signInMessage = response["signInMessage"].replace('\r\n', ',')
luckMessage = response["luckMessage"].replace(',','')
print(f'【系统提示:】{signInMessage}\n【今日运势】:{luckMessage} \n【今日幸运值】:{response["luck"]} \n【获得银币】:{response["coin"]} ')
def Main_info(self):
# 账号
account = ''
# 密码
password = ''
self.token = self.Login(account,password)
self.Get_Person_Infomation()
self.SignIn()
if __name__ == '__main__':
MossFrp_Sign = MossFrp_Sign()
MossFrp_Sign.Main_info()
|