shadow1ng/fscan · warning

unsupported_platform

Error message

unsupported_platform

What it means

Guard in SystemdServicePlugin.Scan: the plugin's persistence technique (creating systemd services) only works on Linux, but runtime.GOOS reported a different platform. The scan aborts before touching the filesystem and reports the unsupported OS alongside the linux-only notice.

Source

Thrown at plugins/local/systemdservice.go:45

// NewSystemdServicePlugin 创建系统服务持久化插件
func NewSystemdServicePlugin() *SystemdServicePlugin {
	return &SystemdServicePlugin{
		BasePlugin: plugins.NewBasePlugin("systemdservice"),
	}
}

// Scan 执行系统服务持久化 - 直接实现
func (p *SystemdServicePlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {
	config := session.Config
	var output strings.Builder

	if runtime.GOOS != "linux" {
		output.WriteString(i18n.GetText("systemdservice_linux_only") + "\n")
		return &plugins.Result{
			Success: false,
			Output:  output.String(),
			Error:   fmt.Errorf("%s", i18n.Tr("unsupported_platform", runtime.GOOS)),
		}
	}

	// 从config获取配置
	targetFile := config.PersistenceTargetFile
	if targetFile == "" {
		output.WriteString(i18n.GetText("persistence_file_required") + "\n")
		return &plugins.Result{
			Success: false,
			Output:  output.String(),
			Error:   fmt.Errorf("%s", i18n.GetText("target_file_not_specified")),
		}
	}

	// 检查目标文件是否存在
	if _, err := os.Stat(targetFile); os.IsNotExist(err) {
		output.WriteString(i18n.Tr("target_file_not_exist", targetFile) + "\n")
		return &plugins.Result{

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Only register/invoke the systemd plugin on Linux hosts
  2. Gate the call with runtime.GOOS == "linux" before invoking Scan
  3. If you need equivalent functionality elsewhere, use launchd (macOS) or Windows services plugins instead

Example fix

// before
res := systemdPlugin.Scan(cfg)
// after
if runtime.GOOS != "linux" {
    return // skip Linux-only plugin
}
res := systemdPlugin.Scan(cfg)
Defensive patterns

Strategy: type-guard

Validate before calling

if runtime.GOOS != "linux" {
    // skip systemd plugin
}

Type guard

func isLinux() bool { return runtime.GOOS == "linux" }

Prevention

When it happens

Trigger: Calling the systemd service plugin's Scan on Windows, macOS, or any GOOS != "linux".

Common situations: Running the local persistence/audit plugin suite on a macOS developer laptop or a Windows host without gating Linux-only plugins.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of shadow1ng/fscan@95cc12e753 (2026-09-06). Data as JSON: /api/errors/bdd1ffa6f741f5c6. Report an issue: GitHub.