From 5e647db36587aba4658836f3f298234ebffede06 Mon Sep 17 00:00:00 2001 From: SIMLUKE Date: Fri, 13 Sep 2024 10:41:39 +0200 Subject: [PATCH] feat: added the option to download a default wordlist made the worlist parser more robust, now supporting comments and empty lines --- .gitignore | 3 ++- Makefile | 1 + src/cli/cli.go | 4 ++-- src/main.go | 2 -- src/query/callWorker.go | 5 +++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index f5f9ae2..0c8b6df 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -bruteforce \ No newline at end of file +bruteforce +default-wordlist.txt \ No newline at end of file diff --git a/Makefile b/Makefile index 13f86f4..f44ef0e 100644 --- a/Makefile +++ b/Makefile @@ -19,5 +19,6 @@ re: fclean all install_program: echo "source $(pwd)/autocompletion/bash/_bruteforce" >> ~/.bashrc echo "source $(pwd)/autocompletion/zsh/_bruteforce" >> ~/.zshrc + echo -n "Do you want to download a default wordlist ?? [y/N] " && read ans && if [ $${ans:-'N'} = 'y' ]; then curl https://raw.githubusercontent.com/drtychai/wordlists/master/dirbuster/directory-list-2.3-medium.txt > default-wordlist.txt; fi .PHONY: all clean fclean re install_program diff --git a/src/cli/cli.go b/src/cli/cli.go index 34f3d77..5f597ba 100644 --- a/src/cli/cli.go +++ b/src/cli/cli.go @@ -20,11 +20,11 @@ func ParseCliArgs() (models.ForcingParams, error) { statusPtr := flag.String("status-codes", "200,401,403,404,429,500", "Comma-separated list of status codes to match") headerPtr := flag.String("header", "", "Header to match, formatted as \"key: value\"") bodyPtr := flag.String("body", "", "String to match in response body") - wordlistPtr := flag.String("wordlist", "", "Wordlist to bruteforce url with") + wordlistPtr := flag.String("wordlist", "default-wordlist.txt", "Wordlist to bruteforce url with") flag.IntVar(¶ms.Workers, "threads", 1, "Number of threads to be used") flag.Usage = func() { - fmt.Fprintf(os.Stderr, "Usage: bruteforce [options] --wordlist=[./path/to/wordlist] \n") + fmt.Fprintf(os.Stderr, "Usage: bruteforce [options] \n") fmt.Fprintf(os.Stderr, "Options:\n") flag.PrintDefaults() } diff --git a/src/main.go b/src/main.go index 5441b4f..9ec26f9 100644 --- a/src/main.go +++ b/src/main.go @@ -3,7 +3,6 @@ package main import ( "bruteforce/src/cli" "bruteforce/src/query" - "fmt" ) func main() { @@ -13,7 +12,6 @@ func main() { if err != nil { panic(err) } - fmt.Println(forcingParams) query.MainRequest(&forcingParams) } diff --git a/src/query/callWorker.go b/src/query/callWorker.go index 56332b9..ddcc79c 100644 --- a/src/query/callWorker.go +++ b/src/query/callWorker.go @@ -24,9 +24,10 @@ func MainRequest(params *models.ForcingParams) { } for i := 0; i < len(wordArray); i++ { - channel <- wordArray[i] + if len(wordArray[i]) > 0 && wordArray[i][0] != '#' { + channel <- wordArray[i] + } } - close(channel) wg.Wait() }