gobuster-lib/gobusters3/result.go
2024-09-04 23:15:35 +03:00

36 lines
560 B
Go

package gobusters3
import (
"bytes"
"github.com/fatih/color"
)
var (
green = color.New(color.FgGreen).FprintfFunc()
)
// Result represents a single result
type Result struct {
Found bool
BucketName string
Status string
}
// ResultToString converts the Result to it's textual representation
func (r Result) ResultToString() (string, error) {
buf := &bytes.Buffer{}
c := green
c(buf, "http://%s.s3.amazonaws.com/", r.BucketName)
if r.Status != "" {
c(buf, " [%s]", r.Status)
}
c(buf, "\n")
str := buf.String()
return str, nil
}