QueueRecursivePaths adds new paths to scan based on a discovered directory
(basePath string, wordlist []string)
| 3065 | |
| 3066 | // QueueRecursivePaths adds new paths to scan based on a discovered directory |
| 3067 | func (s *Scanner) QueueRecursivePaths(basePath string, wordlist []string) int { |
| 3068 | if !s.Config.Recursive { |
| 3069 | return 0 |
| 3070 | } |
| 3071 | |
| 3072 | // Check recursion depth |
| 3073 | depth := strings.Count(basePath, "/") |
| 3074 | if depth >= s.Config.RecursionDepth { |
| 3075 | return 0 |
| 3076 | } |
| 3077 | |
| 3078 | queued := 0 |
| 3079 | basePath = strings.TrimSuffix(basePath, "/") |
| 3080 | |
| 3081 | for _, word := range wordlist { |
| 3082 | newPath := basePath + "/" + strings.TrimPrefix(word, "/") |
| 3083 | |
| 3084 | // Check if we've already visited this path |
| 3085 | s.pathMutex.Lock() |
| 3086 | if s.visitedPaths[newPath] { |
| 3087 | s.pathMutex.Unlock() |
| 3088 | continue |
| 3089 | } |
| 3090 | s.visitedPaths[newPath] = true |
| 3091 | s.pathMutex.Unlock() |
| 3092 | |
| 3093 | // Try to queue the path (non-blocking) |
| 3094 | select { |
| 3095 | case s.recursionQueue <- newPath: |
| 3096 | queued++ |
| 3097 | default: |
| 3098 | // Queue is full, skip |
| 3099 | } |
| 3100 | } |
| 3101 | |
| 3102 | return queued |
| 3103 | } |
| 3104 | |
| 3105 | func (s *Scanner) ScanAll(paths []string, tui *TUI) []*ScanResult { |
| 3106 | // Store original wordlist for recursive scanning |
nothing calls this directly
no outgoing calls
no test coverage detected