UltraDebug

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: A C D R G Y M Z X S P
公益项目,接受捐赠
查看: 1546|回复: 0
收起左侧

[分享] 某科网登录模块RSA加密分析

[复制链接]
ultradebug

主题

0

回帖

UD

管理员

UID
1
积分
2338
注册时间
2021-12-20
最后登录
1970-1-1
2023-11-23 23:49:22 | 显示全部楼层 |阅读模式
看到求助板块经常有道友经常求助下载某科网资料,故想分析分析登录模块
(以前也做过某科网自动登录下载的,但是网站升级,对登录板块进行了升级,后面也没时间再弄了)
先看登录界面源码
某科网登录模块RSA加密分析 - ultradebug_UltraDebug

在源码中搜索accountLoginForm
某科网登录模块RSA加密分析 - ultradebug_UltraDebug

发现有encryptPwd,继续搜索encryptPwd函数
某科网登录模块RSA加密分析 - ultradebug_UltraDebug

发现主要是encryptE1函数进行加密,该函数是由getEncrypValue加密而来,继续搜索getEncryptValue,该函数还是在当前文件
某科网登录模块RSA加密分析 - ultradebug_UltraDebug

注意:出现了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
还有更多的精彩内容,作者设置为付费后可见
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.
回复 打印

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|站点地图|UltraDebug ( 滇ICP备2022002049号-2 滇公网安备 53032102000034号)

GMT+8, 2025-6-18 19:24 , Processed in 0.032035 second(s), 11 queries , Redis On.

Powered by Discuz X3.4

© 2001-2023 Discuz! Team.

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