Skip to content

Commit

Permalink
feat: Add bevigil source
Browse files Browse the repository at this point in the history
  • Loading branch information
enenumxela committed Jun 25, 2023
1 parent 25d892b commit f513331
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
66 changes: 66 additions & 0 deletions pkg/xsubfind3r/sources/bevigil/bevigil.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package bevigil

import (
"encoding/json"
"fmt"

"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/httpclient"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources"
"github.com/valyala/fasthttp"
)

type response struct {
Domain string `json:"domain"`
Subdomains []string `json:"subdomains"`
}

type Source struct{}

func (source *Source) Run(config *sources.Configuration) (subdomains chan sources.Subdomain) {
subdomains = make(chan sources.Subdomain)

go func() {
defer close(subdomains)

var (
key string
err error
res *fasthttp.Response
headers = map[string]string{}
)

key, err = sources.PickRandom(config.Keys.Bevigil)
if key == "" || err != nil {
return
}

if len(config.Keys.Bevigil) > 0 {
headers["X-Access-Token"] = key
}

reqURL := fmt.Sprintf("https://osint.bevigil.com/api/%s/subdomains/", config.Domain)

res, err = httpclient.Request(fasthttp.MethodGet, reqURL, "", headers, nil)
if err != nil {
return
}

body := res.Body()

var results response

if err = json.Unmarshal(body, &results); err != nil {
return
}

for _, i := range results.Subdomains {
subdomains <- sources.Subdomain{Source: source.Name(), Value: i}
}
}()

return
}

func (source *Source) Name() string {
return "bevigil"
}
1 change: 1 addition & 0 deletions pkg/xsubfind3r/sources/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type Configuration struct {
}

type Keys struct {
Bevigil []string `yaml:"bevigil"`
Chaos []string `yaml:"chaos"`
GitHub []string `yaml:"github"`
Intelx []string `yaml:"intelx"`
Expand Down
1 change: 1 addition & 0 deletions pkg/xsubfind3r/sources/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var List = []string{
"alienvault",
"anubis",
"archiveis",
"bevigil",
"bufferover",
"cebaidu",
"certspotterv0",
Expand Down
3 changes: 3 additions & 0 deletions pkg/xsubfind3r/xsubfind3r.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/alienvault"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/anubis"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/archiveis"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/bevigil"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/bufferover"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/cebaidu"
"github.com/hueristiq/xsubfind3r/pkg/xsubfind3r/sources/certspotterv0"
Expand Down Expand Up @@ -62,6 +63,8 @@ func New(options *Options) (finder *Finder) {
finder.Sources[source] = &anubis.Source{}
case "archiveis":
finder.Sources[source] = &archiveis.Source{}
case "bevigil":
finder.Sources[source] = &bevigil.Source{}
case "bufferover":
finder.Sources[source] = &bufferover.Source{}
case "cebaidu":
Expand Down

0 comments on commit f513331

Please sign in to comment.