马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import requests
import re
import hashlib
session = requests.session()
password = "你的密码"
username = "你的用户名"
login_url = "https://fishc.com.cn/member.php?mod=logging&action=login"
member_url = "https://fishc.com.cn/member.php"
def get_params():
login_res = session.get(login_url, headers=headers)
loginhash = re.search(r'loginhash=(.+)"\>', login_res.text).group(1)
formhash = re.search(r'name="formhash" value="(\w+)"', login_res.text).group(1)
return loginhash, formhash
def get_md5(data: bytes) -> str:
return hashlib.md5(data).hexdigest()
def main():
loginhash, formhash = get_params()
params = {
"mod": "logging",
"action": "login",
"loginsubmit": "yes",
"loginhash": loginhash,
"inajax": "1",
}
formdata = {
"formhash": formhash,
"referer": "https://fishc.com.cn/./",
"username": username,
"password": get_md5(password),
"questionid": 0,
"answer": "",
}
resp = session.post(member_url, params=params, data=formdata)
if "欢迎您回来" in resp.text:
print("登录成功!!!")
main()
输入你的用户名和密码,然后运行 |