{"record":{"id":"92a3b59fef682ca7","repo":"shadow1ng/fscan","slug":"local-pe-not-found","errorCode":null,"errorMessage":"local_pe_not_found","messagePattern":"local_pe_not_found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/winbits.go","lineNumber":32,"sourceCode":"\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\n\tguid := \"\"\n\tfor _, line := range strings.Split(string(out), \"\\n\") {\n\t\tif idx := strings.Index(line, \"{\"); idx != -1 {","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/winbits.go#L14-L50","documentation":"WinBITSPlugin.Scan validates that the configured local PE file exists by calling os.Stat(session.Config.WinPEFile). If Stat fails (missing file, bad path, permission issue), Scan returns a failed Result with the localized message for key \"local_pe_not_found\". The error is raised before any BITS job is created.","triggerScenarios":"os.Stat(pePath) returns an error for the non-empty WinPEFile path — file deleted/renamed, relative path resolved against a different working directory, drive letter unavailable, or no read permission on the path.","commonSituations":"Typo in the path, using a path that exists on the target instead of the local scanning machine (or vice versa), running from a different CWD so a relative path breaks, or antivirus quarantining the PE before the scan runs.","solutions":["Verify the path exists on the machine running the plugin: run Test-Path <pePath> (Windows) and correct typos.","Use an absolute path in WinPEFile instead of a relative path to avoid CWD dependence.","Check file permissions and that the file wasn't quarantined/removed by antivirus.","Confirm the correct drive/share is mounted and accessible from the scanning host."],"exampleFix":"// before\nsession.Config.WinPEFile = \"tools\\\\payload.exe\" // Stat fails if CWD differs\n// after\nabs, _ := filepath.Abs(\"tools\\\\payload.exe\")\nif _, err := os.Stat(abs); err != nil {\n    log.Fatalf(\"PE file missing: %v\", err)\n}\nsession.Config.WinPEFile = abs","handlingStrategy":"validation","validationCode":"// Ensure the configured PE exists before scanning\nif fi, err := os.Stat(session.Config.WinPEFile); err != nil {\n    return fmt.Errorf(\"WinPEFile %q not accessible: %w\", session.Config.WinPEFile, err)\n} else if fi.IsDir() {\n    return fmt.Errorf(\"WinPEFile %q is a directory\", session.Config.WinPEFile)\n}","typeGuard":null,"tryCatchPattern":"result := plugin.Scan(ctx, host, session)\nif result != nil && !result.Success && strings.Contains(result.Error.Error(), i18n.GetText(\"local_pe_not_found\")) {\n    // correct the path in config and re-run\n}","preventionTips":["Store absolute paths in WinPEFile, never relative ones.","Run Test-Path after editing the config and before launching a long scan.","Add the PE to antivirus exclusions so it isn't quarantined mid-run."],"tags":["file","configuration","windows","bits"],"backgroundTag":"file-not-found","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"}