How to track login and scan REST-interface

时间:2017-04-30 10:36:22

标签: python selenium authentication https scripting

I want to write a python script for a website that requires a login to enable some features and I want to find out, what I need to put in the header of my script requests (e.g. authentication token and other parameters), so they are executed the same way as requests over the browser.

Does wireshark help with this if the website uses HTTPS?

Or is my only option executing a browser script with Selenium after a manual login?

1 个答案:

答案 0 :(得分:0)

对于遇到相同问题的其他人:您不需要从浏览器外部传输流量。只是......

  • 使用Google Chrome
  • 打开开发人员工具
  • 点击“网络标签”
  • 清除数据
  • 并在dev-tools所在的选项卡中执行请求 开
  • 您应该在顶部看到初始请求,然后是 后续的(广告,外部图像服务器等)。
  • 你可以 右键单击初始请求,将其另存为.har文件并使用 像https://toolbox.googleapps.com/apps/har_analyzer/这样的东西 提取两者的标题或请求和响应。
  • 现在您知道标题中需要的参数(键和值),甚至可以在python脚本中使用提交的值,如标记和cookie