-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
66 lines (54 loc) · 1.46 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
//Dependencies
const Axios = require("axios")
const Fs = require("fs")
//Variables
const Self_Args = process.argv.slice(2)
//Main
if(!Self_Args.length){
console.log("node index.js <input> <output>")
process.exit()
}
if(!Fs.existsSync(Self_Args[0])){
console.log("Invalid input.")
process.exit()
}
if(!Self_Args[1]){
console.log("Invalid output.")
process.exit()
}
const file_data = Fs.readFileSync(Self_Args[0], "utf8").split("\n")
if(!file_data.length){
console.log("Input data is empty.")
process.exit()
}
var results = []
var token_index = 0
Check()
async function Check(){
if(token_index === file_data.length){
if(!results.length){
console.log("No valid tokens found.")
process.exit()
}
console.log(`${results.length} valid tokens found.`)
console.log(`Saving the results to ${Self_Args[1]}`)
Fs.writeFileSync(Self_Args[1], results.join("\n"), "utf8")
console.log(`Results successfully saved to ${Self_Args[1]}`)
process.exit()
}
try{
await Axios({
method: "GET",
url: "https://discord.com/api/v8/users/@me",
headers: {
authorization: file_data[token_index]
}
})
console.log(`Valid token ${file_data[token_index]}`)
results.push(file_data[i])
}catch{
console.log(`Invalid token ${file_data[token_index]}`)
}
token_index++
Check()
}