-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* BeVigil Source Added * updated readme.md * updated .gitignore * fmt sources Co-authored-by: Mzack9999 <mzack9999@protonmail.com>
- Loading branch information
1 parent
2469035
commit 0aa8931
Showing
5 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
.DS_Store | ||
cmd/subfinder/subfinder | ||
# subfinder binary when built with `go build` | ||
v2/cmd/subfinder/subfinder | ||
# subfinder binary when built with `make` | ||
v2/subfinder | ||
vendor/ | ||
.idea | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Package bevigil logic | ||
package bevigil | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
jsoniter "github.com/json-iterator/go" | ||
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping" | ||
) | ||
|
||
type Response struct { | ||
Domain string `json:"domain"` | ||
Subdomains []string `json:"subdomains"` | ||
} | ||
|
||
type Source struct{} | ||
|
||
var apiKeys []string | ||
|
||
func (s *Source) Run(ctx context.Context, domain string, session *subscraping.Session) <-chan subscraping.Result { | ||
results := make(chan subscraping.Result) | ||
go func() { | ||
defer close(results) | ||
|
||
randomApiKey := subscraping.PickRandom(apiKeys) | ||
if randomApiKey == "" { | ||
return | ||
} | ||
|
||
getUrl := fmt.Sprintf("https://osint.bevigil.com/api/%s/subdomains/", domain) | ||
|
||
resp, err := session.Get(ctx, getUrl, "", map[string]string{"X-Access-Token": randomApiKey}) | ||
if err != nil { | ||
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err} | ||
session.DiscardHTTPResponse(resp) | ||
return | ||
} | ||
|
||
var subdomains []string | ||
var response Response | ||
err = jsoniter.NewDecoder(resp.Body).Decode(&response) | ||
if err != nil { | ||
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err} | ||
resp.Body.Close() | ||
return | ||
} | ||
|
||
resp.Body.Close() | ||
|
||
if len(response.Subdomains) > 0 { | ||
subdomains = response.Subdomains | ||
} | ||
|
||
for _, subdomain := range subdomains { | ||
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: subdomain} | ||
} | ||
}() | ||
|
||
return results | ||
} | ||
|
||
func (s *Source) Name() string { | ||
return "bevigil" | ||
} | ||
|
||
func (s *Source) IsDefault() bool { | ||
return true | ||
} | ||
|
||
func (s *Source) HasRecursiveSupport() bool { | ||
return false | ||
} | ||
|
||
func (s *Source) NeedsKey() bool { | ||
return true | ||
} | ||
|
||
func (s *Source) AddApiKeys(keys []string) { | ||
apiKeys = keys | ||
} |