看到求助板块经常有道友经常求助下载某科网资料,故想分析分析登录模块
(以前也做过某科网自动登录下载的,但是网站升级,对登录板块进行了升级,后面也没时间再弄了)
先看登录界面源码
在源码中搜索accountLoginForm
发现有encryptPwd,继续搜索encryptPwd函数
发现主要是encryptE1函数进行加密,该函数是由getEncrypValue加密而来,继续搜索getEncryptValue,该函数还是在当前文件
注意:出现了Pubkey,分析该加密函数,应该是RSA加密,而且加密的前还通过js文件进行了处理,拼接了一些字符串进去得到newValue,和密码一起进行RSA加密。
后面实验发现,js的加密函数每次刷新都不一样。
所以模拟登录的方案大概出来了,
step1:请求当前页面,获取js加密函数以及RSA密钥
step2:模拟js函数拼接密码,得到newValue
step3:对newValue进行RSA加密
step4:提交后台,模拟登录
好,开始码代码,获取所需要的js函数以及RSA密钥
[Python] 纯文本查看 复制代码
import json
from RSA_jiami import encryption
import execjs,re
import requests
def getjs():
cookie=open("cookie.txt","r").read()
url="https://sso.zxxk.com/login"
header={
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Host": "sso.zxxk.com",
"Pragma": "no-cache",
"Sec-Fetch-Dest": "document",
"Sec-Fetch-Mode": "navigate",
"Sec-Fetch-Site": "same-origin",
"Sec-Fetch-User": "?1",
"Upgrade-Insecure-Requests": "1",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36 Edg/118.0.2088.76",
"sec-ch-ua": '''"Chromium";v="118", "Microsoft Edge";v="118", "Not=A?Brand";v="99"''',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "Windows",
"Cookie":cookie
}
html=requests.get(url=url,headers=header).text
# html_headers=requests.get(url=url,headers=header).headers
js=re.findall('eval\("(.*?)"\);',html)[0]
flowId=re.findall('<input type="hidden" name="flowId" value="(.*?)">',html)[0]
execution=re.findall('<input type="hidden" name="execution" value="(.*?)"/>',html)[0]
hanshu=re.findall("function (.*?)\(.*?\){",js)[0]
canshu=re.findall("\((.*?)\){",js)[0]
return flowId,execution,hanshu,canshu,js
支付2UD,阅读全文
还有更多的精彩内容,作者设置为付费后可见
UltraDebug免责声明
✅以上内容均来自网友转发或原创,如存在侵权请发送到站方邮件9003554@qq.com 处理。
✅The above content is forwarded or original by netizens. If there is infringement, please send the email to the destination 9003554@qq.com handle.