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
@ -3,7 +3,7 @@ package input
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"regexp"
|
||||||
|
|
||||||
"github.com/ffuf/ffuf/pkg/ffuf"
|
"github.com/ffuf/ffuf/pkg/ffuf"
|
||||||
)
|
)
|
||||||
@ -91,11 +91,13 @@ func (w *WordlistInput) readFile(path string) error {
|
|||||||
|
|
||||||
var data [][]byte
|
var data [][]byte
|
||||||
reader := bufio.NewScanner(file)
|
reader := bufio.NewScanner(file)
|
||||||
|
re := regexp.MustCompile(`(?i)%ext%`)
|
||||||
for reader.Scan() {
|
for reader.Scan() {
|
||||||
if w.config.DirSearchCompat && len(w.config.Extensions) > 0 {
|
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 {
|
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))
|
data = append(data, []byte(contnt))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user