• js加密(七)steam登录


    1. url: https://store.steampowered.com/login/?redir=&redir_ssl=1

    2. target: 登录

     3. 分析

    3.1 老样子,抓包,找js。

    随便输入一个帐号密码,点击登录,看看发送了哪些请求。

     一次登录,发送了两次请求,第一次的请求结果是一个json,里面有两个参数,是第二次请求中需要的,这个直接添加用户名和一个时间戳发送post就可以了,不管它。看dologin。

    3.2 有一个password参数是加密的,其余两个看起来不是很重要。下面就对这个参数进行解密。

     3.3 复制加密参数,去寻找哪里出现了这个参数,这里看起来比较像。

     那就打上断点调试,找依赖函数,变量,最终扣出可运行js代码。

    4. python代码:

    from afterWork.config import proxies, userAgent
    import requests
    import json
    import time
    import re
    import execjs
    
    def getModExp(data):
        res = requests.post(url='https://store.steampowered.com/login/getrsakey/',
                            data=data,
                            headers={'User-Agent': userAgent.random()})
        # print(res.text)
        jsonInfo = json.loads(res.text)
        mod = jsonInfo['publickey_mod']
        exp = jsonInfo['publickey_exp']
        return mod, exp
    
    def getData(userName, donotcache):
        data = {
            'donotcache': donotcache,
            'username': userName
        }
        return json.loads(json.dumps(data))
    
    def accountInfo():
        userName = '你的用户名'
        pw = '你的密码'
        donotcache = re.sub(r'.', '', str(time.time()))[:-4]
        # print(donotcache)
        # print('1577238990888')
    
        return userName, pw, donotcache
    
    def getJsCode():
        with open('jsCode.js', 'r') as f:
            jsCode = f.read()
            return jsCode
    
    def getLoginData(username, pw, donotcache):
        loginData = {
                    'donotcache': donotcache,
                    'password': pw,
                    'username': username,
                    'twofactorcode': '',
                    'emailauth': '',
                    'loginfriendlyname': '',
                    'captchagid': '-1',
                    'captcha_text': '',
                    'emailsteamid': '',
                    'rsatimestamp': '111645050000',
                    'remember_login': 'false'
                    }
        print(loginData)
        return json.loads(json.dumps(loginData))
    
    def login(loginData):
        res = requests.post(url='https://store.steampowered.com/login/dologin/',
                            data=loginData,
                            headers={'User-Agent': userAgent.random()})
        print(res.text)
        return
    
    def mainFun():
        userName, pw, donotcache = accountInfo()
        data = getData(userName, donotcache)
        # print(type(data))
        mod, exp = getModExp(data)
        jsCode = getJsCode()
        ctx = execjs.compile(jsCode)
        result = ctx.call('getPW', pw, mod, exp)
        # print(result)
        loginData = getLoginData(userName, result, donotcache)
        # print(type(loginData))
        login(loginData)
    
    if __name__ == '__main__':
        mainFun()

    结果,登录成功返回这些东西:

     学习交流,勿作他用。

  • 相关阅读:
    linux中批量添加文件前缀的操作
    Opencv中图像height width X 轴 Y轴 rows cols之间的对应关系
    PyCharm 快捷键失效解决办法
    模型权重初始化的可行性分析
    pycharm报错:Process finished with exit code -1073741819 (0xC0000005)解决办法
    损失函数———有关L1和L2正则项的理解
    利用tensorboard可视化checkpoint模型文件参数分布
    linux部署.net Core项目
    Java开发工程师2020最新面试题-适用于2-3年工作经验
    springboot常用注解
  • 原文地址:https://www.cnblogs.com/zrmw/p/12095879.html
Copyright © 2020-2023  润新知