{"record":{"id":"5d4fc96022073d76","repo":"shadow1ng/fscan","slug":"local-pe-not-specified","errorCode":null,"errorMessage":"local_pe_not_specified","messagePattern":"local_pe_not_specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/winbits.go","lineNumber":29,"sourceCode":"\t\"strings\"\n\n\t\"github.com/shadow1ng/fscan/common\"\n\t\"github.com/shadow1ng/fscan/common/i18n\"\n\t\"github.com/shadow1ng/fscan/plugins\"\n)\n\ntype WinBITSPlugin struct {\n\tplugins.BasePlugin\n}\n\nfunc NewWinBITSPlugin() *WinBITSPlugin {\n\treturn &WinBITSPlugin{BasePlugin: plugins.NewBasePlugin(\"winbits\")}\n}\n\nfunc (p *WinBITSPlugin) 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\tjobName := fmt.Sprintf(\"WindowsUpdate_%s\", baseName)\n\n\tvar output strings.Builder\n\n\t// 创建任务并提取 GUID\n\tout, err := exec.Command(\"bitsadmin\", \"/create\", \"/download\", jobName).CombinedOutput()\n\tif err != nil {\n\t\toutput.WriteString(i18n.Tr(\"winbits_create_task_failed\", strings.TrimSpace(string(out))) + \"\\n\")\n\t\treturn &plugins.Result{Success: false, Output: output.String()}\n\t}\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/winbits.go#L11-L47","documentation":"WinBITSPlugin.Scan requires a local PE file path from session.Config.WinPEFile because the BITS-based persistence technique uploads/executes a local executable. When the config field is empty, Scan immediately returns a failed Result with the localized message for key \"local_pe_not_specified\". It is a configuration-validation failure, not a runtime fault.","triggerScenarios":"Scan is invoked while session.Config.WinPEFile == \"\" — i.e., the winbits plugin was enabled without setting the local PE file option.","commonSituations":"User enabled the winbits module but forgot the corresponding flag/config key (e.g., --winpe-file), config file loaded from the wrong profile, or the field name changed between tool versions so the old key is silently ignored.","solutions":["Set the WinPEFile value in the scan config (the CLI flag/config key that populates session.Config.WinPEFile) before enabling winbits.","Verify the config file/profile actually contains that key and that it's under the correct section.","If running programmatically, populate session.Config.WinPEFile with an absolute path to a valid PE before calling Scan.","Check the tool's current usage docs in case the option name changed in your version."],"exampleFix":"// before\nsession.Config.WinPEFile == \"\"  // -> local_pe_not_specified\n// after (programmatic)\nsession.Config.WinPEFile = \"C:\\\\tools\\\\payload.exe\"\n// CLI equivalent:\n//   <tool> --winpe-file C:\\tools\\payload.exe --plugin winbits","handlingStrategy":"validation","validationCode":"// Validate config before invoking the plugin\nif session.Config.WinPEFile == \"\" {\n    return errors.New(\"winbits requires --winpe-file / session.Config.WinPEFile to be set\")\n}","typeGuard":null,"tryCatchPattern":"result := plugin.Scan(ctx, host, session)\nif result != nil && !result.Success && result.Error.Error() == i18n.GetText(\"local_pe_not_specified\") {\n    // print usage hint: supply the local PE path option\n}","preventionTips":["Always pass the PE path flag when enabling winbits/winifeo/winlogon plugins.","Validate required config fields at startup with a preflight check.","After tool upgrades, re-diff your config keys against the current flag names."],"tags":["configuration","windows","bits","missing-argument"],"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-14T00:17:10.932Z"}