-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathRareNameBot.cs
237 lines (222 loc) · 11.8 KB
/
RareNameBot.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
using Newtonsoft.Json;
using System;
using System.IO;
using System.Linq;
using System.Net.Http;
namespace robloxnamebot
{
class Program
{
static void Main(string[] args)
{
Console.Title = "ROBLOX RARE NAME BOT (By Luca Denhez)";
Console.ForegroundColor = ConsoleColor.DarkRed;
string title = @"
██████╗ ██████╗ ██████╗ ██╗ ██████╗ ██╗ ██╗
██╔══██╗██╔═══██╗██╔══██╗██║ ██╔═══██╗╚██╗██╔╝
██████╔╝██║ ██║██████╔╝██║ ██║ ██║ ╚███╔╝
██╔══██╗██║ ██║██╔══██╗██║ ██║ ██║ ██╔██╗
██║ ██║╚██████╔╝██████╔╝███████╗╚██████╔╝██╔╝ ██╗
By: Luca Denhez ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝
██████╗ █████╗ ██████╗ ███████╗ ███╗ ██╗ █████╗ ███╗ ███╗███████╗ ██████╗ ██████╗ ████████╗
██╔══██╗██╔══██╗██╔══██╗██╔════╝ ████╗ ██║██╔══██╗████╗ ████║██╔════╝ ██╔══██╗██╔═══██╗╚══██╔══╝
██████╔╝███████║██████╔╝█████╗ ██╔██╗ ██║███████║██╔████╔██║█████╗ ██████╔╝██║ ██║ ██║
██╔══██╗██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██╔══██║██║╚██╔╝██║██╔══╝ ██╔══██╗██║ ██║ ██║
██║ ██║██║ ██║██║ ██║███████╗ ██║ ╚████║██║ ██║██║ ╚═╝ ██║███████╗ ██████╔╝╚██████╔╝ ██║
╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝ ╚═════╝ ╚═════╝ ╚═╝
";
Console.WriteLine(title);
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" How many web requests do you want to send? (Max 1000) ");
int tries;
try
{
Console.ForegroundColor = ConsoleColor.Cyan;
tries = Convert.ToInt32(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
}
catch (Exception ex)
{
Console.WriteLine("\n Sorry, exception occured:\n");
Console.WriteLine(ex);
tries = 1001;
}
while (tries > 1000)
{
Console.WriteLine("\n Sorry, cannot send more then 1,000 webrequests to prevent bandwith use. ");
Console.WriteLine("");
try
{
Console.ForegroundColor = ConsoleColor.Cyan;
tries = Convert.ToInt32(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
}
catch (Exception ex)
{
Console.WriteLine("\n Sorry, exception occured:\n");
Console.WriteLine(ex);
}
}
Console.Write("\n How many digits should the name be? ");
int length;
try
{
Console.ForegroundColor = ConsoleColor.Green;
length = Convert.ToInt32(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
if (length < 5)
{
Console.WriteLine("\n Sorry, minimum username length is 5. (All 4 and under are taken) ");
}
else if (length > 20)
{
Console.WriteLine("\n Sorry, maximum username length is 20. ");
}
else { }
}
catch (Exception ex)
{
Console.WriteLine("\nSorry, exception occured:\n");
Console.WriteLine(ex);
length = 4;
}
while (length < 5 || length > 20)
{
try
{
Console.ForegroundColor = ConsoleColor.Green;
length = Convert.ToInt32(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
}
catch(Exception ex)
{
Console.WriteLine("\nSorry, exception occured:\n");
Console.WriteLine(ex);
length = 4;
}
if (length < 5)
{
Console.WriteLine("\n Sorry, minimum username length is 5. (All 4 and under are taken) ");
}
else if (length > 20)
{
Console.WriteLine("\n Sorry, maximum username length is 20. ");
}
else { }
}
// This section was giving me issues
char mode;
Console.WriteLine("\n Would you like to continue or stop when you find an available name? (c/s) \n");
try
{
Console.ForegroundColor = ConsoleColor.Red;
mode = Convert.ToChar(Console.ReadLine());
Console.ForegroundColor = ConsoleColor.White;
}
catch (Exception ex)
{
Console.WriteLine("\nSorry, exception occured:\n");
Console.WriteLine(ex);
mode = 'z';
}
if (mode == 'c')
{
Console.WriteLine(@"\n Continue mode selected. Each username found will be saved to a .txt file in the 'C:\roblox' directory... ");
if (Directory.Exists(@"C:\roblox")) { }
else
{
Directory.CreateDirectory(@"C:\roblox");
}
if (File.Exists(@"C:\roblox\usernames.txt"))
{
File.Delete(@"C:\roblox\usernames.txt");
}
else
{
File.CreateText(@"C:\roblox\usernames.txt");
}
StreamWriter file = new StreamWriter(@"C:\roblox\usernames.txt");
file.WriteLine("Valid usernames: \n");
Console.Clear();
for (int i = 0; i < tries; i++)
{
string name = generateName(length);
int code = makeWebRequest(name);
if (code == 0)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(" Valid!");
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" | Username: ");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(name);
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\n");
file.WriteLine(name);
}
else if (code == 1)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(" Taken.. ");
Console.ForegroundColor = ConsoleColor.White;
}
else if (code == 2 || code == 4 || code == 5)
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine(" Regenerating.. ");
Console.ForegroundColor = ConsoleColor.White;
while (name.IndexOf('_') == 0 && name.IndexOf('_') == 4)
{
name = generateName(length);
}
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(" Valid!");
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" | Username: ");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(name);
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\n");
file.WriteLine(name);
}
else
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.Write(" Error, Retrying...\n");
Console.ForegroundColor = ConsoleColor.White;
}
}
Console.ForegroundColor = ConsoleColor.Red;
Console.Write("\n " + tries);
Console.ForegroundColor = ConsoleColor.White;
Console.Write(" name searches completed! All valid usernames can be found in 'C:\\roblox\\usernames.txt'\n");
file.Close();
Console.ReadLine();
}
else if (mode == 's')
{
Console.WriteLine("\n Sorry, stop mode has not been coded yet. Please select continue mode instead. ");
}
else
{
Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("\nSorry, mode has to be either 'c' or 's'.");
}
}
static string generateName(int length)
{
Random random = new Random();
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";
return new string(Enumerable.Repeat(chars, length)
.Select(s => s[random.Next(s.Length)]).ToArray());
}
static int makeWebRequest(string name)
{
HttpClient request = new HttpClient();
HttpResponseMessage response = request.GetAsync("https://auth.roblox.com/v1/usernames/validate?request.username=" + name + "&request.birthday=10.20.1999&request.context=Unknown").Result;
string responseString = response.Content.ReadAsStringAsync().Result;
dynamic responseJson = JsonConvert.DeserializeObject(responseString);
return Convert.ToInt32(responseJson.code);
}
}
}