package main // https://pkg.go.dev/github.com/tebeka/selenium#example-package // https://github.com/domainr/whois // https://golangexample.com/dns-lookup-using-go/ /* chandler@xenon ~/projects/hats-domains % for i in {1..50}; do [21:17:08] dig ${i}hats.com | grep -i nxdomain >/dev/null && echo ${i}hats.com is available done 5hats.com is available 16hats.com is available 26hats.com is available 28hats.com is available 30hats.com is available 35hats.com is available 36hats.com is available 37hats.com is available 41hats.com is available 43hats.com is available 44hats.com is available 46hats.com is available 48hats.com is available 49hats.com is available [1] chandler@xenon ~/projects/hats-domains % */ import ( "flag" "fmt" "html/template" "io" "log" "net/http" "os" "time" "github.com/tebeka/selenium" ) type HatsSite struct { DomainName string Owner string Since time.Time ScreenshotURL string Title string FetchTime time.Time HTTPOpen bool HTTPSOpen bool } func getSites(largest int, wd selenium.WebDriver) (sites []HatsSite, err error) { for i := 2; i <= largest; i++ { domainName := fmt.Sprintf("%vhats.com", i) err := wd.Get(fmt.Sprintf("http://%v/", domainName)) if err != nil { return sites, err } title, err := wd.Title() if err != nil { return sites, err } screenshot, err := wd.Screenshot() if err != nil { return sites, err } sites = append(sites, HatsSite{ DomainName: domainName, Owner: "unknown", ScreenshotURL: string(screenshot), Title: title, FetchTime: time.Now(), HTTPOpen: false, // TODO HTTPSOpen: false, // TODO }) } return sites, nil } func generateHTML(sites []HatsSite, w io.Writer) error { tmpl, err := template.New("main").Parse(`