-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix progress with patterns and backup discovery (#548)
* Account for patterns in total tries Specifying patterns for the word list will no longer cause progress to go past 100%. Additionally, the GobusterDir transformations for file extensions and backups will be applied after pattern expansion. Fixes #405, #480, and #533 * Run backup detection on success only This is done by re-arranging the code from exiting on channel close to using the contexts and the results counters to signal the end of work processing. A little more work is needed to prevent infinite loops caused by devious services/misconfiguration and to expose to the cli the ability to have patterns run on successful finds. Fixes #298 * Prioritize stopping when the context is done From the Go spec: > If one or more of the communications can proceed, a single one that > can proceed is chosen via a uniform pseudo-random selection. Previously, this meant that some indeterminate amount of work could have been completed after the context's cancel function had been called. * Prevent recursion of discovery guess Successful guesses from the wordlist or a pattern will have discovery patterns generated based on them and successful discovery guesses will not. Further processing should require human curation to avoid automatically generating an unbounded amount of traffic. Also fixes reading the wordlist from standard in by making it more like reading from a file now that we have dynamic progress updates. * Add option for arbitrary discovery patterns * Test only patterns if provided a pattern file * Update discover pattern option description
- Loading branch information
Showing
16 changed files
with
436 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package gobusterdir | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/OJ/gobuster/v3/libgobuster" | ||
) | ||
|
||
func TestAdditionalWordsLen(t *testing.T) { | ||
t.Parallel() | ||
|
||
tt := []struct { | ||
testName string | ||
extensions map[string]bool | ||
}{ | ||
{"No extensions", map[string]bool{}}, | ||
{"Some extensions", map[string]bool{"htm": true, "html": true, "php": true}}, | ||
} | ||
|
||
globalOpts := libgobuster.Options{} | ||
for _, x := range tt { | ||
opts := OptionsDir{} | ||
opts.ExtensionsParsed.Set = x.extensions | ||
|
||
d, _ := New(&globalOpts, &opts, nil) | ||
|
||
calculatedLen := d.AdditionalWordsLen() | ||
wordsLen := len(d.AdditionalWords("dummy")) | ||
|
||
if calculatedLen != wordsLen { | ||
t.Fatalf("Mismatched additional words length: %d got %d generated words %v", calculatedLen, wordsLen, d.AdditionalWords("dummy")) | ||
} | ||
} | ||
} |
Oops, something went wrong.