小编典典

Golang Web刮板NTLM身份验证

go

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)

阅读 313

收藏
2020-07-02

共1个答案

小编典典

您可以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)
2020-07-02