Skip to content

Commit

Permalink
Adds dialer and timeout tweaks; gofmt run
Browse files Browse the repository at this point in the history
  • Loading branch information
tomnomnom committed Jul 26, 2019
1 parent 0b9bce2 commit 275b6b8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
domains
hosts
httprobe
*.tgz
*.zip
*.exe
36 changes: 21 additions & 15 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"flag"
"fmt"
"net"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -51,9 +52,14 @@ func main() {
timeout := time.Duration(to * 1000000)

var tr = &http.Transport{
MaxIdleConns: 30,
IdleConnTimeout: time.Second,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
MaxIdleConns: 30,
IdleConnTimeout: time.Second,
DisableKeepAlives: true,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
DialContext: (&net.Dialer{
Timeout: timeout,
KeepAlive: time.Second,
}).DialContext,
}

re := func(req *http.Request, via []*http.Request) error {
Expand Down Expand Up @@ -105,29 +111,29 @@ func main() {

// Adding port templates
xlarge := []string{"81", "300", "591", "593", "832", "981", "1010", "1311", "2082", "2087", "2095", "2096", "2480", "3000", "3128", "3333", "4243", "4567", "4711", "4712", "4993", "5000", "5104", "5108", "5800", "6543", "7000", "7396", "7474", "8000", "8001", "8008", "8014", "8042", "8069", "8080", "8081", "8088", "8090", "8091", "8118", "8123", "8172", "8222", "8243", "8280", "8281", "8333", "8443", "8500", "8834", "8880", "8888", "8983", "9000", "9043", "9060", "9080", "9090", "9091", "9200", "9443", "9800", "9981", "12443", "16080", "18091", "18092", "20720", "28017"}
large := []string{"81","591","2082","2087","2095","2096","3000","8000","8001","8008","8080","8083","8443","8834","8888"}
large := []string{"81", "591", "2082", "2087", "2095", "2096", "3000", "8000", "8001", "8008", "8080", "8083", "8443", "8834", "8888"}

// submit any additional proto:port probes
for _, p := range probes {
switch p {
case "xlarge":
for _, port := range xlarge {
urls <- fmt.Sprintf("http://%s:%s", domain, port)
urls <- fmt.Sprintf("https://%s:%s", domain, port)
}
urls <- fmt.Sprintf("http://%s:%s", domain, port)
urls <- fmt.Sprintf("https://%s:%s", domain, port)
}
case "large":
for _, port := range large {
urls <- fmt.Sprintf("http://%s:%s", domain, port)
urls <- fmt.Sprintf("https://%s:%s", domain, port)
}
urls <- fmt.Sprintf("http://%s:%s", domain, port)
urls <- fmt.Sprintf("https://%s:%s", domain, port)
}
default:
pair := strings.SplitN(p, ":", 2)
if len(pair) != 2 {
continue
}
if len(pair) != 2 {
continue
}
urls <- fmt.Sprintf("%s://%s:%s", pair[0], domain, pair[1])
}
}
}
}

// once we've sent all the URLs off we can close the
Expand Down

0 comments on commit 275b6b8

Please sign in to comment.