diff --git a/librecursebuster/main_test.go b/librecursebuster/main_test.go index 5971231..c804a28 100644 --- a/librecursebuster/main_test.go +++ b/librecursebuster/main_test.go @@ -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 diff --git a/librecursebuster/testserver/main.go b/librecursebuster/testserver/main.go index 99d3271..d1ab40b 100644 --- a/librecursebuster/testserver/main.go +++ b/librecursebuster/testserver/main.go @@ -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": diff --git a/main.go b/main.go index 11be136..1226fa6 100644 --- a/main.go +++ b/main.go @@ -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")