Skip to content

Commit

Permalink
implementing certs info
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberRoute committed Oct 21, 2023
1 parent 329248e commit db458db
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 7 deletions.
7 changes: 7 additions & 0 deletions cmd/bruter/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand All @@ -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))
Expand Down
7 changes: 6 additions & 1 deletion db/dict_short.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,9 @@
/.cask
/.catalog
/.cc-ban.txt
/.cc-ban.txt.bak
/.cc-ban.txt.bak
/%EXT%.7z
/%EXT%.backup
/%EXT%.bak
/%EXT%.cgi
/%EXT%.conf
5 changes: 2 additions & 3 deletions pkg/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions pkg/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion pkg/models/home.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package models

import "github.com/CyberRoute/bruter/pkg/shodan"
import (
"github.com/CyberRoute/bruter/pkg/shodan"
)

type HomeArgs struct {
Ipv4 string
Ipv6 string
Host shodan.Response
Headers map[string]interface{}
Mx map[string]uint16
SSLInfo []map[string]interface{}
Ftp string
Ssh string
Mysql string
Expand Down
1 change: 1 addition & 0 deletions pkg/models/templatedata.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pkg/ssl/crt.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,5 @@ func FetchCrtData(domain string) ([]map[string]interface{}, error) {
if err != nil {
return nil, err
}

return data, nil
}
5 changes: 4 additions & 1 deletion templates/base.layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#">Scan Report Dashboard</a>
<a class="navbar-brand" href="/">Scan Report Dashboard</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/ssl">SSLInfo</a>
</li>
</ul>
</div>
</div>
Expand Down

0 comments on commit db458db

Please sign in to comment.