MCPcopy
hub / github.com/OJ/gobuster / worker

Method worker

libgobuster/libgobuster.go:57–97  ·  view source on GitHub ↗
(ctx context.Context, guessChan <-chan *Guess, successChan chan<- *Guess, wg *sync.WaitGroup)

Source from the content-addressed store, hash-verified

55}
56
57func (g *Gobuster) worker(ctx context.Context, guessChan <-chan *Guess, successChan chan<- *Guess, wg *sync.WaitGroup) {
58 defer wg.Done()
59 for {
60 // Prioritize stopping when the context is done
61 select {
62 case <-ctx.Done():
63 return
64 default:
65 }
66 select {
67 case <-ctx.Done():
68 return
69 case guess := <-guessChan:
70
71 // Mode-specific processing
72 res, err := g.plugin.ProcessWord(ctx, guess.word, g.Progress)
73 if err != nil {
74 // do not exit and continue
75 g.Progress.ErrorChan <- fmt.Errorf("error on word %s: %w", guess.word, err)
76 }
77
78 if res != nil {
79 g.Progress.ResultChan <- res
80
81 select {
82 case <-ctx.Done():
83 g.Progress.incrementRequests()
84 return
85 case successChan <- guess:
86 }
87 }
88
89 g.Progress.incrementRequests()
90
91 select {
92 case <-ctx.Done():
93 case <-time.After(g.Opts.Delay):
94 }
95 }
96 }
97}
98
99func feed(ctx context.Context, guessChan chan<- *Guess, words []string, discoverOnSuccess bool) {
100 for _, w := range words {

Callers 1

RunMethod · 0.95

Calls 3

ErrorfMethod · 0.80
incrementRequestsMethod · 0.80
ProcessWordMethod · 0.65

Tested by

no test coverage detected