diff --git a/bin/gaynoise_freebsd_amd64 b/bin/gaynoise_freebsd_amd64 deleted file mode 100755 index a6ca86c..0000000 Binary files a/bin/gaynoise_freebsd_amd64 and /dev/null differ diff --git a/bin/gaynoise_freebsd_arm64 b/bin/gaynoise_freebsd_arm64 deleted file mode 100755 index 57b36f1..0000000 Binary files a/bin/gaynoise_freebsd_arm64 and /dev/null differ diff --git a/bin/gaynoise_linux_amd64 b/bin/gaynoise_linux_amd64 deleted file mode 100755 index ab8040c..0000000 Binary files a/bin/gaynoise_linux_amd64 and /dev/null differ diff --git a/bin/gaynoise_linux_arm64 b/bin/gaynoise_linux_arm64 deleted file mode 100755 index 0fbdc59..0000000 Binary files a/bin/gaynoise_linux_arm64 and /dev/null differ diff --git a/bin/gaynoise_linux_mips b/bin/gaynoise_linux_mips deleted file mode 100755 index 4513da6..0000000 Binary files a/bin/gaynoise_linux_mips and /dev/null differ diff --git a/main.go b/main.go index 1f7a42f..5836bac 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ package main import ( + "bufio" "encoding/binary" "flag" "fmt" @@ -8,6 +9,7 @@ import ( "net" "os" "os/signal" + "strings" "syscall" "time" @@ -17,10 +19,11 @@ import ( var ( // flags - cidr = flag.String("r", "", "cidr to target") - duration = flag.Int("t", -1, "duration (seconds)") - workers = flag.Int("c", 10, "threads") - delay = flag.Int("u", 0, "usec delay between sends") + cidr = flag.String("r", "", "") + targlist = flag.String("l", "", "") + duration = flag.Int("t", -1, "") + workers = flag.Int("c", 10, "") + delay = flag.Int("u", 0, "") // colors colorReset = "\033[0m" @@ -30,7 +33,7 @@ var ( skull = "\u2620" // target ports - ports = []int{21, 22, 23, 80, 123, 389, 443} + ports = []int{21, 22, 23, 25, 53, 80, 81, 123, 389, 443, 445, 999, 1080, 1433, 2323, 5555, 5900, 7547, 8080, 8081, 8888} ) func winsize(system int) uint16 { @@ -192,7 +195,7 @@ func randIP() string { func thread(addrs chan string) { sock, err := rawsocket() if err != nil { - fatal(err) + fatal(err.Error()) } defer syscall.Close(sock) for addr := range addrs { @@ -249,7 +252,7 @@ func banner() { %s%sg a y n o i s e%s -sincerely, + sincerely, ~ delorean `, colorRed, colorReset, colorCyan, colorReset, colorPurple, colorReset) @@ -258,13 +261,14 @@ sincerely, func usage() { fmt.Fprintf(os.Stderr, `gaynoise: (%s-r%s) - cidr range [%s0.0.0.0/0%s] + (%s-l%s) - target cidr list (%s-c%s) - concurrent threads [%s100%s] (%s-t%s) - duration [%s-1%s] (%s-p%s) - usec delay between sends [%s0%s] -`, colorCyan, colorReset, colorPurple, colorReset, colorCyan, colorReset, colorPurple, colorReset, colorCyan, colorReset, colorPurple, colorReset, colorCyan, colorReset, colorPurple, colorReset) +`, colorCyan, colorReset, colorPurple, colorReset, colorCyan, colorReset, colorCyan, colorReset, colorPurple, colorReset, colorCyan, colorReset, colorPurple, colorReset, colorCyan, colorReset, colorPurple, colorReset) } -func fatal(e error) { +func fatal(e string) { fmt.Printf("%s %s error:%s %s\n", colorRed, skull, colorReset, e) os.Exit(-1) } @@ -274,15 +278,42 @@ func alarm(secs int) { os.Exit(0) } +func parsetargets(list string) []string { + fd, err := os.Open(list) + if err != nil { + fatal(err.Error()) + } + defer fd.Close() + + var targets []string + + fs := bufio.NewScanner(fd) + for fs.Scan() { + line := strings.TrimSpace(fs.Text()) + if len(line) > 0 { + if _, _, err := net.ParseCIDR(line); err == nil { + targets = append(targets, line) + } + } + } + + if len(targets) == 0 { + fatal("no valid ranges parsed from file") + } + return targets +} + func main() { flag.Usage = usage flag.Parse() - var target string - if *cidr == "" { - target = "0.0.0.0/0" + var targets []string + if *targlist != "" { + targets = parsetargets(*targlist) + } else if *cidr == "" { + targets = []string{"0.0.0.0/0"} } else { - target = *cidr + targets = []string{*cidr} } // signals @@ -310,8 +341,10 @@ func main() { banner() for { - if e := runCIDR(target, addrs); e != nil { - fatal(e) + for _, target := range targets { + if err := runCIDR(target, addrs); err != nil { + fatal(err.Error()) + } } } }