Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grabbers #30

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions cmd/bruter/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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,
Expand Down
1 change: 0 additions & 1 deletion pkg/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down