Skip to content

Commit 19f0dda

Browse files
committed
Directories are now recursed into in order :)
1 parent 7d4dce4 commit 19f0dda

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/shortscan/shortscan.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ type attackConfig struct {
7676
fileChars map[string]string
7777
extChars map[string]string
7878
foundFiles map[string]struct{}
79-
foundDirectories map[string]struct{}
79+
foundDirectories []string
8080
wordlist wordlistConfig
8181
distanceMutex sync.Mutex
8282
autocompleteMutex sync.Mutex
@@ -109,7 +109,7 @@ type statsOutput struct {
109109
}
110110

111111
// Version, rainbow table magic, default character set
112-
const version = "0.9.0"
112+
const version = "0.9.1"
113113
const rainbowMagic = "#SHORTSCAN#"
114114
const alphanum = "JFKGOTMYVHSPCANDXLRWEBQUIZ8549176320"
115115

@@ -436,7 +436,7 @@ func enumerate(sem chan struct{}, wg *sync.WaitGroup, hc *http.Client, st *httpS
436436
if l := res.Header.Get("Location"); strings.HasSuffix(strings.ToLower(l), "/"+strings.ToLower(fnr)+"/") {
437437

438438
// Add the directory to the list for later recursion
439-
ac.foundDirectories[fnr] = struct{}{}
439+
ac.foundDirectories = append(ac.foundDirectories, fnr)
440440

441441
}
442442

@@ -1004,7 +1004,6 @@ func Scan(urls []string, hc *http.Client, st *httpStats, wc wordlistConfig, mk m
10041004

10051005
// Initialise things
10061006
ac.foundFiles = make(map[string]struct{})
1007-
ac.foundDirectories = make(map[string]struct{})
10081007
sem := make(chan struct{}, args.Concurrency)
10091008
wg := new(sync.WaitGroup)
10101009

@@ -1015,8 +1014,8 @@ func Scan(urls []string, hc *http.Client, st *httpStats, wc wordlistConfig, mk m
10151014
wg.Wait()
10161015

10171016
// Prepend discovered directories for processing next iteration
1018-
for dir := range ac.foundDirectories {
1019-
urls = append([]string{url + dir + "/"}, urls...)
1017+
for i := len(ac.foundDirectories) - 1; i >= 0; i-- {
1018+
urls = append([]string{url + ac.foundDirectories[i] + "/"}, urls...)
10201019
}
10211020

10221021
// <hr>

0 commit comments

Comments
 (0)