Skip to content

Commit

Permalink
reduce complexity in some funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Sto committed Nov 19, 2018
1 parent a0e6afd commit a5dc966
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 48 deletions.
3 changes: 0 additions & 3 deletions librecursebuster/logic.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,9 @@ func (gState *State) ManageRequests() {
for _, method := range gState.Methods {
if page.Result == nil && !gState.Cfg.NoBase {
gState.wg.Add(1)
//go gState.testURL(method, page.URL, gState.Client)
gState.Chans.workersChan <- workUnit{
Method: method,
URLString: page.URL,
//Client: gState.Client,
}
}
if gState.Cfg.Wordlist != "" && string(page.URL[len(page.URL)-1]) == "/" { //if we are testing a directory
Expand Down Expand Up @@ -155,7 +153,6 @@ func (gState *State) testURL(method string, urlString string, client *http.Clien
case gState.Chans.testChan <- method + ":" + urlString:
default: //this is to prevent blocking, it doesn't _really_ matter if it doesn't get written to output
}
//gState.Chans.workersChan <- struct{}{}
headResp, content, good := gState.evaluateURL(method, urlString, client)

if !good && !gState.Cfg.ShowAll {
Expand Down
65 changes: 20 additions & 45 deletions librecursebuster/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,13 @@ func TestBasicFunctionality(t *testing.T) {

//check for each specific line that should be in there..
tested := []string{}
ok200 := []string{
ok := []string{
"/a", "/a/b", "/a/b/c", "/a/", "/spideronly",
}
for _, i := range ok200 {
tested = append(tested, i)
if x, ok := found[i]; !ok || x == nil {
t.Error("Did not find " + i)
}
}
ok300 := []string{
"/b", "/b/c",
}
for _, i := range ok300 {
tested = append(tested, i)
if x, ok := found[i]; !ok || x == nil {
t.Error("Did not find " + i)
}
}
ok400 := []string{
"/a/b/c/", "/a/b/c/d",
}
for _, i := range ok400 {
tested = append(tested, i)
if x, ok := found[i]; !ok || x == nil {
t.Error("Did not find " + i)
}
}
ok500 := []string{
"/c/d", "/c", "/c/",
}
for _, i := range ok500 {
for _, i := range ok {
tested = append(tested, i)
if x, ok := found[i]; !ok || x == nil {
t.Error("Did not find " + i)
Expand Down Expand Up @@ -577,47 +553,46 @@ z

func getDefaultConfig() *Config {
return &Config{
Version: "TEST",
ShowAll: false,
AppendDir: true,
Auth: "",
BadResponses: "404",
BadHeader: nil, //ArrayStringFlag{} // "" // "Check for presence of this header. If an exact match is found"
//BodyContent, ""
Version: "TEST",
ShowAll: false,

Agent: "RecurseBuster/" + "TESTING",
AppendDir: true,
Auth: "",
BadHeader: nil, //ArrayStringFlag{} // "" // "Check for presence of this header. If an exact match is found"
BadResponses: "404",
BlacklistLocation: "",
BurpMode: false,
Canary: "",
CleanOutput: false,
Cookies: "",
Debug: false,
//MaxDirs: 1
Extensions: "",
FollowRedirects: false,
Headers: nil, // "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'")
HTTPS: false,
InputList: "",
SSLIgnore: false,
ShowLen: false,
Localpath: "." + string(os.PathSeparator) + "busted.txt",
Methods: "GET",
NoBase: false,
NoGet: false,
NoHead: false,
NoRecursion: false,
NoSpider: false,
NoStatus: false,
NoStartStop: false,
NoWildcardChecks: false,
NoStatus: false,
NoUI: true,
Localpath: "." + string(os.PathSeparator) + "busted.txt",
Methods: "GET",
NoWildcardChecks: false,
ProxyAddr: "",
Ratio404: 0.95,
FollowRedirects: false,
BurpMode: false,
ShowLen: false,
ShowVersion: false,
SSLIgnore: false,
Threads: 1,
Timeout: 20,
Agent: "RecurseBuster/" + "TESTING",
VerboseLevel: 0,
ShowVersion: false,
Wordlist: "",
WhitelistLocation: "",
Wordlist: "",

URL: localURL,
}
Expand Down

0 comments on commit a5dc966

Please sign in to comment.