mirror of
https://github.com/jessfraz/dockerfiles.git
synced 2025-04-10 22:22:45 +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
|
||||
for ip := ip.Mask(ipnet.Mask); ipnet.Contains(ip); inc(ip) {
|
||||
for port := beginPort; port <= endPort; port++ {
|
||||
wg.Add(1)
|
||||
go func(ip string) {
|
||||
go func(ip string, port int) {
|
||||
defer wg.Done()
|
||||
|
||||
scanIP(ip)
|
||||
}(ip.String())
|
||||
scanIP(ip, port)
|
||||
|
||||
}(ip.String(), port)
|
||||
}
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
@ -70,8 +73,7 @@ func main() {
|
||||
logrus.Infof("Scan took: %s", since.String())
|
||||
}
|
||||
|
||||
func scanIP(ip string) {
|
||||
for port := beginPort; port <= endPort; port++ {
|
||||
func scanIP(ip string, port int) {
|
||||
// Check if the port is open.
|
||||
ok := portOpen(ip, port)
|
||||
if !ok {
|
||||
@ -94,7 +96,6 @@ func scanIP(ip string) {
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user