shadow1ng/fscan · error

Unsupported platform: {{.Arg1}}

Error message

Unsupported platform: {{.Arg1}}

What it means

startKeylogging dispatches to platform-specific implementations (Windows, Linux, Darwin). For any other GOOS, or when the running OS has no matching implementation, it produces the localized unsupported_platform error. Because the switch only handles three OSes, this fires on unsupported platforms where keylogging is simply not implemented.

Source

Thrown at plugins/local/keylogger.go:112

		Output:  output.String(),
		Error:   nil,
	}
}

// startKeylogging 启动键盘记录
func (p *KeyloggerPlugin) startKeylogging(ctx context.Context, outputFile string, session *common.ScanSession) error {

	// 根据平台启动相应的键盘记录
	var err error
	switch runtime.GOOS {
	case "windows":
		err = p.startWindowsKeylogging(ctx)
	case "linux":
		err = p.startLinuxKeylogging(ctx)
	case "darwin":
		err = p.startDarwinKeylogging(ctx)
	default:
		err = fmt.Errorf("%s", i18n.Tr("unsupported_platform", runtime.GOOS))
	}

	if err != nil {
		return fmt.Errorf("%s: %w", i18n.GetText("keylogger_failed_plain"), err)
	}

	// 保存到文件
	if err := p.saveKeysToFile(outputFile, session); err != nil {
		session.LogError(i18n.Tr("keylogger_save_failed", err))
	}

	return nil
}

// checkOutputFilePermissions 检查输出文件权限
func (p *KeyloggerPlugin) checkOutputFilePermissions(outputFile string) error {
	file, err := os.OpenFile(outputFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)
	if err != nil {

View on GitHub (pinned to 95cc12e753)

Solutions

  1. Run the keylogger plugin only on windows, linux, or darwin hosts.
  2. Gate the plugin with a runtime.GOOS whitelist in the orchestrating code and skip elsewhere.
  3. Implement or contribute a start<Keylogger> implementation for the missing platform.
  4. Treat the failed Result as an expected platform skip in test suites.

Example fix

// before
result := keyloggerPlugin.Scan(ctx, cfg)
// after
switch runtime.GOOS {
case "windows", "linux", "darwin":
    result = keyloggerPlugin.Scan(ctx, cfg)
default:
    return nil // unsupported
}
Defensive patterns

Strategy: fallback

Validate before calling

switch runtime.GOOS {
case "windows", "linux", "darwin":
    // ok
default:
    return fmt.Errorf("keylogger unsupported on %s", runtime.GOOS)
}

Type guard

func keyloggerSupported() bool {
    switch runtime.GOOS {
    case "windows", "linux", "darwin":
        return true
    }
    return false
}

Try / catch

res := plugin.Scan(ctx, cfg)
if !res.Success && strings.Contains(res.Error.Error(), "Unsupported platform") {
    log.Printf("keylogger not available on %s", runtime.GOOS)
    return nil
}

Prevention

When it happens

Trigger: Running the keylogger plugin on a GOOS other than windows/linux/darwin (e.g. freebsd, android) via Scan -> startKeylogging.

Common situations: Cross-compiling/deploying the agent to BSD or embedded Linux variants; running integration test matrices on non-mainstream platforms; container runtimes reporting an unexpected GOOS value.

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/86d0940f4cb7aa7c. Report an issue: GitHub.