1
0
mirror of https://github.com/jessfraz/dockerfiles.git synced 2025-04-21 19:32:46 +02:00

disbale logger and time the scan

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2018-07-05 16:58:35 -04:00
parent 379820c688
commit b8c95ce521
No known key found for this signature in database
GPG Key ID: C0B444E6A3EFD4C1

@ -6,6 +6,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"log"
"net" "net"
"net/http" "net/http"
"os" "os"
@ -38,9 +39,16 @@ func main() {
} }
}() }()
// Set the logger to nil so we ignore messages from the Dial that don't matter.
// See: https://github.com/golang/go/issues/19895#issuecomment-292793756
log.SetFlags(0)
log.SetOutput(ioutil.Discard)
logrus.Infof("Scanning for Kubernetes Dashboards and API Servers on %s over port range %d-%d", cidr, beginPort, endPort) logrus.Infof("Scanning for Kubernetes Dashboards and API Servers on %s over port range %d-%d", cidr, beginPort, endPort)
logrus.Infof("This may take a bit...") logrus.Infof("This may take a bit...")
startTime := time.Now()
ip, ipnet, err := net.ParseCIDR(cidr) ip, ipnet, err := net.ParseCIDR(cidr)
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
@ -80,6 +88,9 @@ func main() {
} }
wg.Wait() wg.Wait()
since := time.Since(startTime)
logrus.Infof("Scan took: %s", since.String())
} }
func portOpen(ip string, port int) bool { func portOpen(ip string, port int) bool {