Skip to content

Commit

Permalink
Merge pull request #22 from CyberRoute/cert_info
Browse files Browse the repository at this point in the history
implementing certs info
  • Loading branch information
CyberRoute authored Oct 26, 2023
2 parents e4e8586 + b415827 commit fe6d49a
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ What does it do?
# Usage
```
Usage of /tmp/go-build2863756334/b001/exe/main:
-address string
IP address to bind the web ui server to. (default "127.0.0.1")
-dictionary string
Expand Down
6 changes: 4 additions & 2 deletions cmd/bruter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"math"
"net/http"
"os"
"strings"
Expand Down Expand Up @@ -116,12 +117,13 @@ func main() {
})

for index, payload := range list {
index += shift
modifiedIndex := index + shift

// Replace %EXT% with extensions
payload = strings.ReplaceAll(payload, "%EXT%", "js")

progress := 100 * float32(index) / float32(total)
progress := 100 * float32(modifiedIndex) / float32(total)
progress = float32(math.Round(float64(progress))) // Round the progress to the nearest integer
queue.Add(async.Job(&workerContext{
Mu: &app.Mu,
Domain: *Domain,
Expand Down
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
7 changes: 7 additions & 0 deletions pkg/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"net/url"
"os"
"sort"
"sync"

"github.com/CyberRoute/bruter/pkg/models"
Expand Down Expand Up @@ -107,6 +108,12 @@ func readUrlsFromFile(filename string) (models.AllUrls, error) {
}

func writeUrlsToFile(filename string, allUrls models.AllUrls) error {
// Sort the URLs based on the Progress field in ascending order
sort.Slice(allUrls.Urls, func(i, j int) bool {
return allUrls.Urls[i].Progress < allUrls.Urls[j].Progress
})

// Marshal and write the sorted URLs to the file
newUserBytes, err := json.MarshalIndent(allUrls.Urls, "", " ")
if err != nil {
return err
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">crt.sh Info</a>
</li>
</ul>
</div>
</div>
Expand Down
29 changes: 29 additions & 0 deletions templates/ssl.page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{{template "base" .}}

{{define "content"}}
<div class="container-fluid">
<div class="row">
<div class="col">
{{if .SSLInfo}}
{{range .SSLInfo}}
<div class="card bg-dark text-light mb-4">
<div class="card-body">
<div class="card-header bg-success">
<h5><i class="bi bi-search"></i> crt.sh ID: </b> {{printf "%0.0f" .id}} </h5>
</div>
<div class="mt-3">
<p class="text-break"><b>Common Name:</b> {{.common_name}}</p>
<p class="text-break"><b>Matching Identities:</b> {{.name_value}}</p>
<p class="text-break"><b>Issuer Name:</b> {{.issuer_name}}</p>
</div>
</div>
</div>
{{else}}
<p>No SSL information available for this domain.</p>
{{end}}
</div>
</div>
</div>
{{end}}

{{end}}

0 comments on commit fe6d49a

Please sign in to comment.