From 1e57e6d0a97c73b21afc271c04df8d348f4a60d4 Mon Sep 17 00:00:00 2001 From: Joona Hoikkala Date: Tue, 18 Feb 2020 19:20:30 +0200 Subject: [PATCH] Fix issue when -request is used in conjunction with -u (#172) --- CHANGELOG.md | 1 + main.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a67c6c..13dde4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Write POST request data properly to file when ran with `-od` - Properly handle relative redirect urls with `-recursion` - Calculate req/sec correctly for when using recursion + - When `-request` is used, allow the user to override URL using `-u` - v1.0.1 - Changed diff --git a/main.go b/main.go index 9f7ae44..de2b543 100644 --- a/main.go +++ b/main.go @@ -36,6 +36,7 @@ type cliOptions struct { replayProxyURL string request string requestProto string + URL string outputFormat string wordlists multiStringFlag inputcommands multiStringFlag @@ -67,7 +68,7 @@ func main() { flag.StringVar(&opts.extensions, "e", "", "Comma separated list of extensions. Extends FUZZ keyword.") flag.BoolVar(&conf.DirSearchCompat, "D", false, "DirSearch wordlist compatibility mode. Used in conjunction with -e flag.") flag.Var(&opts.headers, "H", "Header `\"Name: Value\"`, separated by colon. Multiple -H flags are accepted.") - flag.StringVar(&conf.Url, "u", "", "Target URL") + flag.StringVar(&opts.URL, "u", "", "Target URL") flag.Var(&opts.wordlists, "w", "Wordlist file path and (optional) keyword separated by colon. eg. '/path/to/wordlist:KEYWORD'") flag.BoolVar(&ignored, "k", false, "Dummy flag for backwards compatibility") flag.StringVar(&opts.delay, "p", "", "Seconds of `delay` between requests, or a range of random delay. For example \"0.1\" or \"0.1-2.0\"") @@ -335,6 +336,11 @@ func prepareConfig(parseOpts *cliOptions, conf *ffuf.Config) error { } } + //Prepare URL + if parseOpts.URL != "" { + conf.Url = parseOpts.URL + } + //Prepare headers for _, v := range parseOpts.headers { hs := strings.SplitN(v, ":", 2)