feat(go): port memory-map detector tranche
This commit is contained in:
parent
c6f7219de8
commit
6a27e6e770
13 changed files with 377 additions and 41 deletions
|
|
@ -44,19 +44,27 @@ var defaultStealthNetworkAllowComms = []string{
|
|||
"tcpdump", "dumpcap", "wireshark", "suricata", "zeek",
|
||||
}
|
||||
|
||||
var defaultMemoryObfuscationAllowComms = []string{
|
||||
"java", "node", "firefox", "chromium", "chrome", "google-chrome",
|
||||
"brave", "brave-browser", "WebKitWebProcess", "dotnet", "qemu-system-x86",
|
||||
"qemu-system-x86_64", "wine", "wasmtime",
|
||||
}
|
||||
|
||||
// Config mirrors the Phase 1 settings consumed by the Go sweep loop. More
|
||||
// fields are added as their detectors are ported.
|
||||
type Config struct {
|
||||
SampleInterval time.Duration
|
||||
HeartbeatMaxAge int
|
||||
Detectors map[string]bool
|
||||
InputSnooperAllowComms map[string]bool
|
||||
CredentialAccessAllowComms map[string]bool
|
||||
CredentialAccessExtraPaths []string
|
||||
Interpreters map[string]bool
|
||||
EgressAllowCIDRs []string
|
||||
StealthNetworkAllowComms map[string]bool
|
||||
StealthNetworkAllowKinds map[string]bool
|
||||
SampleInterval time.Duration
|
||||
HeartbeatMaxAge int
|
||||
Detectors map[string]bool
|
||||
InputSnooperAllowComms map[string]bool
|
||||
CredentialAccessAllowComms map[string]bool
|
||||
CredentialAccessExtraPaths []string
|
||||
Interpreters map[string]bool
|
||||
EgressAllowCIDRs []string
|
||||
StealthNetworkAllowComms map[string]bool
|
||||
StealthNetworkAllowKinds map[string]bool
|
||||
MemoryObfuscationAllowComms map[string]bool
|
||||
MemoryObfuscationAllowPaths []string
|
||||
}
|
||||
|
||||
// Default returns Python-compatible defaults for the fields currently used.
|
||||
|
|
@ -66,16 +74,18 @@ func Default() Config {
|
|||
detectors[name] = true
|
||||
}
|
||||
return Config{
|
||||
SampleInterval: 4 * time.Second,
|
||||
HeartbeatMaxAge: 120,
|
||||
Detectors: detectors,
|
||||
InputSnooperAllowComms: stringSet(defaultInputSnooperAllowComms),
|
||||
CredentialAccessAllowComms: stringSet(defaultCredentialAccessAllowComms),
|
||||
CredentialAccessExtraPaths: []string{},
|
||||
Interpreters: stringSet(defaultInterpreters),
|
||||
EgressAllowCIDRs: []string{},
|
||||
StealthNetworkAllowComms: stringSet(defaultStealthNetworkAllowComms),
|
||||
StealthNetworkAllowKinds: map[string]bool{},
|
||||
SampleInterval: 4 * time.Second,
|
||||
HeartbeatMaxAge: 120,
|
||||
Detectors: detectors,
|
||||
InputSnooperAllowComms: stringSet(defaultInputSnooperAllowComms),
|
||||
CredentialAccessAllowComms: stringSet(defaultCredentialAccessAllowComms),
|
||||
CredentialAccessExtraPaths: []string{},
|
||||
Interpreters: stringSet(defaultInterpreters),
|
||||
EgressAllowCIDRs: []string{},
|
||||
StealthNetworkAllowComms: stringSet(defaultStealthNetworkAllowComms),
|
||||
StealthNetworkAllowKinds: map[string]bool{},
|
||||
MemoryObfuscationAllowComms: stringSet(defaultMemoryObfuscationAllowComms),
|
||||
MemoryObfuscationAllowPaths: []string{},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +183,18 @@ func Load(path string) (Config, error) {
|
|||
return Config{}, fmt.Errorf("stealth_network_allow_kinds: %w", err)
|
||||
}
|
||||
cfg.StealthNetworkAllowKinds = stringSet(kinds)
|
||||
case "memory_obfuscation_allow_comms":
|
||||
comms, err := stringArray(value)
|
||||
if err != nil {
|
||||
return Config{}, fmt.Errorf("memory_obfuscation_allow_comms: %w", err)
|
||||
}
|
||||
cfg.MemoryObfuscationAllowComms = stringSet(comms)
|
||||
case "memory_obfuscation_allow_paths":
|
||||
paths, err := stringArray(value)
|
||||
if err != nil {
|
||||
return Config{}, fmt.Errorf("memory_obfuscation_allow_paths: %w", err)
|
||||
}
|
||||
cfg.MemoryObfuscationAllowPaths = paths
|
||||
}
|
||||
}
|
||||
return cfg, nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue