From db458dba3b7258399203f950895f27888d14fd8b Mon Sep 17 00:00:00 2001 From: CyberRoute Date: Sat, 21 Oct 2023 21:29:45 +0200 Subject: [PATCH 1/6] implementing certs info --- cmd/bruter/routes.go | 7 +++++++ db/dict_short.txt | 7 ++++++- pkg/fuzzer/fuzzer.go | 5 ++--- pkg/handlers/handlers.go | 11 +++++++++++ pkg/models/home.go | 5 ++++- pkg/models/templatedata.go | 1 + pkg/ssl/crt.go | 1 - templates/base.layout.html | 5 ++++- 8 files changed, 35 insertions(+), 7 deletions(-) diff --git a/cmd/bruter/routes.go b/cmd/bruter/routes.go index 8cfa38e..a0534ac 100644 --- a/cmd/bruter/routes.go +++ b/cmd/bruter/routes.go @@ -8,6 +8,7 @@ import ( "github.com/CyberRoute/bruter/pkg/models" "github.com/CyberRoute/bruter/pkg/network" "github.com/CyberRoute/bruter/pkg/shodan" + "github.com/CyberRoute/bruter/pkg/ssl" "github.com/go-chi/chi/v5" "github.com/go-chi/chi/v5/middleware" "github.com/rs/zerolog/log" @@ -53,6 +54,8 @@ func routes(app *config.AppConfig) http.Handler { checkError(err) irc, err := grabber.GrabIRCBanner(app.Domain, hostinfo.Ports) checkError(err) + sslinfo, err := ssl.FetchCrtData(app.Domain) + checkError(err) homeargs := models.HomeArgs{ Ipv4: ipv4, Ipv6: ipv6, @@ -66,7 +69,11 @@ func routes(app *config.AppConfig) http.Handler { Pop: pop, Irc: irc, } + sslargs := models.HomeArgs{ + SSLInfo: sslinfo, + } mux.Get("/", handlers.Repo.Home(homeargs)) + mux.Get("/ssl", handlers.Repo.SSLInfo(sslargs)) mux.Get("/consumer", handlers.Repo.Consumer) fileServer := http.FileServer(http.Dir("./static/")) mux.Handle("/static/*", http.StripPrefix("/static", fileServer)) diff --git a/db/dict_short.txt b/db/dict_short.txt index 49b8c27..54216d9 100644 --- a/db/dict_short.txt +++ b/db/dict_short.txt @@ -113,4 +113,9 @@ /.cask /.catalog /.cc-ban.txt -/.cc-ban.txt.bak \ No newline at end of file +/.cc-ban.txt.bak +/%EXT%.7z +/%EXT%.backup +/%EXT%.bak +/%EXT%.cgi +/%EXT%.conf \ No newline at end of file diff --git a/pkg/fuzzer/fuzzer.go b/pkg/fuzzer/fuzzer.go index de7c603..844e712 100644 --- a/pkg/fuzzer/fuzzer.go +++ b/pkg/fuzzer/fuzzer.go @@ -5,14 +5,13 @@ import ( "crypto/tls" "encoding/json" "fmt" + "github.com/CyberRoute/bruter/pkg/models" + "github.com/rs/zerolog/log" "io" "net/http" "net/url" "os" "sync" - - "github.com/CyberRoute/bruter/pkg/models" - "github.com/rs/zerolog/log" ) func checkError(err error) { diff --git a/pkg/handlers/handlers.go b/pkg/handlers/handlers.go index c3f80a6..5d079ad 100644 --- a/pkg/handlers/handlers.go +++ b/pkg/handlers/handlers.go @@ -11,6 +11,7 @@ import ( "github.com/CyberRoute/bruter/pkg/config" "github.com/CyberRoute/bruter/pkg/models" "github.com/CyberRoute/bruter/pkg/render" + "github.com/CyberRoute/bruter/pkg/ssl" "github.com/rs/zerolog" "github.com/rs/zerolog/log" ) @@ -67,6 +68,16 @@ func (m *Repository) Home(args models.HomeArgs) http.HandlerFunc { } } +func (m *Repository) SSLInfo(args models.HomeArgs) http.HandlerFunc { + return func(w http.ResponseWriter, r *http.Request) { + sslinfo, err := ssl.FetchCrtData(m.App.Domain) + checkError(err) + render.RenderTemplate(w, "ssl.page.html", &models.TemplateData{ + SSLInfo: sslinfo, + }) + } +} + func (m *Repository) Consumer(w http.ResponseWriter, r *http.Request) { // acquire lock m.App.Mu.Lock() diff --git a/pkg/models/home.go b/pkg/models/home.go index 6f86337..d5a0aab 100644 --- a/pkg/models/home.go +++ b/pkg/models/home.go @@ -1,6 +1,8 @@ package models -import "github.com/CyberRoute/bruter/pkg/shodan" +import ( + "github.com/CyberRoute/bruter/pkg/shodan" +) type HomeArgs struct { Ipv4 string @@ -8,6 +10,7 @@ type HomeArgs struct { Host shodan.Response Headers map[string]interface{} Mx map[string]uint16 + SSLInfo []map[string]interface{} Ftp string Ssh string Mysql string diff --git a/pkg/models/templatedata.go b/pkg/models/templatedata.go index 2b2cb77..6108f40 100644 --- a/pkg/models/templatedata.go +++ b/pkg/models/templatedata.go @@ -8,6 +8,7 @@ type TemplateData struct { Data map[string]interface{} HeadersMap map[string]interface{} FtpBannerGrabberMap map[string]interface{} + SSLInfo []map[string]interface{} CSRFToken string Flash string Warning string diff --git a/pkg/ssl/crt.go b/pkg/ssl/crt.go index e0f8392..ea6ebbe 100644 --- a/pkg/ssl/crt.go +++ b/pkg/ssl/crt.go @@ -20,6 +20,5 @@ func FetchCrtData(domain string) ([]map[string]interface{}, error) { if err != nil { return nil, err } - return data, nil } diff --git a/templates/base.layout.html b/templates/base.layout.html index 2eb9b53..07f942c 100644 --- a/templates/base.layout.html +++ b/templates/base.layout.html @@ -27,13 +27,16 @@