(c *cli.Context)
| 34 | } |
| 35 | |
| 36 | func run(c *cli.Context) error { |
| 37 | pluginOpts := gobusterfuzz.NewOptions() |
| 38 | |
| 39 | httpOptions, err := internalcli.ParseCommonHTTPOptions(c) |
| 40 | if err != nil { |
| 41 | return err |
| 42 | } |
| 43 | pluginOpts.HTTPOptions = httpOptions |
| 44 | |
| 45 | pluginOpts.ExcludedStatusCodes = c.String("exclude-statuscodes") |
| 46 | ret, err := libgobuster.ParseCommaSeparatedInt(pluginOpts.ExcludedStatusCodes) |
| 47 | if err != nil { |
| 48 | return fmt.Errorf("invalid value for excludestatuscodes: %w", err) |
| 49 | } |
| 50 | pluginOpts.ExcludedStatusCodesParsed = ret |
| 51 | |
| 52 | pluginOpts.ExcludeLength = c.String("exclude-length") |
| 53 | ret2, err := libgobuster.ParseCommaSeparatedInt(pluginOpts.ExcludeLength) |
| 54 | if err != nil { |
| 55 | return fmt.Errorf("invalid value for exclude-length: %w", err) |
| 56 | } |
| 57 | pluginOpts.ExcludeLengthParsed = ret2 |
| 58 | |
| 59 | pluginOpts.RequestBody = c.String("body") |
| 60 | |
| 61 | globalOpts, err := internalcli.ParseGlobalOptions(c) |
| 62 | if err != nil { |
| 63 | return err |
| 64 | } |
| 65 | |
| 66 | if !containsFuzzKeyword(*pluginOpts) { |
| 67 | return fmt.Errorf("please provide the %s keyword", gobusterfuzz.FuzzKeyword) |
| 68 | } |
| 69 | |
| 70 | log := libgobuster.NewLogger(globalOpts.Debug) |
| 71 | |
| 72 | plugin, err := gobusterfuzz.New(&globalOpts, pluginOpts, log) |
| 73 | if err != nil { |
| 74 | return fmt.Errorf("error on creating gobusterfuzz: %w", err) |
| 75 | } |
| 76 | |
| 77 | if err := internalcli.Gobuster(c.Context, &globalOpts, plugin, log); err != nil { |
| 78 | log.Debugf("%#v", err) |
| 79 | return fmt.Errorf("error on running gobuster on %s: %w", pluginOpts.URL, err) |
| 80 | } |
| 81 | return nil |
| 82 | } |
| 83 | |
| 84 | func containsFuzzKeyword(pluginopts gobusterfuzz.OptionsFuzz) bool { |
| 85 | if strings.Contains(pluginopts.URL.String(), gobusterfuzz.FuzzKeyword) { |
nothing calls this directly
no test coverage detected