diff --git a/k8scan/main.go b/k8scan/main.go index 0629928..e74a6cf 100644 --- a/k8scan/main.go +++ b/k8scan/main.go @@ -211,10 +211,12 @@ func scanIP(ip string, port int) { func portOpen(ip string, port int) bool { c, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", ip, port), timeoutPing) if err != nil { - // logrus.Warnf("listen at %s:%s failed: %v", ip, port, err) + logrus.Debugf("listen at %s:%s failed: %v", ip, port, err) return false } - defer c.Close() + if c != nil { + c.Close() + } return true } @@ -247,7 +249,7 @@ func isKubernetesDashboard(ip string, port int) (bool, string) { resp, err = client.Get(uri) } if err != nil { - //logrus.Warnf("getting %s:%s failed: %v", ip, port, err) + logrus.Debugf("getting %s:%s failed: %v", ip, port, err) return false, "" } defer resp.Body.Close()