这是indexloc提供的服务,不要输入任何密码
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

type cliOptions struct {
extensions string
delay string
filterStatus string
filterSize string
Expand Down Expand Up @@ -49,6 +50,7 @@ func main() {
defer cancel()
conf := ffuf.NewConfig(ctx)
opts := cliOptions{}
flag.StringVar(&opts.extensions, "e", "", "extensions to bruteforce separated by a comma. `\"wordlist must contain %EXT%\"`")
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(&conf.Wordlist, "w", "", "Wordlist path")
Expand Down Expand Up @@ -134,6 +136,12 @@ func prepareConfig(parseOpts *cliOptions, conf *ffuf.Config) error {
if len(conf.Wordlist) == 0 {
errs.Add(fmt.Errorf("-w flag is required"))
}
// prepare extensions
if parseOpts.extensions != "" {
extensions := strings.Split(parseOpts.extensions, ",")
conf.Extensions = extensions
}

//Prepare headers
for _, v := range parseOpts.headers {
hs := strings.SplitN(v, ":", 2)
Expand Down
2 changes: 2 additions & 0 deletions pkg/ffuf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type optRange struct {
type Config struct {
StaticHeaders map[string]string
FuzzHeaders map[string]string
Extensions []string
Method string
Url string
TLSVerify bool
Expand Down Expand Up @@ -57,5 +58,6 @@ func NewConfig(ctx context.Context) Config {
conf.ProxyURL = http.ProxyFromEnvironment
conf.Filters = make([]FilterProvider, 0)
conf.Delay = optRange{0, 0, false, false}
conf.Extensions = make([]string, 0)
return conf
}
11 changes: 10 additions & 1 deletion pkg/input/wordlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package input
import (
"bufio"
"os"
"strings"

"github.com/ffuf/ffuf/pkg/ffuf"
)
Expand Down Expand Up @@ -71,7 +72,15 @@ func (w *WordlistInput) readFile(path string) error {
var data [][]byte
reader := bufio.NewScanner(file)
for reader.Scan() {
data = append(data, []byte(reader.Text()))
if strings.Index(reader.Text(), "%EXT%") != -1 {
extensions := w.config.Extensions
for _, ext := range extensions {
contnt := strings.Replace(reader.Text(), "%EXT%", ext, -1)
data = append(data, []byte(contnt))
}
} else {
data = append(data, []byte(reader.Text()))
}
}
w.data = data
return reader.Err()
Expand Down