Some checks failed
CI Docker Mining Proof / Linux agent hashrate proof (push) Has been cancelled
98 lines
2.2 KiB
Go
98 lines
2.2 KiB
Go
package atlas
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"crypto-miner-server/internal/strategy"
|
|
)
|
|
|
|
// ProbeSnapshot mirrors live environment probes used for atlas matching.
|
|
type ProbeSnapshot struct {
|
|
Docker bool
|
|
WSL bool
|
|
PowerShell bool
|
|
DotNet bool
|
|
GPU bool
|
|
AVBlocksExe bool
|
|
DefenderOn bool
|
|
DefenderRTP bool
|
|
}
|
|
|
|
// ExtractConditions returns active negative-space condition tags for a host snapshot.
|
|
func ExtractConditions(fp strategy.HostFingerprint, probes ProbeSnapshot) []string {
|
|
var out []string
|
|
switch strings.ToLower(fp.GOOS) {
|
|
case "windows":
|
|
out = append(out, ConditionGOOSWindows)
|
|
case "linux":
|
|
out = append(out, ConditionGOOSLinux)
|
|
case "darwin":
|
|
out = append(out, ConditionGOOSDarwin)
|
|
}
|
|
if probes.DefenderOn || probes.DefenderRTP || fp.AVBlocks {
|
|
out = append(out, ConditionDefenderOn)
|
|
}
|
|
if probes.AVBlocksExe || fp.AVBlocks {
|
|
out = append(out, ConditionAVBlocksExe)
|
|
}
|
|
if !probes.Docker && !fp.Docker {
|
|
out = append(out, ConditionNoDocker)
|
|
}
|
|
if !probes.WSL && !fp.WSL {
|
|
out = append(out, ConditionNoWSL)
|
|
}
|
|
if !probes.PowerShell {
|
|
out = append(out, ConditionNoPowerShell)
|
|
}
|
|
if !probes.DotNet {
|
|
out = append(out, ConditionNoDotNet)
|
|
}
|
|
if !probes.GPU && !fp.GPU {
|
|
out = append(out, ConditionNoGPU)
|
|
}
|
|
return out
|
|
}
|
|
|
|
// ProbeSnapshotFromMaps builds a probe snapshot from stats / auth telemetry.
|
|
func ProbeSnapshotFromMaps(
|
|
fp strategy.HostFingerprint,
|
|
probes map[string]bool,
|
|
defenderEnabled, defenderRTP *bool,
|
|
) ProbeSnapshot {
|
|
snap := ProbeSnapshot{
|
|
Docker: fp.Docker,
|
|
WSL: fp.WSL,
|
|
GPU: fp.GPU,
|
|
AVBlocksExe: fp.AVBlocks,
|
|
}
|
|
if probes != nil {
|
|
if v, ok := probes["docker"]; ok {
|
|
snap.Docker = v
|
|
}
|
|
if v, ok := probes["wsl"]; ok {
|
|
snap.WSL = v
|
|
}
|
|
if v, ok := probes["gpu"]; ok {
|
|
snap.GPU = v
|
|
}
|
|
if v, ok := probes["av_blocks_exe"]; ok {
|
|
snap.AVBlocksExe = v
|
|
}
|
|
if v, ok := probes["pwsh"]; ok {
|
|
snap.PowerShell = v
|
|
}
|
|
if v, ok := probes["dotnet"]; ok {
|
|
snap.DotNet = v
|
|
}
|
|
}
|
|
if defenderRTP != nil && *defenderRTP {
|
|
snap.DefenderRTP = true
|
|
snap.DefenderOn = true
|
|
snap.AVBlocksExe = true
|
|
}
|
|
if defenderEnabled != nil && *defenderEnabled {
|
|
snap.DefenderOn = true
|
|
}
|
|
return snap
|
|
}
|