From d58c76a5447c6600783db5799ca086b74c30ea18 Mon Sep 17 00:00:00 2001 From: CyberRoute Date: Thu, 23 Nov 2023 16:26:58 +0100 Subject: [PATCH] addressing issue #28 --- cmd/bruter/routes.go | 18 ++++++++++++------ pkg/fuzzer/fuzzer.go | 1 - 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/cmd/bruter/routes.go b/cmd/bruter/routes.go index 4ab7318..7b4284f 100644 --- a/cmd/bruter/routes.go +++ b/cmd/bruter/routes.go @@ -2,6 +2,9 @@ package main import ( "crypto/tls" + "html/template" + "net/http" + "github.com/CyberRoute/bruter/pkg/config" "github.com/CyberRoute/bruter/pkg/grabber" "github.com/CyberRoute/bruter/pkg/handlers" @@ -11,8 +14,6 @@ import ( "github.com/CyberRoute/bruter/pkg/ssl" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" - "html/template" - "net/http" ) func checkError(err error) { @@ -51,6 +52,7 @@ func routes(app *config.AppConfig) http.Handler { sslinfo []map[string]interface{} ) + // Step 1: Execute functions that don't depend on hostinfo.Ports RunConcurrently( func() { hostinfo, err = sh.HostInfo(app) @@ -68,6 +70,14 @@ func routes(app *config.AppConfig) http.Handler { whoisinfo, err = network.WhoisLookup(app.Domain) checkError(err) }, + func() { + sslinfo, err = ssl.FetchCrtData(app.Domain) + checkError(err) + }, + ) + + // Step 2: Execute functions that depend on hostinfo.Ports + RunConcurrently( func() { mysql, err = grabber.GrabMysqlBanner(app.Domain, hostinfo.Ports) checkError(err) @@ -92,10 +102,6 @@ func routes(app *config.AppConfig) http.Handler { irc, err = grabber.GrabIRCBanner(app.Domain, hostinfo.Ports) checkError(err) }, - func() { - sslinfo, err = ssl.FetchCrtData(app.Domain) - checkError(err) - }, ) homeargs := models.HomeArgs{ Ipv4: ipv4, diff --git a/pkg/fuzzer/fuzzer.go b/pkg/fuzzer/fuzzer.go index 8d214d0..51a04c8 100644 --- a/pkg/fuzzer/fuzzer.go +++ b/pkg/fuzzer/fuzzer.go @@ -52,7 +52,6 @@ func Get(Mu *sync.Mutex, app *config.AppConfig, domain, path string, progress fl if resp != nil && resp.StatusCode == http.StatusMovedPermanently || resp.StatusCode == http.StatusFound { //status codes 301 302 // Add the RedirectPath field to the payload redirectPath := resp.Header.Get("Location") - fmt.Println(redirectPath) payload := &models.Url{Path: urjoin, Progress: progress, Status: float64(resp.StatusCode), RedirectPath: redirectPath} payloadBuf := new(bytes.Buffer) err = json.NewEncoder(payloadBuf).Encode(payload)