{"id":184910,"date":"2020-10-29T20:21:17","date_gmt":"2020-10-29T12:21:17","guid":{"rendered":"http:\/\/4563.org\/?p=184910"},"modified":"2020-10-29T20:21:17","modified_gmt":"2020-10-29T12:21:17","slug":"selenium-%e5%a6%82%e4%bd%95%e5%a4%84%e7%90%86-basic-auth-%e7%9a%84%e8%be%93%e5%85%a5%e6%a1%86%e7%9a%84%e9%97%ae%e9%a2%98%ef%bc%9f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=184910","title":{"rendered":"Selenium \u5982\u4f55\u5904\u7406 Basic Auth \u7684\u8f93\u5165\u6846\u7684\u95ee\u9898\uff1f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Selenium \u5982\u4f55\u5904\u7406 Basic Auth \u7684\u8f93\u5165\u6846\u7684\u95ee\u9898\uff1f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : black11black <\/span>  <span><i><\/i> 4<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5982\u9898\uff0c\u76ee\u524d\u6709\u4e00\u4e2a\u6bd4\u8f83\u590d\u6742\u7684\u767b\u5f55\u9a8c\u8bc1\u7cfb\u7edf\uff0c\u7b80\u5355\u6765\u8bf4\u5206\u4e3a\u4e24\u6b65\uff0c\u5148\u7ecf\u8fc7\u4e00\u4e2a\u6bd4\u8f83\u6b63\u5e38\u7684 web \u767b\u5f55\u9a8c\u8bc1\uff08 jwt \u5b9e\u73b0\uff09\uff0c\u9a8c\u8bc1\u6210\u529f\u540e\u8df3\u8f6c\u5230\u53e6\u5916\u4e00\u4e2a\u57df\u4e0b\u7684\u7f51\u5740\uff0c\u5f39\u51fa\u4e00\u4e2a Basic Auth \u9a8c\u8bc1\u3002<\/p>\n<p>\u4e0d\u8bba\u987a\u5e8f\uff0c\u7f51\u9875\u9700\u8981\u7ecf\u8fc7\u53cc\u91cd\u8ba4\u8bc1\u4e4b\u540e\u624d\u80fd\u663e\u793a\u5185\u5bb9\u3002<\/p>\n<p>\u7528 Python3 + selenium \u641e\u6a21\u62df\u7684\u8bdd\u9047\u5230\u95ee\u9898\u5c31\u662f Basic Auth \u4e0d\u77e5\u9053\u600e\u4e48\u8fc7\u3002<\/p>\n<p>\u6839\u636e\u7f51\u4e0a\u67e5\u627e\u5230\u7684\u5185\u5bb9\uff0c\u53ea\u9700\u8981\u5c06\u7f51\u5740\u6539\u4e3a<code>https:\/\/\u7528\u6237\u540d:\u5bc6\u7801 @www.baidu.com<\/code>(\u5047\u8bbe\u7f51\u5740\u662f\u767e\u5ea6)\u5c31\u80fd\u81ea\u52a8\u901a\u8fc7\u9a8c\u8bc1\u800c\u4e0d\u7528\u5f39\u51fa\u6846\uff0c\u5b9e\u6d4b\u65e0\u6548\u3002<\/p>\n<p>\u800c\u540e\u6839\u636e\u7f51\u4e0a\u67e5\u627e\u4fe1\u606f\u8bf4\uff0c\u9700\u8981\u5355\u72ec\u8bbe\u7f6e\u6d4f\u89c8\u5668\u7684 Preference \u624d\u80fd\u8ba9\u4e0a\u8ff0\u65b9\u6cd5\u6709\u6548\uff0c\u4e8e\u662f\u6211\u6dfb\u52a0\u4e86\u4e0b\u9762\u7684\u4ee3\u7801<\/p>\n<pre><code>from selenium import webdriver  options = webdriver.ChromeOptions() options.add_experimental_option(\"prefs\" , {'network.http.phishy-userpass-length':255}) driver = webdriver.Chrome(options = options) driver.get(\"https:\/\/username:[email&#160;protected]\") # ... <\/code><\/pre>\n<p>\u7ed3\u679c\u4ecd\u7136\u65e0\u6548\u3002<\/p>\n<p>\u6709\u6ca1\u6709\u5e26\u4f6c\u770b\u51fa\u6765\u5565\u539f\u56e0\u4e86<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3989648\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : royzheng <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8bf7\u5728 http headet \u91cc\u6dfb\u52a0 basic auth \u4fe1\u606f\uff0c\u5177\u4f53\u4f60\u7528 chrome basic auth \u540e\u8bbf\u95ee\u90a3\u4e9b\u9875\u9762\u770b\u5934\u90e8                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3989649\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : elfive <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u52a0\u4e00\u4e2a\u8bf7\u6c42\u5934\uff1a<br \/>WWW-Authenticate: Basic {(username:password)\u7684 Base64 \u7f16\u7801\u503c}<\/p>\n<p>https:\/\/tools.ietf.org\/html\/rfc7235                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3989650\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : elfive <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @elfive #2 \u5199\u9519\u4e86\uff0c\u8bf7\u6c42\u5934\u7684 key \u5e94\u8be5\u662f Authorization                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Selenium \u5982\u4f55\u5904\u7406 Bas&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/184910"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=184910"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/184910\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=184910"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=184910"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=184910"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}