V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
tz1006
V2EX  ›  Python

如何知道爬虫 token 是如何计算的?

  •  
  •   tz1006 · Oct 31, 2018 · 3498 views
    This topic created in 2736 days ago, the information mentioned may be changed or developed.
    我在一个机票网站上爬数据,自从被发现后,该网站把 timestamp 改动了一下,相当于变相的 token 验证。
    1. 我如何才能知道这个 timestamp 的生成方式? Chrome 控制台可以找出,或者看到函数的生成记录吗?
    2. JS 经过混淆,我怎样才能从一堆看不懂的字符中找到自己想要的东西?

    希望有大神给予指导。
    10 replies    2018-11-01 04:38:34 +08:00
    PulpFunction
        1
    PulpFunction  
       Oct 31, 2018 via Android
    1 服务器接收你的 get 之后,返回一串 cookie,可能通过 JS 加密

    2 慢慢看
    momo1999
        2
    momo1999  
       Oct 31, 2018 via Android
    用 selenium,难得去分析 js
    Leigg
        3
    Leigg  
       Oct 31, 2018 via iPhone
    前端上千 /万行 js 文件中一定有。
    jy02201949
        4
    jy02201949  
       Oct 31, 2018
    好像只能慢慢找了……
    crawl3r
        5
    crawl3r  
       Oct 31, 2018
    花钱找人弄
    no1xsyzy
        6
    no1xsyzy  
       Oct 31, 2018
    修改其 call 的函数为 function(){debugger;}从 call stack 里找
    注意 DOM API call,等价替换
    t6attack
        7
    t6attack  
       Oct 31, 2018
    万能方案是模拟浏览器,相当于每次把 js 执行一遍,所以效率会大减。
    wc110302
        8
    wc110302  
       Oct 31, 2018
    找到加密的 js 文件,找到关键函数,execJS 模拟运行,生成你要的 token
    locoz
        9
    locoz  
       Oct 31, 2018
    看了一下上面都没有说找加密函数的方法论,那我提两个吧。
    1、chrome 的各种条件断点
    2、全局搜索参数名
    tz1006
        10
    tz1006  
    OP
       Nov 1, 2018
    @shuax selenium 我用过,太慢。如果多线程容易崩溃, 我还是想接入 api 十秒两千个结果。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4172 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 60ms · UTC 04:15 · PVG 12:15 · LAX 21:15 · JFK 00:15
    ♥ Do have faith in what you're doing.