This repository was archived by the owner on Mar 19, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToken.js
86 lines (74 loc) · 3.11 KB
/
Token.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
const { spawn } = require('child_process')
const fs = require('fs')
const path = require('../config').pathToDiscord
const debug = require('../config').debug
var errored = false
module.exports = async () => {
const list = await require('find-process')("name", "Discord", true)
if (list.length > 0) {
console.log("\nDiscord Exporters - YOU MUST CLOSE DISCORD BEFORE USING THIS SCRIPT")
process.exit(1)
}
try {
fs.unlinkSync("./leveldb.dat")
} catch (e) {
if (debug) {
console.log(`Could not delete leveldb: ${e}`)
}
}
if (process.platform == "darwin" || process.platform == "linux") {
try {
//path ? spawn(`${process.cwd()}/utils/leveldb_reader`, [path]) : spawn("", [""])
errored = true
console.log("Linux is not yet supported (and may never be)")
} catch (e) {
errored = true
console.log("Could not find your discord leveldb path automatically, please write it in config.js!")
}
} else if (process.platform == "win32") {
try {
path ? spawn(`${process.cwd()}/utils/leveldb_reader.exe`, [path]) : spawn(`${process.cwd()}/utils/leveldb_reader.exe`, [`C:/Users/${require('os').userInfo().username}/AppData/Roaming/discord/Local Storage/leveldb`])
} catch (e) {
errored = true
console.log("Could not find your discord leveldb path automatically, please write it in config.js!")
}
}
if (!errored) {
const reMatch = /\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}( )*"_https:\/\/discord\.com(.)*token":(.){0,2}"([A-Za-z\d]{24}\.[\w-]{6}\.[\w-]{27})?(mfa\.[A-Za-z\d-_]{84})?"/
const reReplace = /\d{4}\/\d{2}\/\d{2} \d{2}:\d{2}:\d{2}( )*"_https:\/\/discord\.com(.)*token":(.){0,2}"/
var found = false
await require('../utils/sleep')(1000)
var lineReader = require('readline').createInterface({
input: fs.createReadStream(require('path').join(__dirname, "../leveldb.dat"))
})
lineReader.on("error", (err) => console.log(err))
lineReader.on("line", (line) => {
const end = reMatch.exec(line)
if (end && !found) {
found = true
line = line.replace(reReplace, "").replace("\"", "")
const token = line
console.log(`TOKEN found: ${token}\nWrite it in the config.js!\nThis message will be cleared in 10 seconds..`)
setTimeout(() => {
console.clear()
try {
fs.unlinkSync("./leveldb.dat")
} catch (e) {
if (debug) {
console.log(`Could not delete leveldb: ${e}`)
}
}
}, 10000)
}
})
} else {
await require('../utils/sleep')(1000)
try {
fs.unlinkSync("./leveldb.dat")
} catch (e) {
if (debug) {
console.log(`Could not delete leveldb: ${e}`)
}
}
}
}