· 7 years ago · Apr 13, 2019, 07:20 PM
1package generator;
2
3import java.util.Random;
4
5public class Main {
6
7 String AlphaNumericString = "0123456789" + "abcdefghijklmnopqrstuvxyz" + "_";
8 static int passLength = 8;
9 static int emailLength = 12;
10
11 public static void main(String[] args) {
12
13
14 int firstArg;
15 if (args.length == 1) {
16
17 System.out.println(System.lineSeparator());
18 System.out.println(System.lineSeparator());
19 System.out.println(System.lineSeparator());
20 System.out.println(System.lineSeparator());
21 System.out.println(System.lineSeparator());
22 System.out.println(System.lineSeparator());
23 System.out.println(System.lineSeparator());
24
25 try {
26 firstArg = Integer.parseInt(args[0]);
27
28 for (int i = 0; i < firstArg; i++) {
29 // System.out.println(i);
30 String u = genEmail();
31 String p = genPass();
32 System.out.println(u + ":" + p);
33
34 }
35
36 } catch (NumberFormatException e) {
37 System.err.println("Argument" + args[0] + " must be an integer.");
38 System.out.println("You need to enter an amount of accounts retard");
39 System.exit(1);
40 }
41 }
42
43 }
44
45 static String genEmail() {
46 String SALTCHARS = "abcdefghijklmnopqrstuvwzyz_1234567890";
47 StringBuilder salt = new StringBuilder();
48 Random rnd = new Random();
49 while (salt.length() < emailLength) { // length of the random string.
50 int index = (int) (rnd.nextFloat() * SALTCHARS.length());
51 salt.append(SALTCHARS.charAt(index));
52 }
53 String saltStr = salt.toString();
54
55 String done = saltStr + "@gmail.com";
56 return done;
57 }
58
59 static String genPass() {
60 String SALTCHARS = "abcdefghijklmnopqrstuvwzyz1234567890";
61 StringBuilder salt = new StringBuilder();
62 Random rnd = new Random();
63 while (salt.length() < passLength) { // length of the random string.
64 int index = (int) (rnd.nextFloat() * SALTCHARS.length());
65 salt.append(SALTCHARS.charAt(index));
66 }
67 String saltStr = salt.toString();
68
69 return saltStr;
70 }
71
72}