Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2024
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "os"
  6. "strconv"
  7. "bufio"
  8. docopt "github.com/docopt/docopt.go"
  9. "github.com/luc10/zykgen"
  10. )
  11.  
  12. func replaceAtIndex(in string, r rune, i int) string {
  13. out := []rune(in)
  14. out[i] = r
  15. return string(out)
  16. }
  17.  
  18. const usage = `Zyxel VMG8823-B50B WPA Keygen
  19.  
  20. Usage:
  21. zykgen (-m|-n|-c) [-l <length> -L <letter>] <startserial> <endserial>
  22. zykgen -h | --help
  23.  
  24. Options:
  25. -l <length> Output key length [default: 10].
  26. -L <letter> Fifth letter of the serial [default: V].
  27. -h --help Show this screen.`
  28.  
  29. func main() {
  30. var cocktail zykgen.Cocktail
  31. var seriale string
  32.  
  33. var args struct {
  34. Sserial string `docopt:"<startserial>"`
  35. Eserial string `docopt:"<endserial>"`
  36.  
  37. Letter string `docopt:"-L"`
  38. Length int `docopt:"-l"`
  39. Mojito bool `docopt:"-m"`
  40. Negroni bool `docopt:"-n"`
  41. Cosmopolitan bool `docopt:"-c"`
  42. }
  43.  
  44. opts, err := docopt.DefaultParser.ParseArgs(usage, os.Args[1:], "")
  45. if err != nil {
  46. return
  47. }
  48.  
  49. opts.Bind(&args)
  50. if args.Mojito {
  51. cocktail = zykgen.Mojito
  52. }
  53. if args.Negroni {
  54. cocktail = zykgen.Negroni
  55. }
  56. if args.Cosmopolitan {
  57. cocktail = zykgen.Cosmopolitan
  58. }
  59.  
  60. start, err := strconv.Atoi(args.Sserial)
  61. if err != nil {
  62. fmt.Println(err)
  63. fmt.Println("Serial number should be 12 chars long, (exluding the first char which is 'S'),should contain only numbers, letter 'V' is automatically added")
  64. return
  65. }
  66.  
  67. end, err := strconv.Atoi(args.Eserial)
  68. if err != nil {
  69. fmt.Println(err)
  70. fmt.Println("Serial number should be 12 chars long, (exluding the first char which is 'S'),should contain only numbers, letter 'V' is automatically added")
  71. return
  72. }
  73.  
  74. if start > end {
  75. fmt.Println("End of the serial should be at least > start of the serial")
  76. return
  77. }
  78.  
  79. if len(args.Sserial) != 12 {
  80. fmt.Println("Serial number should be 12 chars long, (exluding the first char which is 'S'),should contain only numbers, letter 'V' is automatically added ")
  81. return
  82. }
  83.  
  84. if len(args.Eserial) != 12 {
  85. fmt.Println("Serial number should be 12 chars long, (exluding the first char which is 'S'),should contain only numbers, letter 'V' is automatically added ")
  86. return
  87. }
  88.  
  89. f, err := os.Create("wpa_keys_" + args.Sserial + "_" + args.Eserial + "_" + strconv.Itoa(args.Length) + "_" + args.Letter + "_c.txt")
  90. if err != nil {
  91. fmt.Println(err)
  92. return
  93. }
  94.  
  95. writer := bufio.NewWriter(f)
  96. defer writer.Flush()
  97.  
  98. for i := start; i < end; i++ {
  99.  
  100. seriale = fmt.Sprintf("%12d", i)
  101. seriale = "S" + replaceAtIndex(seriale, []rune(args.Letter)[0], 3)
  102. _, err := writer.WriteString(zykgen.Wpa(seriale, args.Length, cocktail) + "\n")
  103. if err != nil {
  104. fmt.Println(err)
  105. f.Close()
  106. return
  107. }
  108.  
  109. }
  110.  
  111. fmt.Println("Dictionary of keys was created on the root directory!, now use Hashcat.")
  112.  
  113. err = f.Close()
  114. if err != nil {
  115. fmt.Println(err)
  116. return
  117. }
  118.  
  119. }
  120.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement