Skip to content

Commit

Permalink
feat: added the option to download a default wordlist
Browse files Browse the repository at this point in the history
made the worlist parser more robust, now supporting comments and empty lines
  • Loading branch information
SIMLUKE committed Sep 13, 2024
1 parent 25108c5 commit 5e647db
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bruteforce
bruteforce
default-wordlist.txt
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions src/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(&params.Workers, "threads", 1, "Number of threads to be used")

flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage: bruteforce [options] --wordlist=[./path/to/wordlist] <url>\n")
fmt.Fprintf(os.Stderr, "Usage: bruteforce [options] <url>\n")
fmt.Fprintf(os.Stderr, "Options:\n")
flag.PrintDefaults()
}
Expand Down
2 changes: 0 additions & 2 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"bruteforce/src/cli"
"bruteforce/src/query"
"fmt"
)

func main() {
Expand All @@ -13,7 +12,6 @@ func main() {
if err != nil {
panic(err)
}
fmt.Println(forcingParams)

query.MainRequest(&forcingParams)
}
5 changes: 3 additions & 2 deletions src/query/callWorker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

0 comments on commit 5e647db

Please sign in to comment.