{"record":{"id":"53832325841e5dd5","repo":"shadow1ng/fscan","slug":"local-pe-not-specified-538323","errorCode":null,"errorMessage":"local_pe_not_specified","messagePattern":"local_pe_not_specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/winregistry.go","lineNumber":31,"sourceCode":"\t\"github.com/shadow1ng/fscan/common\"\n\t\"github.com/shadow1ng/fscan/common/i18n\"\n\t\"github.com/shadow1ng/fscan/plugins\"\n)\n\ntype WinRegistryPlugin struct {\n\tplugins.BasePlugin\n}\n\nfunc NewWinRegistryPlugin() *WinRegistryPlugin {\n\treturn &WinRegistryPlugin{\n\t\tBasePlugin: plugins.NewBasePlugin(\"winregistry\"),\n\t}\n}\n\nfunc (p *WinRegistryPlugin) Scan(ctx context.Context, info *common.HostInfo, session *common.ScanSession) *plugins.Result {\n\tpePath := session.Config.WinPEFile\n\tif pePath == \"\" {\n\t\treturn &plugins.Result{Success: false, Error: fmt.Errorf(\"%s\", i18n.GetText(\"local_pe_not_specified\"))}\n\t}\n\tif _, err := os.Stat(pePath); err != nil {\n\t\treturn &plugins.Result{Success: false, Error: fmt.Errorf(\"%s\", i18n.Tr(\"local_pe_not_found\", pePath))}\n\t}\n\n\tabsPath, _ := filepath.Abs(pePath)\n\tbaseName := strings.TrimSuffix(filepath.Base(absPath), filepath.Ext(absPath))\n\n\tentries := []struct {\n\t\tkey  string\n\t\tname string\n\t\tdesc string\n\t}{\n\t\t{`HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run`, fmt.Sprintf(\"WindowsUpdate_%s\", baseName), i18n.GetText(\"winregistry_current_user_run\")},\n\t\t{`HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Run`, fmt.Sprintf(\"SystemUpdate_%s\", baseName), i18n.GetText(\"winregistry_local_machine_run\")},\n\t\t{`HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\RunOnce`, fmt.Sprintf(\"SetupComplete_%s\", baseName), i18n.GetText(\"winregistry_current_user_runonce\")},\n\t}\n","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/winregistry.go#L13-L49","documentation":"The WinRegistryPlugin.Scan method requires a local Windows PE file path via session.Config.WinPEFile to analyze registry persistence for that binary. When WinPEFile is the empty string, the plugin aborts before doing any work and returns this localized error. It is a pre-flight configuration check, not a runtime failure.","triggerScenarios":"Calling Scan (directly or via the plugin runner) with a common.ScanSession whose Config.WinPEFile was never set (empty string). Typically happens when the user did not pass the PE-file option on the CLI/API so Config.WinPEFile defaults to \"\".","commonSituations":"Running the winregistry local plugin without the corresponding flag (e.g. forgetting the -f/--pe-file style argument); constructing ScanSession programmatically and leaving WinPEFile at its zero value; a config file that omits the win-pe-file key.","solutions":["Set session.Config.WinPEFile to the absolute or relative path of the local PE (.exe/.dll) before invoking Scan.","If invoking via CLI, pass the PE file flag so the config loader populates Config.WinPEFile.","Validate the config before running the scan: reject sessions with empty WinPEFile early with a clear user-facing message."],"exampleFix":"// before\nsession.Config.WinPEFile = \"\"\nplugin.Scan(ctx, host, session) // -> local_pe_not_specified\n// after\nsession.Config.WinPEFile = \"C:\\\\samples\\\\implant.dll\"\nplugin.Scan(ctx, host, session)","handlingStrategy":"validation","validationCode":"if cfg == nil || cfg.WinPEFile == \"\" {\n    return fmt.Errorf(\"winregistry plugin requires a PE file path (set Config.WinPEFile)\")\n}","typeGuard":"func hasPEFile(cfg *common.Config) bool { return cfg != nil && cfg.WinPEFile != \"\" }","tryCatchPattern":null,"preventionTips":["Always set Config.WinPEFile before running any local Windows plugin.","Add a shared pre-scan config validator that rejects empty required fields per plugin.","Wrap plugin dispatch so missing config yields an actionable message instead of a bare i18n key."],"tags":["configuration","windows","pe-file","local-scan"],"backgroundTag":"missing-required-config-field","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"}