New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Match both %ext% and %EXT% in DirSearch compatibility mode #81
Conversation
pkg/input/wordlist.go
Outdated
@@ -98,6 +98,11 @@ func (w *WordlistInput) readFile(path string) error { | |||
contnt := strings.Replace(reader.Text(), "%EXT%", ext, -1) | |||
data = append(data, []byte(contnt)) | |||
} | |||
} else if strings.Index(reader.Text(), "%ext%") != -1 { | |||
for _, ext := range w.config.Extensions { | |||
contnt := strings.Replace(reader.Text(), "%ext%", ext, -1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather see the original replace action changed to case insensitive regex replace. This way it would match possible typos %Ext%
etc. as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better now? I haven't really written any go before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small nit, otherwise LGTM
@@ -91,11 +91,13 @@ func (w *WordlistInput) readFile(path string) error { | |||
|
|||
var data [][]byte | |||
reader := bufio.NewScanner(file) | |||
re := regexp.MustCompile(`(?i)%ext%`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For readability, this should get moved to the if w.config.DirSearchCompat
... block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think outside the loop is better so the regex doesn't get created for every line in the input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely, thanks for clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
No description provided.