mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2025-04-28 14:45:40 +02:00
cleanup
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
ae31e7f249
commit
d57f4f0145
@ -60,30 +60,7 @@ func main() {
|
|||||||
go func(ip string) {
|
go func(ip string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
for port := beginPort; port <= endPort; port++ {
|
scanIP(ip)
|
||||||
// Check if the port is open.
|
|
||||||
ok := portOpen(ip, port)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if it's a kubernetes dashboard.
|
|
||||||
ok = isKubernetesDashboard(ip, port)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("%s:%d\n", ip, port)
|
|
||||||
// Get the info for the ip address.
|
|
||||||
info, err := getIPInfo(ip)
|
|
||||||
if err != nil {
|
|
||||||
logrus.Warnf("ip info err: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
fmt.Printf("%s:%d\t%s\t%s\t%s\n",
|
|
||||||
ip, port,
|
|
||||||
info.Net.Organization.Handle, info.Net.Organization.Name, info.Net.Organization.Reference)
|
|
||||||
}
|
|
||||||
}(ip.String())
|
}(ip.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,6 +70,33 @@ func main() {
|
|||||||
logrus.Infof("Scan took: %s", since.String())
|
logrus.Infof("Scan took: %s", since.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func scanIP(ip string) {
|
||||||
|
for port := beginPort; port <= endPort; port++ {
|
||||||
|
// Check if the port is open.
|
||||||
|
ok := portOpen(ip, port)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if it's a kubernetes dashboard.
|
||||||
|
ok = isKubernetesDashboard(ip, port)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("%s:%d\n", ip, port)
|
||||||
|
// Get the info for the ip address.
|
||||||
|
info, err := getIPInfo(ip)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Warnf("ip info err: %v", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
fmt.Printf("%s:%d\t%s\t%s\t%s\n",
|
||||||
|
ip, port,
|
||||||
|
info.Net.Organization.Handle, info.Net.Organization.Name, info.Net.Organization.Reference)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func portOpen(ip string, port int) bool {
|
func portOpen(ip string, port int) bool {
|
||||||
c, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", ip, port), 2*time.Second)
|
c, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", ip, port), 2*time.Second)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user