V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
shenmi10086
V2EX  ›  程序员

某淘 App 接口 x-sign 签名计算

  •  
  •   shenmi10086 · 2019-11-07 19:04:39 +08:00 · 5249 次点击
    这是一个创建于 1845 天前的主题,其中的信息可能已经有所发展或是发生改变。

    一楼可能不能发那么多字

    8 条回复    2019-12-13 14:59:39 +08:00
    shenmi10086
        1
    shenmi10086  
    OP
       2019-11-07 19:05:47 +08:00
    某淘 App 接口 x-sign 签名计算


    这个小插件是手淘接口请求时 Header 头里面 的 x-sign 字段的计算

    xp 插件 不多解释了。这个插件会自动抓包手淘请求的接口打印在 xp 框架的日志里面,所以可以自行进行任意接口封装,比方说 手淘里面的 淘口令生成、淘口令解析、淘宝详情页面等等这些接口。
    shenmi10086
        2
    shenmi10086  
    OP
       2019-11-07 19:06:10 +08:00
    步骤:

    1:准备一个拥有 xp 框架的手机(模拟器)

    2:安装官方淘宝 7.6.0 版本、和本篇文章的插件,安装好后启动插件,重启手机生效

    3:点开一下安装的 XP 框架跟手机淘宝 APP

    4:把手机(模拟器)10086 端口转发出来(这个插件默认监听 10086 端口)
    shenmi10086
        3
    shenmi10086  
    OP
       2019-11-07 19:08:22 +08:00
    5:JXU4QkY3JXU2QzQyJXU4RkQ5JXU0RTJBJXU3QUVGJXU1M0UzJXVGRjBDJXU2M0E1JXU1M0UzJXU4REVGJXU3NTMxJXU5RUQ4JXU4QkE0JXU2NjJGL2lucHV0JTIwJXVGRjA4JXU3OTNBJXU0RjhCJXVGRjFBMTI3LjAuMC4xJTNBMTAwODYvc2lnbiV1RkYwOSUyQ0dFVCV1OEJGNyV1NkM0MiV1RkYwQyV1NTNDMiV1NjU3MCV1NTNFQSV1NjcwOSV1NEUyNCV1NEUyQSUyOGlucHV0JXUzMDAxYXBwa2V5JTI5JTIwJTI4JXU3OTNBJXU0RjhCJXVGRjFBaHR0cCUzQS8vMTI3LjAuMC4xJTNBMTAwODYvc2lnbiUzRmlucHV0J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ZXh0JTNEbnVsbCUyQyUyMGFwaSUzRG10b3AuY29tbW9uLmdldHRpbWVzdGFtcCU3RA==
    shenmi10086
        6
    shenmi10086  
    OP
       2019-11-07 19:09:55 +08:00
    上面是大致的抓包打印的日志信息,至于怎么导出 XP 框架的日志,玩过的都知道吧,或者自行百度吧,非常简单。下面有 PHP 跟 Python 两个版本的调用例子。

    附件
    eHAldTYzRDIldTRFRjYlMjBodHRwcyUzQS8vd3d3LmxhbnpvdXMuY29tL2k3N3o5c2IlMEEldTZERDgldTVCOUQ3LjYuMCUyMGh0dHBzJTNBLy93d3cubGFuem91cy5jb20vaTc3emE3ZyUwQVBIUCV1OEMwMyV1NzUyOCV1NEY4QiV1NUI1MCUyMGh0dHBzJTNBLy93d3cubGFuem91cy5jb20vaTc3emE4aCUwQVB5dGhvbiV1OEMwMyV1NzUyOCV1NEY4QiV1NUI1MCUyMGh0dHBzJTNBLy93d3cubGFuem91cy5jb20vaTc3emE5aQ==
    ixuuux
        7
    ixuuux  
       2019-11-11 19:20:17 +08:00
    牛批,不过现在淘宝升级了 x-sign 版本,最新的是 6.3,之前的版本风控更严,而且会被慢慢淘汰,考虑搞一下最新的吗?
    shenmi10086
        8
    shenmi10086  
    OP
       2019-12-13 14:59:39 +08:00
    最新的 6.3 x-sign 已经搞到手了 企鹅 MTIxMTk2MDc4MyUwQQ==
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3459 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:38 · PVG 19:38 · LAX 03:38 · JFK 06:38
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.