ports/main.go

35 lines
556 B
Go
Raw Permalink Normal View History

2022-06-20 20:07:41 +00:00
package main
import (
"flag"
"fmt"
"strconv"
"sync"
)
func main() {
remoteIpPtr := flag.String("remote", "", "Remote Server")
flag.Parse()
ports := flag.Args()
remoteIp := *remoteIpPtr
fmt.Println(remoteIp)
var hostWG sync.WaitGroup
ports = portsSetup(ports)
go scanIp(ports, remoteIp, &hostWG)
hostWG.Add(1)
hostWG.Wait()
fmt.Println("Process complete.")
}
func portsSetup(ports []string) []string {
if len(ports) == 0 {
for i := 1; i < 65535; i++ {
ports = append(ports, strconv.FormatInt(int64(i), 10))
}
}
return ports
}