Skip to content

Instantly share code, notes, and snippets.

@rusco
Created April 4, 2017 15:53
Show Gist options
  • Save rusco/dd018665be6a4c5480af080ce7f05bbd to your computer and use it in GitHub Desktop.
Save rusco/dd018665be6a4c5480af080ce7f05bbd to your computer and use it in GitHub Desktop.
Golang Webcrawler against IIS 8.0 on Win10
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"github.com/Azure/go-ntlmssp"
)
func main() {
url, username, password := "https://someurl/", "someuser", "somepassword"
client := &http.Client{Transport: ntlmssp.Negotiator{RoundTripper: &http.Transport{}}}
req, _ := http.NewRequest("GET", url, nil)
req.SetBasicAuth(username, password)
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer res.Body.Close()
answerHtml, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println(string(answerHtml))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment