Created
April 18, 2018 10:25
-
-
Save srishanbhattarai/b5aea2bbfc1854bdd2fa90bc86770f84 to your computer and use it in GitHub Desktop.
Scrape list of Docker container names. Run `go run docker-names.go >> names.txt`
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" | |
"time" | |
) | |
func main() { | |
t := time.After(10 * time.Second) | |
for i := 0; i < 50; i++ { | |
go name() | |
} | |
<-t | |
} | |
func name() { | |
c := http.Client{} | |
res, err := c.Get("https://frightanic.com/goodies_content/docker-names.php") | |
if err != nil { | |
fmt.Printf("Couldnt get URL: %v", err) | |
os.Exit(1) | |
} | |
b, _ := ioutil.ReadAll(res.Body) | |
fmt.Printf("%s", string(b)) | |
go name() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment