日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

可能需要網(wǎng)頁認(rèn)證的wifi怎么連接 需要網(wǎng)頁認(rèn)證的wifi怎么連接

朋友有一臺電腦需要連接公共WIFI,該WIFI支持賬號登錄、手機(jī)驗(yàn)證碼登錄和微信登錄 , 但是一次登錄成功后 , 第二天早上會自動清理登錄賬號,因此需要一個方法每天自動登錄WIFI 。之前朋友使用Python爬蟲方法模擬用戶點(diǎn)擊輸入賬號和密碼登錄,但是經(jīng)常出現(xiàn)無法正常連接的狀況,于是找我看看如何優(yōu)化 。
1、 在瀏覽器中輸入www.baidu.com , 會自動跳轉(zhuǎn)到WIFI登錄認(rèn)證界面 。
【可能需要網(wǎng)頁認(rèn)證的wifi怎么連接 需要網(wǎng)頁認(rèn)證的wifi怎么連接】curl www.baidu.com使用curl模擬,獲取返回的頁面信息如下:
<html><head><script type="text/javascript">location.href=https://www.bjxdyg.com/life/"http://10.131.6.1:8080/wsmAuth/iportal/?usermac=34-F7-16-79-XX-XX&userip=10.131.50.166&ssid=FREE%2dWIFI&nasip=10%2e131%2e6%2e1&devType=v7"Authentication is required. Click here to open the authentication page.其中usermac和userip是當(dāng)前電腦的mac地址和自動獲取的IP 。
2、使用chrome調(diào)試模式獲取賬戶登錄form提交內(nèi)容 。

可能需要網(wǎng)頁認(rèn)證的wifi怎么連接 需要網(wǎng)頁認(rèn)證的wifi怎么連接


可以看到該form使用post方法向/wsmAuth/login提交了一堆參數(shù),其中重要的是username(用戶名)、signature(密碼)、usermac(mac地址)、userip(ip地址)、ssid(wifi名稱)、nasip(認(rèn)證服務(wù)器IP)、devType(設(shè)備類型)、userAgreement(登錄協(xié)議勾?。?。
以上參數(shù)用戶名密碼我們有 , 其他參數(shù)均可以從跳轉(zhuǎn)頁面鏈接中獲取 。
3、測試直接提交登錄認(rèn)證是否可以登錄成功 。
curl http://10.131.6.1:8080/wsmAuth/login -X POST -d "operateType=7&signature=XXXXXX&userName=135xxxxxxxx&userAgreement=1&rabbit=h3c&templateId=7&redirect_uri=null&apmac=null&usermac=34-F7-16-79-XX-XX&userip=10.131.50.166&userurl= &shopid=1&groupid=0&authCfgid=1&ssid=FREE-WIFI&basip=null&nasid=null&wlannasid=null&wlanssid=null&userPublicIp=null&nasip=10.131.6.1&devType=v7&ipmAuthType=1&authPage=/themeTemplate/1638770462964/auth.xml&onebutton=0&userLabel=&needWechat=1"登錄成功!
HTTP/1.1 200 OKContent-Type: text/json;charset=UTF-8Content-Length: 179{"succurl":"http://10.131.6.1:8080/wsmAuth/succ_page.jsp?templateId=7&shopid=1&ssid=FREE-WIFI&succpage=/themeTemplate/1638770462964/complete.xml&groupid=0&userLabel="}使用上面的方法登錄成功說明該WIFI認(rèn)證并沒有COOKIE、REFERE等驗(yàn)證 , 這將簡化自動登錄程序 。我們完全不需要用朋友寫的模擬瀏覽器點(diǎn)擊的方案了,代碼量和代碼復(fù)雜度極大降低!
4、 再次訪問www.baidu.com測試網(wǎng)絡(luò)是否正常 。
可以正常訪問外網(wǎng)!
curl www.baidu.com -iHTTP/1.1 200 OKAccept-Ranges: bytesCache-Control: private, no-cache, no-store, proxy-revalidate, no-transformConnection: keep-aliveContent-Length: 2381Content-Type: text/htmlDate: Tue, 15 Mar 2022 02:31:09 GMTEtag: "588604eb-94d"Last-Modified: Mon, 23 Jan 2017 13:28:11 GMTPragma: no-cacheServer: bfe/1.0.8.18Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/<!DOCTYPE html><!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>百度一下,你就知道</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=百度一下 class="bg s_btn"></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>新聞</a> <a href=http://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>地圖</a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>視頻</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>貼吧</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>登錄</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">登錄</a>');</script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">更多產(chǎn)品</a> </div> </div> </div> <div id=ftCon> <div id=ftConw> <p id=lh> <a href=http://home.baidu.com>關(guān)于百度</a> <a href=http://ir.baidu.com>About Baidu</a> </p> <p id=cp>?2017 Baidu <a href=http://www.baidu.com/duty/>使用百度前必讀</a><a href=http://jianyi.baidu.com/ class=cp-feedback>意見反饋</a> 京ICP證030173號<img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>

推薦閱讀