推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
linhanqiu
V2EX  ›  Python

关于服务端客户端验签以及加解密问题

  •  
  •   linhanqiu · Mar 28, 2018 · 1834 views
    This topic created in 3129 days ago, the information mentioned may be changed or developed.

    最近在爬取“马蜂窝”的 app 攻略部分,爬取不同城市的时候发现每次请求的时候需要加上不同的 oauth_signature, 也就是服务端和客户端验证的签名。

    例如,得到的是“ oauth_signature=2Kj6MQi6oZ%2FkNPye4xYUGm%2BRD%2Bc%3D ”

    URL 解码之后得到的是“ 2Kj6MQi6oZ/kNPye4xYUGm+RD+c=”

    这个是使用的 HMAC-SHA1 方法,也就是 sha1,就是使用消息+类似密码的东西得到的

    大致公式总结如下,

    消息=未知

    密码=''.join( [ oauth_timestamp,oauth_token,oauth_nonce ] .sort())->base64 编码

    sha1 (消息+密码) = oauth_signature = “ oauth_signature ”

    结果总是算不对,现在想问问可不可以直接去得到消息是什么,以及每次的 oauth_nonce 随机数怎么得到

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5805 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 06:16 · PVG 14:16 · LAX 23:16 · JFK 02:16
    ♥ Do have faith in what you're doing.