Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cli/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func GlobalOptions() []cli.Flag {
&cli.StringFlag{Name: "discover-pattern", Aliases: []string{"pd"}, Usage: "File containing replacement patterns applied to successful guesses"},
&cli.BoolFlag{Name: "no-color", Aliases: []string{"nc"}, Value: false, Usage: "Disable color output"},
&cli.BoolFlag{Name: "debug", Value: false, Usage: "enable debug output"},
&cli.BoolFlag{Name: "stop-on-rate-limit", Value: false, Usage: "When enabled exits when a rate limit is detected"},
}
}

Expand Down Expand Up @@ -253,6 +254,7 @@ func ParseGlobalOptions(c *cli.Context) (libgobuster.Options, error) {
opts.NoProgress = c.Bool("no-progress")
opts.NoError = c.Bool("no-error")
opts.PatternFile = c.String("pattern")
opts.StopOnRateLimit = c.Bool("stop-on-rate-limit")
if opts.PatternFile != "" {
if _, err := os.Stat(opts.PatternFile); os.IsNotExist(err) {
return opts, fmt.Errorf("pattern file %q does not exist: %w", opts.PatternFile, err)
Expand Down
5 changes: 5 additions & 0 deletions gobusterdir/gobusterdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ func (d *GobusterDir) ProcessWord(ctx context.Context, word string, progress *li
}
return nil, err
}
if statusCode == http.StatusTooManyRequests && d.globalopts.StopOnRateLimit {
fmt.Println("Rate limit reached, exiting...")
os.Exit(0)

}
break
}

Expand Down
4 changes: 4 additions & 0 deletions gobusterfuzz/gobusterfuzz.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ func (d *GobusterFuzz) ProcessWord(ctx context.Context, word string, progress *l
return nil, err
}
}
if statusCode == http.StatusTooManyRequests && d.globalopts.StopOnRateLimit {
fmt.Println("Rate limit reached, exiting...")
os.Exit(0)
}
break
}

Expand Down
4 changes: 4 additions & 0 deletions gobustervhost/gobustervhost.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,10 @@ func (v *GobusterVhost) ProcessWord(ctx context.Context, word string, progress *
return nil, err
}
}
if statusCode == http.StatusTooManyRequests && v.globalopts.StopOnRateLimit {
fmt.Println("Rate limit reached, exiting...")
os.Exit(0)
}
break
}

Expand Down
1 change: 1 addition & 0 deletions libgobuster/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ type Options struct {
NoError bool
Quiet bool
Delay time.Duration
StopOnRateLimit bool
}