Created
April 4, 2017 15:53
-
-
Save rusco/dd018665be6a4c5480af080ce7f05bbd to your computer and use it in GitHub Desktop.
Golang Webcrawler against IIS 8.0 on Win10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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