-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathindex.js
71 lines (66 loc) · 2.8 KB
/
index.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
const request = require('request');
const colors = require('colors');
const chalk = require('chalk');
const fs = require('fs');
const proxies = fs.readFileSync('proxies.txt', 'utf-8').replace(/\r/gi, '').split('\n');
const tokens = [...new Set(require('fs').readFileSync('tokens.txt', 'utf-8').replace(/\r/g, '').split('\n'))];
process.on('uncaughtException', e => {});
process.on('uncaughtRejection', e => {});
process.warn = () => {};
var working = 0;
var locked = 0;
var invalid = 0;
var rate = 0;
function clear(file) {
var stream = fs.createWriteStream(file);
stream.once('open', function(fd) {
stream.write("");
stream.end();
});
}
console.log(`Clearing token files.`.inverse);
clear("tokens/working.txt");
clear("tokens/invalid.txt");
clear("tokens/locked.txt");
function write(content, file) {
fs.appendFile(file, content, function(err) {
});
}
function check(token) {
var proxy = proxies[Math.floor(Math.random() * proxies.length)];
request({
method: "GET",
url: 'https://discordapp.com/api/v6/users/@me/guilds',
proxy: 'http://' + proxy,
'timeout': 2500,
json: true,
headers: {
"Content-Type": "application/json",
authorization: token,
'timeout': 2500
}
}, (err, res, body) => {
if (res && res.statusCode === 200) {
working++;
console.log(chalk.green("[%s] (%s/%s/%s) [Working] Token: %s | Proxy: %s"), res.statusCode, working, checked, tokens.length, token, proxy);
write(token + "\n", "tokens/working.txt");
} else if (res && res.statusCode === 403) {
locked++;
console.log(chalk.yellow("[%s] (%s/%s/%s) [Locked] Token: %s | Proxy: %s"), res.statusCode, locked, checked, tokens.length, token, proxy);
write(token + "\n", "tokens/locked.txt");
} else if (res && res.statusCode === 401) {
invalid++;
console.log(chalk.red("[%s] (%s/%s/%s) [Invalid] Token: %s | Proxy: %s"), res.statusCode, invalid, checked, tokens.length, token, proxy);
write(token + "\n", "tokens/invalid.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(token);
}
checked = working + invalid + locked;
process.title = `[Token Checker] - ${checked}/${tokens.length} Total Checked | ${working} Working | ${invalid} Invalid | ${locked} Locked | ${rate} Rate Limited`;
});
}
console.log(`[Token Checker]: Started!`.inverse);
console.log(`[Checking %s Tokens with %s Proxies!]`.inverse, tokens.length, proxies.length);
for (var i in tokens) check(tokens[i]);