(c *cli.Context)
| 41 | } |
| 42 | |
| 43 | func run(c *cli.Context) error { |
| 44 | pluginOpts := gobusterdir.NewOptions() |
| 45 | |
| 46 | httpOptions, err := internalcli.ParseCommonHTTPOptions(c) |
| 47 | if err != nil { |
| 48 | return err |
| 49 | } |
| 50 | pluginOpts.HTTPOptions = httpOptions |
| 51 | |
| 52 | pluginOpts.Extensions = c.String("extensions") |
| 53 | ret, err := libgobuster.ParseExtensions(pluginOpts.Extensions) |
| 54 | if err != nil { |
| 55 | return fmt.Errorf("invalid value for extensions: %w", err) |
| 56 | } |
| 57 | pluginOpts.ExtensionsParsed = ret |
| 58 | |
| 59 | pluginOpts.ExtensionsFile = c.String("extensions-file") |
| 60 | if pluginOpts.ExtensionsFile != "" { |
| 61 | extensions, err := libgobuster.ParseExtensionsFile(pluginOpts.ExtensionsFile) |
| 62 | if err != nil { |
| 63 | return fmt.Errorf("invalid value for extensions file: %w", err) |
| 64 | } |
| 65 | pluginOpts.ExtensionsParsed.AddRange(extensions) |
| 66 | } |
| 67 | |
| 68 | pluginOpts.StatusCodes = c.String("status-codes") |
| 69 | ret2, err := libgobuster.ParseCommaSeparatedInt(pluginOpts.StatusCodes) |
| 70 | if err != nil { |
| 71 | return fmt.Errorf("invalid value for status-codes: %w", err) |
| 72 | } |
| 73 | pluginOpts.StatusCodesParsed = ret2 |
| 74 | |
| 75 | pluginOpts.StatusCodesBlacklist = c.String("status-codes-blacklist") |
| 76 | ret3, err := libgobuster.ParseCommaSeparatedInt(pluginOpts.StatusCodesBlacklist) |
| 77 | if err != nil { |
| 78 | return fmt.Errorf("invalid value for status-codes-blacklist: %w", err) |
| 79 | } |
| 80 | pluginOpts.StatusCodesBlacklistParsed = ret3 |
| 81 | |
| 82 | if pluginOpts.StatusCodes != "" && pluginOpts.StatusCodesBlacklist != "" { |
| 83 | return fmt.Errorf("status-codes (%q) and status-codes-blacklist (%q) are both set - please set only one. status-codes-blacklist is set by default so you might want to disable it by supplying an empty string", |
| 84 | pluginOpts.StatusCodes, pluginOpts.StatusCodesBlacklist) |
| 85 | } |
| 86 | |
| 87 | if pluginOpts.StatusCodes == "" && pluginOpts.StatusCodesBlacklist == "" { |
| 88 | return errors.New("status-codes and status-codes-blacklist are both not set, please set one") |
| 89 | } |
| 90 | |
| 91 | pluginOpts.UseSlash = c.Bool("add-slash") |
| 92 | pluginOpts.Expanded = c.Bool("expanded") |
| 93 | pluginOpts.NoStatus = c.Bool("no-status") |
| 94 | pluginOpts.HideLength = c.Bool("hide-length") |
| 95 | pluginOpts.DiscoverBackup = c.Bool("discover-backup") |
| 96 | pluginOpts.Force = c.Bool("force") |
| 97 | pluginOpts.ExcludeLength = c.String("exclude-length") |
| 98 | ret4, err := libgobuster.ParseCommaSeparatedInt(pluginOpts.ExcludeLength) |
| 99 | if err != nil { |
| 100 | return fmt.Errorf("invalid value for exclude-length: %w", err) |
nothing calls this directly
no test coverage detected