Skip to content

Commit e454026

Browse files
author
invoker
committed
fix path
1 parent 71804c6 commit e454026

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

DirListerFuzzer

-6.13 MB
Binary file not shown.

main.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ func main() {
3434
if err != nil {
3535
log.Fatal("Error getting executable path:", err)
3636
}
37-
exPath := filepath.Dir(ex)
3837

3938
address := flag.String("url", "", "URL address (e.g., https://google.com)")
4039
showsuccessresult := flag.Bool("v", false, "Show success results only")
@@ -60,8 +59,24 @@ func main() {
6059
log.Fatal("Error creating output directory:", err)
6160
}
6261
}
63-
64-
file, err := os.Open(exPath + "/Directory_list.txt")
62+
appPath, err := os.Executable()
63+
if err != nil {
64+
fmt.Printf("Failed to get application path: %v\n", err)
65+
return
66+
}
67+
filepathS := "Directory_list.txt"
68+
appDir := filepath.Dir(appPath)
69+
defaultLocalPath := filepath.Join(appDir, filepathS)
70+
defaultGlobalPath := "/usr/local/bin/" + filepathS
71+
fmt.Printf("Checking for in %s\n and %s\n", appDir, defaultGlobalPath)
72+
// Check if the file exists in the application's directory
73+
configfilepath := defaultLocalPath
74+
if _, err := os.Stat(configfilepath); os.IsNotExist(err) {
75+
// If not found in the app directory, fall back to /usr/local/bin
76+
fmt.Printf(" not found in %s, trying %s\n", appDir, defaultGlobalPath)
77+
configfilepath = defaultGlobalPath
78+
}
79+
file, err := os.Open(configfilepath)
6580
if err != nil {
6681
fmt.Printf("%s", err)
6782
return

0 commit comments

Comments
 (0)