| 1 | package mainscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/ |
| 2 | |
| 3 | import ( |
| 4 | "flagscip-go gomod github.com/golang/go/src go1.18 flag/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/" |
| 6 | "osscip-go gomod github.com/golang/go/src go1.18 os/" |
| 7 | |
| 8 | "github.com/ffuf/ffuf/v2/pkg/ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/" |
| 9 | ) |
| 10 | |
| 11 | type UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection# struct { |
| 12 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name. string |
| 13 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description. string |
| 14 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags. []UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag# |
| 15 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden. bool |
| 16 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags. []string |
| 17 | } |
| 18 | |
| 19 | // PrintSection prints out the section name, description and each of the flags |
| 20 | func (u *UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#) PrintSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#PrintSection().(max_length int, extended bool) { |
| 21 | // Do not print if extended usage not requested and section marked as hidden |
| 22 | if !extended && u.Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden. { |
| 23 | return |
| 24 | } |
| 25 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().("%s:\n", u.Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.) |
| 26 | for _, f := range u.Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags. { |
| 27 | f.PrintFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#PrintFlag().(max_length) |
| 28 | } |
| 29 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().("\n") |
| 30 | } |
| 31 | |
| 32 | type UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag# struct { |
| 33 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Name. string |
| 34 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Description. string |
| 35 | Defaultscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Default. string |
| 36 | } |
| 37 | |
| 38 | // PrintFlag prints out the flag name, usage string and default value |
| 39 | func (f *UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#) PrintFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#PrintFlag().(max_length int) { |
| 40 | // Create format string, used for padding |
| 41 | format := fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().(" -%%-%ds %%s", max_length) |
| 42 | if f.Defaultscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Default. != "" { |
| 43 | format = format + " (default: %s)\n" |
| 44 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(format, f.Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Name., f.Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Description., f.Defaultscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Default.) |
| 45 | } else { |
| 46 | format = format + "\n" |
| 47 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(format, f.Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Name., f.Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Description.) |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | func Usagescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/Usage().() { |
| 52 | u_http := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 53 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "HTTP OPTIONS", |
| 54 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "Options controlling the HTTP request and its parts.", |
| 55 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 56 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: false, |
| 57 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"cc", "ck", "H", "X", "b", "d", "r", "u", "raw", "recursion", "recursion-depth", "recursion-strategy", "replay-proxy", "timeout", "ignore-body", "x", "sni", "http2"}, |
| 58 | } |
| 59 | u_general := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 60 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "GENERAL OPTIONS", |
| 61 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "", |
| 62 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 63 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: false, |
| 64 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"ac", "acc", "ack", "ach", "acs", "c", "config", "json", "maxtime", "maxtime-job", "noninteractive", "p", "rate", "scraperfile", "scrapers", "search", "s", "sa", "se", "sf", "t", "v", "V"}, |
| 65 | } |
| 66 | u_compat := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 67 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "COMPATIBILITY OPTIONS", |
| 68 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "Options to ensure compatibility with other pieces of software.", |
| 69 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 70 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: true, |
| 71 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"compressed", "cookie", "data", "data-ascii", "data-binary", "i", "k"}, |
| 72 | } |
| 73 | u_matcher := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 74 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "MATCHER OPTIONS", |
| 75 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "Matchers for the response filtering.", |
| 76 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 77 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: false, |
| 78 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"mmode", "mc", "ml", "mr", "ms", "mt", "mw"}, |
| 79 | } |
| 80 | u_filter := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 81 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "FILTER OPTIONS", |
| 82 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "Filters for the response filtering.", |
| 83 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 84 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: false, |
| 85 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"fmode", "fc", "fl", "fr", "fs", "ft", "fw"}, |
| 86 | } |
| 87 | u_input := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 88 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "INPUT OPTIONS", |
| 89 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "Options for input data for fuzzing. Wordlists and input generators.", |
| 90 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 91 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: false, |
| 92 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"D", "enc", "ic", "input-cmd", "input-num", "input-shell", "mode", "request", "request-proto", "e", "w"}, |
| 93 | } |
| 94 | u_output := UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{ |
| 95 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Name.: "OUTPUT OPTIONS", |
| 96 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Description.: "Options for output. Output file formats, file names and debug file locations.", |
| 97 | Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags.: make([]UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#, 0), |
| 98 | Hiddenscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Hidden.: false, |
| 99 | ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.: []string{"audit-log", "debug-log", "o", "of", "od", "or"}, |
| 100 | } |
| 101 | sections := []UsageSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#{u_http, u_general, u_compat, u_matcher, u_filter, u_input, u_output} |
| 102 | |
| 103 | // Populate the flag sections |
| 104 | max_length := 0 |
| 105 | flagscip-go gomod github.com/golang/go/src go1.18 flag/.VisitAllscip-go gomod github.com/golang/go/src go1.18 flag/VisitAll().(func(f *flagscip-go gomod github.com/golang/go/src go1.18 flag/.Flagscip-go gomod github.com/golang/go/src go1.18 flag/Flag#) { |
| 106 | found := false |
| 107 | for i, section := range sections { |
| 108 | if ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.StrInSlicescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/StrInSlice().(f.Namescip-go gomod github.com/golang/go/src go1.18 flag/Flag#Name., section.ExpectedFlagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#ExpectedFlags.) { |
| 109 | sections[i].Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags. = append(sections[i].Flagsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#Flags., UsageFlagscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#{ |
| 110 | Namescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Name.: f.Namescip-go gomod github.com/golang/go/src go1.18 flag/Flag#Name., |
| 111 | Descriptionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Description.: f.Usagescip-go gomod github.com/golang/go/src go1.18 flag/Flag#Usage., |
| 112 | Defaultscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageFlag#Default.: f.DefValuescip-go gomod github.com/golang/go/src go1.18 flag/Flag#DefValue., |
| 113 | }) |
| 114 | found = true |
| 115 | } |
| 116 | } |
| 117 | if !found { |
| 118 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().("DEBUG: Flag %s was found but not defined in help.go.\n", f.Namescip-go gomod github.com/golang/go/src go1.18 flag/Flag#Name.) |
| 119 | osscip-go gomod github.com/golang/go/src go1.18 os/.Exitscip-go gomod github.com/golang/go/src go1.18 os/Exit().(1) |
| 120 | } |
| 121 | if len(f.Namescip-go gomod github.com/golang/go/src go1.18 flag/Flag#Name.) > max_length { |
| 122 | max_length = len(f.Namescip-go gomod github.com/golang/go/src go1.18 flag/Flag#Name.) |
| 123 | } |
| 124 | }) |
| 125 | |
| 126 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().("Fuzz Faster U Fool - %s\n\n", ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.FormattedVersionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/FormattedVersion().()) |
| 127 | |
| 128 | // Print out the sections |
| 129 | for _, section := range sections { |
| 130 | section.PrintSectionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2`/UsageSection#PrintSection().(max_length, false) |
| 131 | } |
| 132 | |
| 133 | // Usage examples. |
| 134 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().("EXAMPLE USAGE:\n") |
| 135 | |
| 136 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" Fuzz file paths from wordlist.txt, match all responses but filter out those with content-size 42.\n") |
| 137 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" Colored, verbose output.\n") |
| 138 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" ffuf -w wordlist.txt -u https://example.org/FUZZ -mc all -fs 42 -c -v\n\n") |
| 139 | |
| 140 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" Fuzz Host-header, match HTTP 200 responses.\n") |
| 141 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" ffuf -w hosts.txt -u https://example.org/ -H \"Host: FUZZ\" -mc 200\n\n") |
| 142 | |
| 143 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" Fuzz POST JSON data. Match all responses not containing text \"error\".\n") |
| 144 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" ffuf -w entries.txt -u https://example.org/ -X POST -H \"Content-Type: application/json\" \\\n") |
| 145 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" -d '{\"name\": \"FUZZ\", \"anotherkey\": \"anothervalue\"}' -fr \"error\"\n\n") |
| 146 | |
| 147 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" Fuzz multiple locations. Match only responses reflecting the value of \"VAL\" keyword. Colored.\n") |
| 148 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" ffuf -w params.txt:PARAM -w values.txt:VAL -u https://example.org/?PARAM=VAL -mr \"VAL\" -c\n\n") |
| 149 | |
| 150 | fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Printfscip-go gomod github.com/golang/go/src go1.18 fmt/Printf().(" More information and examples: https://github.com/ffuf/ffuf\n\n") |
| 151 | } |