{"record":{"id":"e1181c14dbf3b2c4","repo":"shadow1ng/fscan","slug":"unable-to-create-output-file-arg1-w","errorCode":null,"errorMessage":"Unable to create output file {{.Arg1}}: %w","messagePattern":"Unable to create output file (.+?)\\}: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/keylogger.go","lineNumber":131,"sourceCode":"\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 {\n\t\treturn fmt.Errorf(\"%s: %w\", i18n.Tr(\"output_file_create_failed\", outputFile), err)\n\t}\n\t_ = file.Close()\n\treturn nil\n}\n\n// checkPlatformRequirements 检查平台特定要求\nfunc (p *KeyloggerPlugin) checkPlatformRequirements() error {\n\tswitch runtime.GOOS {\n\tcase \"windows\":\n\t\treturn p.checkWindowsRequirements()\n\tcase \"linux\":\n\t\treturn p.checkLinuxRequirements()\n\tcase \"darwin\":\n\t\treturn p.checkDarwinRequirements()\n\tdefault:\n\t\treturn fmt.Errorf(\"%s\", i18n.Tr(\"unsupported_platform\", runtime.GOOS))\n\t}\n}","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/keylogger.go#L113-L149","documentation":"Raised in KeyloggerPlugin.checkOutputFilePermissions when os.OpenFile on the keystroke-log output path fails (permission denied, unwritable directory, or invalid path); the localized 'output_file_create_failed' message wraps the OS error.","triggerScenarios":"Thrown at plugins/local/keylogger.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose an output path in a writable directory","Run with sufficient privileges to create the file (0600)","Free the file if another process holds a lock on it"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}