mirror of
https://github.com/ffuf/ffuf
synced 2024-11-10 06:04:17 +00:00
Match both %ext% and %EXT% in DirSearch compatibility mode (#81)
* Match both %ext% and %EXT% * Match both %ext% and %EXT% * Case insensitive regex search & replace
This commit is contained in:
parent
492253b67b
commit
8d057ea177
1 changed files with 5 additions and 3 deletions
|
@ -3,7 +3,7 @@ package input
|
|||
import (
|
||||
"bufio"
|
||||
"os"
|
||||
"strings"
|
||||
"regexp"
|
||||
|
||||
"github.com/ffuf/ffuf/pkg/ffuf"
|
||||
)
|
||||
|
@ -91,11 +91,13 @@ func (w *WordlistInput) readFile(path string) error {
|
|||
|
||||
var data [][]byte
|
||||
reader := bufio.NewScanner(file)
|
||||
re := regexp.MustCompile(`(?i)%ext%`)
|
||||
for reader.Scan() {
|
||||
if w.config.DirSearchCompat && len(w.config.Extensions) > 0 {
|
||||
if strings.Index(reader.Text(), "%EXT%") != -1 {
|
||||
text := []byte(reader.Text())
|
||||
if re.Match(text) {
|
||||
for _, ext := range w.config.Extensions {
|
||||
contnt := strings.Replace(reader.Text(), "%EXT%", ext, -1)
|
||||
contnt := re.ReplaceAll(text, []byte(ext))
|
||||
data = append(data, []byte(contnt))
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue