mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2025-04-24 12:45:39 +02:00
reorganize
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
parent
c4901b1521
commit
b99aa9d325
@ -56,12 +56,15 @@ func main() {
|
|||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
|
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
|
||||||
wg.Add(1)
|
for port := beginPort; port <= endPort; port++ {
|
||||||
go func(ip string) {
|
wg.Add(1)
|
||||||
defer wg.Done()
|
go func(ip string, port int) {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
scanIP(ip)
|
scanIP(ip, port)
|
||||||
}(ip.String())
|
|
||||||
|
}(ip.String(), port)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
@ -70,31 +73,29 @@ func main() {
|
|||||||
logrus.Infof("Scan took: %s", since.String())
|
logrus.Infof("Scan took: %s", since.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func scanIP(ip string) {
|
func scanIP(ip string, port int) {
|
||||||
for port := beginPort; port <= endPort; port++ {
|
// Check if the port is open.
|
||||||
// Check if the port is open.
|
ok := portOpen(ip, port)
|
||||||
ok := portOpen(ip, port)
|
if !ok {
|
||||||
if !ok {
|
return
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user