ZeroTrace HID
OS Detection
Identify the host OS and branch payloads accordingly
The firmware fingerprints the target host's OS and exposes the result through the script variable _@detectedOS. Detection runs in its own task shortly after USB enumeration.
Possible values
_@detectedOS resolves to one of:
Windows Linux macOS iOS Android
Unknown OS OS Detection Disabled Waiting...
_@ variables are lowercased when expanded, so _@detectedOS yields windows, macos, unknown os, os detection disabled, and so on. Always compare against lowercase strings.
Use in scripts
Capture the state into a variable, then branch on it. IF now expands both operands, so quote and interpolate the variable:
_$VAR os = "_@detectedOS"
IF "${os}$" is "windows"
comboKey 'win+r'
delay 500
writeLn 'cmd'
IF_END
IF "${os}$" is "macos"
comboKey 'gui+space'
delay 500
writeLn 'Terminal'
key 'enter'
IF_END
The terminal '<os>' primitive wraps this pattern for the common case — e.g. terminal 'windows' powershell, terminal 'mac', terminal 'linux'.
Reliability
Detection is heuristic, not authoritative. Heavily customized images (single-app Linux kiosks, MDM-locked macOS) can return Unknown OS. When the branch matters, validate against an image of the target before deployment.