Golang 網絡爬蟲需要從經過 NTLM 認證的網頁中提取信息。有了有效的用戶名和密碼,網絡爬蟲如何與服務器執行 NTLM 4 次握手,以訪問受保護的網頁?url, username, password := "http://www.some-website.com", "admin", "12345"client := &http.Client{}req, _ := http.NewRequest("GET", url, nil)req.Header.Set("Authorization", "NTLM")res, _ := client.Do(req)
1 回答

www說
TA貢獻1775條經驗 獲得超8個贊
Azure/go-ntlmssp在開始抓取之前,您可以使用類似的包進行身份驗證。
url, username, password := "http://www.some-website.com", "admin", "12345"
client := &http.Client{
Transport: ntlmssp.Negotiator{
RoundTripper:&http.Transport{},
},
}
req, _ := http.NewRequest("GET", url, nil)
req.SetBasicAuth(username, password)
res, _ := client.Do(req)
- 1 回答
- 0 關注
- 276 瀏覽
添加回答
舉報
0/150
提交
取消