Skip to content

Commit

Permalink
add ext test
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Sto committed Oct 19, 2018
1 parent 71435e8 commit a4e2d4c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
20 changes: 20 additions & 0 deletions librecursebuster/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,26 @@ func TestCookies(t *testing.T) {
panic("Failed Cookie test")
}
}
func TestExt(t *testing.T) {
finished := make(chan struct{})
cfg := getDefaultConfig()
cfg.Extensions = "csv,exe,aspx"
urlSlice := preSetupTest(cfg, "2010", finished, t)
found := postSetupTest(urlSlice)
gState.Wait()

if x, ok := found["/a.exe"]; !ok || !x {
panic("Failed Ext test1")
}

if x, ok := found["/a.aspx"]; !ok || !x {
panic("Failed Ext test2")
}

if x, ok := found["/a.csv"]; !ok || !x {
panic("Failed Ext test3")
}
}

func postSetupTest(urlSlice []string) (found map[string]bool) {
//start up the management goroutines
Expand Down
6 changes: 6 additions & 0 deletions librecursebuster/testserver/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ func handler(w http.ResponseWriter, r *http.Request) {
fallthrough
case "/a":
fallthrough
case "/a.exe":
fallthrough
case "/a.csv":
fallthrough
case "/a.aspx":
fallthrough
case "/a/":
fallthrough
case "/a/b":
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func main() {
flag.StringVar(&globalState.Cfg.Canary, "canary", "", "Custom value to use to check for wildcards") //todo: add test
flag.BoolVar(&globalState.Cfg.CleanOutput, "clean", false, "Output clean URLs to the output file for easy loading into other tools and whatnot.") //todo: add test
flag.StringVar(&globalState.Cfg.Cookies, "cookies", "", "Any cookies to include with requests. This is smashed into the cookies header, so copy straight from burp I guess? (-cookies 'cookie1=cookie1content; cookie2=1; cookie3=cookie3lol?!?;'.")
flag.BoolVar(&globalState.Cfg.Debug, "debug", false, "Enable debugging")
flag.BoolVar(&globalState.Cfg.Debug, "debug", false, "Enable debugging") //todo: add test
//flag.IntVar(&globalState.Cfg.MaxDirs, "dirs", 1, "Maximum directories to perform busting on concurrently forcing limit to 1 because it's complicated otherwise
flag.StringVar(&globalState.Cfg.Extensions, "ext", "", "Extensions to append to checks. Multiple extensions can be specified, comma separate them.")
flag.StringVar(&globalState.Cfg.Extensions, "ext", "", "Extensions to append to checks. Multiple extensions can be specified, comma separate them. (-ext 'csv,exe,aspx')")
flag.Var(&globalState.Cfg.Headers, "headers", "Additional headers to include with request. Supply as key:value. Can specify multiple - eg '-headers X-Forwarded-For:127.0.01 -headers X-ATT-DeviceId:XXXXX'")
flag.BoolVar(&globalState.Cfg.HTTPS, "https", false, "Use HTTPS instead of HTTP.")
flag.StringVar(&globalState.Cfg.InputList, "iL", "", "File to use as an input list of URL's to start from")
Expand Down

0 comments on commit a4e2d4c

Please sign in to comment.