mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2024-11-23 11:31:49 +01: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) {
|
||||
defer wg.Done()
|
||||
|
||||
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)
|
||||
}
|
||||
scanIP(ip)
|
||||
}(ip.String())
|
||||
}
|
||||
|
||||
|
@ -93,6 +70,33 @@ func main() {
|
|||
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 {
|
||||
c, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", ip, port), 2*time.Second)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue
Block a user