Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source full hunt.io #476

Merged
merged 6 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions v2/pkg/passive/sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/virustotal"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/waybackarchive"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/zoomeye"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping/sources/fullhunt"
)

// DefaultSources contains the list of fast sources used by default.
Expand All @@ -62,6 +63,7 @@ var DefaultSources = []string{
"threatminer",
"virustotal",
"fofa",
"fullhunt",
}

// DefaultRecursiveSources contains list of default recursive sources
Expand Down Expand Up @@ -115,6 +117,7 @@ var DefaultAllSources = []string{
"waybackarchive",
"zoomeye",
"fofa",
"fullhunt",
}

// Agent is a struct for running passive subdomain enumeration
Expand Down Expand Up @@ -207,6 +210,8 @@ func (a *Agent) addSources(sources []string) {
a.sources[source] = &zoomeye.Source{}
case "fofa":
a.sources[source] = &fofa.Source{}
case "fullhunt":
a.sources[source] = &fullhunt.Source{}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion v2/pkg/runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ type ConfigFile struct {
Virustotal []string `yaml:"virustotal"`
ZoomEye []string `yaml:"zoomeye"`
Fofa []string `yaml:"fofa"`
FullHunt []string `json:"fullhunt"`
// Version indicates the version of subfinder installed.
Version string `yaml:"subfinder-version"`
}
Expand Down Expand Up @@ -207,6 +208,8 @@ func (c *ConfigFile) GetKeys() subscraping.Keys {
keys.FofaSecret = parts[1]
}
}

if len(c.FullHunt) > 0 {
keys.FullHunt = c.FullHunt[rand.Intn(len(c.FullHunt))]
}
return keys
}
52 changes: 52 additions & 0 deletions v2/pkg/subscraping/sources/fullhunt/fullhunt.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package fullhunt

import (
"context"
"fmt"

jsoniter "github.com/json-iterator/go"
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping"
)

//fullhunt response
type fullHuntResponse struct {
Hosts []string `json:"hosts"`
Message string `json:"message"`
Status int `json:"status"`
}

// Source is the passive scraping agent
type Source struct{}

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)

resp, err := session.Get(ctx, fmt.Sprintf("https://fullhunt.io/api/v1/domain/%s/subdomains", domain), "", map[string]string{"X-API-KEY": session.Keys.FullHunt})
if err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
session.DiscardHTTPResponse(resp)
return
}

var response fullHuntResponse
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()
for _, record := range response.Hosts {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: record}
}
}()
return results
}

// Name returns the name of the source
func (s *Source) Name() string {
return "fullhunt"
}
1 change: 1 addition & 0 deletions v2/pkg/subscraping/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Keys struct {
ZoomEyePassword string `json:"zoomeye_password"`
FofaUsername string `json:"fofa_username"`
FofaSecret string `json:"fofa_secret"`
FullHunt string `json:"fullhunt"`
}

// Result is a result structure returned by a source
Expand Down