{"record":{"id":"86d0940f4cb7aa7c","repo":"shadow1ng/fscan","slug":"unsupported-platform-arg1-86d094","errorCode":null,"errorMessage":"Unsupported platform: {{.Arg1}}","messagePattern":"Unsupported platform: (.+?)\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/keylogger.go","lineNumber":112,"sourceCode":"\t\tOutput:  output.String(),\n\t\tError:   nil,\n\t}\n}\n\n// startKeylogging 启动键盘记录\nfunc (p *KeyloggerPlugin) startKeylogging(ctx context.Context, outputFile string, session *common.ScanSession) error {\n\n\t// 根据平台启动相应的键盘记录\n\tvar err error\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\terr = p.startWindowsKeylogging(ctx)\n\tcase \"linux\":\n\t\terr = p.startLinuxKeylogging(ctx)\n\tcase \"darwin\":\n\t\terr = p.startDarwinKeylogging(ctx)\n\tdefault:\n\t\terr = fmt.Errorf(\"%s\", i18n.Tr(\"unsupported_platform\", runtime.GOOS))\n\t}\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: %w\", i18n.GetText(\"keylogger_failed_plain\"), err)\n\t}\n\n\t// 保存到文件\n\tif err := p.saveKeysToFile(outputFile, session); err != nil {\n\t\tsession.LogError(i18n.Tr(\"keylogger_save_failed\", err))\n\t}\n\n\treturn nil\n}\n\n// checkOutputFilePermissions 检查输出文件权限\nfunc (p *KeyloggerPlugin) checkOutputFilePermissions(outputFile string) error {\n\tfile, err := os.OpenFile(outputFile, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0600)\n\tif err != nil {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/keylogger.go#L94-L130","documentation":"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.","triggerScenarios":"Running the keylogger plugin on a GOOS other than windows/linux/darwin (e.g. freebsd, android) via Scan -> startKeylogging.","commonSituations":"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.","solutions":["Run the keylogger plugin only on windows, linux, or darwin hosts.","Gate the plugin with a runtime.GOOS whitelist in the orchestrating code and skip elsewhere.","Implement or contribute a start<Keylogger> implementation for the missing platform.","Treat the failed Result as an expected platform skip in test suites."],"exampleFix":"// before\nresult := keyloggerPlugin.Scan(ctx, cfg)\n// after\nswitch runtime.GOOS {\ncase \"windows\", \"linux\", \"darwin\":\n    result = keyloggerPlugin.Scan(ctx, cfg)\ndefault:\n    return nil // unsupported\n}","handlingStrategy":"fallback","validationCode":"switch runtime.GOOS {\ncase \"windows\", \"linux\", \"darwin\":\n    // ok\ndefault:\n    return fmt.Errorf(\"keylogger unsupported on %s\", runtime.GOOS)\n}","typeGuard":"func keyloggerSupported() bool {\n    switch runtime.GOOS {\n    case \"windows\", \"linux\", \"darwin\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"res := plugin.Scan(ctx, cfg)\nif !res.Success && strings.Contains(res.Error.Error(), \"Unsupported platform\") {\n    log.Printf(\"keylogger not available on %s\", runtime.GOOS)\n    return nil\n}","preventionTips":["Only schedule the keylogger plugin on windows/linux/darwin hosts.","Whitelist platforms in the orchestrator before dispatching plugins.","Account for cross-compiled binaries landing on untested GOOS values."],"tags":["keylogger","cross-platform","unsupported"],"backgroundTag":"unsupported-platform","analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}