-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecker.js
215 lines (185 loc) · 7.01 KB
/
checker.js
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
const request = require('request');
const chalk = require('chalk');
const prompt = require('prompt');
const fs = require('fs');
const proxies = fs.readFileSync('proxies.txt', 'utf-8').replace(/\r/gi, '').split('\n');
const usernames = [...new Set(require('fs').readFileSync('usernames.txt', 'utf-8').replace(/\r/g, '').split('\n'))];
const ProxyAgent = require('proxy-agent');
const cheerio = require('cheerio');
const dateFormat = require('dateformat');
process.on('uncaughtException', e => {});
process.on('uncaughtRejection', e => {});
process.on('UnhandledPromiseRejectionWarning', e => {});
process.warn = () => {};
console.warn = function() {};
var available = 0;
var unavailable = 0;
var rate = 0;
var checked = 0;
function write(content, file) {
fs.appendFile(file, content, function(err) {
});
}
function getAgent(username, type , proxy){
try{
var agent = new ProxyAgent(`${type}://` + proxy);
return agent;
}catch{
function intervalFunc() {
pcheck(username)
setInterval(intervalFunc, 10);
}
}
}
function check(username,type) {
var proxy = proxies[Math.floor(Math.random() * proxies.length)];
let agent = getAgent(username, type , proxy);
request({
method: "GET",
url: `https://api.mojang.com/users/profiles/minecraft/${username}`,
agent,
'timeout': 2500,
json: true,
}, (err, res, body) => {
if (res && res.statusCode === 200) {
unavailable++;
console.log(chalk.red("[%s] (%s/%s/%s) [Not Available] Username: %s | Proxy: %s"), res.statusCode, available, checked, usernames.length, username, proxy);
write(username + "\n", "usernames/mojang_unavailable.txt");
}
else if (res && res.statusCode === 204) {
available++;
console.log(chalk.green(`[%s] (%s/%s/%s) [Available] Username: %s | Proxy: %s`), res.statusCode, available, checked, usernames.length, username, proxy);
write(username + "\n", "usernames/mojang_available.txt");
} else if (res && res.statusCode === 429) {
rate++;
console.log(chalk.red("[%s] (%s) Proxy: %s has been rate limited".inverse), res.statusCode, rate, proxy);
check(username);
}
else{
check(username);
}
checked = available + unavailable;
process.title = `[Minecraft Usernames Checker] - ${checked}/${usernames.length} Total Checked | ${available} Available | ${unavailable} Unavailable | ${rate} Rate Limited`;
});
}
function getAvailabilityTime(data) {
const $ = cheerio.load(data);
const timeSelector = 'time#availability-time';
if($(timeSelector).length) {
return `available at ${dateFormat($(timeSelector).attr('datetime'), 'mm/dd/yyyy')}`;
} else {
if (data.indexOf('Unavailable') > -1) {
return `unavailable`;
} else {
return 'available now';
}
}
}
function Availability(username,type) {
var proxy = proxies[Math.floor(Math.random() * proxies.length)];
let agent = getAgent(username, type , proxy);
request({
method: "GET",
url: `https://namemc.com/name/${username}`,
agent,
'timeout': 2500,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36',
}
}, (err, res, body) => {
if (res && res.statusCode === 200) {
var data = body;
var AvailabilityTime = getAvailabilityTime(data);
if(AvailabilityTime === "unavailable"){
unavailable++;
console.log(chalk.red("[%s] (%s/%s/%s) [Not Available] Username: %s | Proxy: %s"), res.statusCode, available, checked, usernames.length, username, proxy);
write(username + "\n", "usernames/namemc_unavailable.txt");
}
else{
available++;
console.log(chalk.green(`[%s] (%s/%s/%s) [Available] Username: %s | Availability: ${AvailabilityTime} | Proxy: %s`), res.statusCode, available, checked, usernames.length, username, proxy);
write(username + ` | Availability: ${AvailabilityTime}` + "\n", "usernames/namemc_available.txt");
}
}
else{
Availability(username);
}
checked = available + unavailable;
process.title = `[313][Minecraft Usernames Checker] - ${checked}/${usernames.length} Total Checked | ${available} Available | ${unavailable} Unavailable | ${rate} Rate Limited`;
})
}
//Program Startup
function printAsciiLogo() {
console.log(`
• ▌ ▄ ·. ▄▄· ▄▄· ▄ .▄▄▄▄ . ▄▄· ▄ •▄ ▄▄▄ .▄▄▄ ${chalk.green(" ▐▄▄▄.▄▄ · ")}
·██ ▐███▪▐█ ▌▪▐█ ▌▪██▪▐█▀▄.▀·▐█ ▌▪█▌▄▌▪▀▄.▀·▀▄ █· ${chalk.green(" ·██▐█ ▀. ")}
▐█ ▌▐▌▐█·██ ▄▄██ ▄▄██▀▐█▐▀▀▪▄██ ▄▄▐▀▀▄·▐▀▀▪▄▐▀▀▄ ${chalk.green("▪▄ ██▄▀▀▀█▄ ")}
██ ██▌▐█▌▐███▌▐███▌██▌▐▀▐█▄▄▌▐███▌▐█.█▌▐█▄▄▌▐█•█▌ ${chalk.green("▐▌▐█▌▐█▄▪▐█ ")}
▀▀ █▪▀▀▀·▀▀▀ ·▀▀▀ ▀▀▀ · ▀▀▀ ·▀▀▀ ·▀ ▀ ▀▀▀ .▀ ▀ ${chalk.green(" ▀▀▀• ▀▀▀▀ ")}
[Coded By Luci]
`);
}
printAsciiLogo();
process.title = `[313][Minecraft Usernames Checker] Created By Luci`;
console.log(chalk.inverse("[1] Mojang API Checker (Proxies) [No Date]"));
console.log(chalk.inverse("[2] NameMC Checker (Proxies)"));
prompt.start();
console.log("");
prompt.get(['options'], function(err, result) {
console.log('');
var options = result.options;
switch(options) {
case "1":
console.log(chalk.inverse("[INFO] Press Corrosponding Number to Select Proxy Type! "));
console.log(`[1] https
[2] socks4
[3] socks5`);
prompt.get(['type'], function(err, result) {
console.log('');
var type = result.type;
switch(type) {
case "1":
var type = "http";
break
case "2":
var type = "socks4";
break
case "3":
var type = "socks5";
break
default:
var type = "http";
break
}
console.log(chalk.inverse(`[Minecraft Username Checker]: Started!`));
console.log(chalk.inverse(`[Checking ${usernames.length} Usernames with ${proxies.length} Proxies!]`));
for (var i in usernames) check(usernames[i],type);
})
break;
case "2":
console.log(chalk.inverse("[INFO] Press Corrosponding Number to Select Proxy Type! "));
console.log(`[1] https
[2] socks4
[3] socks5`);
prompt.get(['type'], function(err, result) {
console.log('');
var type = result.type;
switch(type) {
case "1":
var type = "http";
break
case "2":
var type = "socks4";
break
case "3":
var type = "socks5";
break
default:
var type = "http";
break
}
for (var i in usernames) Availability(usernames[i],type);
})
break;
}
})