1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- package main
- import (
- "flag"
- "fmt"
- "log"
- "strings"
- "sync"
- kyoketsu "git.aetherial.dev/aeth/kyoketsu/pkg"
- )
- func main() {
- // kyoketsu.PingWithDependency(os.Args[1])
- // os.Exit(1)
- local := flag.Bool("local", true, "set flag to false to run this in targeted remote mode")
- remoteAddrs := flag.String("ips", "", "comma seperated list of ip addresses to gather info about")
- iface := flag.String("iface", "eth0", "use this flag to specify the interface to autonomously use for scanning.")
- flag.Parse()
- if !*local {
- spAddr := strings.Split(*remoteAddrs, ",")
- addr, err := kyoketsu.GetAllRemoteAddresses(spAddr)
- if err != nil {
- log.Fatal(err)
- }
- var wg sync.WaitGroup
- for i := range addr.Addr {
- wg.Add(1)
- go func(idx int, wg *sync.WaitGroup) {
- out := kyoketsu.PortWalk(addr.Addr[idx].String(), kyoketsu.PORT_MAP)
- if len(out.ListeningPorts) > 0 {
- fmt.Printf("%+v\n", out)
- }
- wg.Done()
- }(i, &wg)
- }
- wg.Wait()
- } else {
- addr, err := kyoketsu.GetAllAddresses(*iface)
- if err != nil {
- log.Fatal(err)
- }
- var wg sync.WaitGroup
- for i := range addr.Addr {
- wg.Add(1)
- go func(idx int, wg *sync.WaitGroup) {
- out := kyoketsu.PortWalk(addr.Addr[idx].String(), kyoketsu.PORT_MAP)
- if len(out.ListeningPorts) > 0 {
- fmt.Printf("%+v\n", out)
- }
- wg.Done()
- }(i, &wg)
- }
- wg.Wait()
- }
- }
|