source- fullhunt
parent
9bb21fa7ab
commit
de25c58a7a
|
@ -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.
|
||||
|
@ -62,6 +63,7 @@ var DefaultSources = []string{
|
|||
"threatminer",
|
||||
"virustotal",
|
||||
"fofa",
|
||||
"fullhunt",
|
||||
}
|
||||
|
||||
// DefaultRecursiveSources contains list of default recursive sources
|
||||
|
@ -115,6 +117,7 @@ var DefaultAllSources = []string{
|
|||
"waybackarchive",
|
||||
"zoomeye",
|
||||
"fofa",
|
||||
"fullhunt",
|
||||
}
|
||||
|
||||
// Agent is a struct for running passive subdomain enumeration
|
||||
|
@ -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{}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package runner
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -48,6 +49,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"`
|
||||
}
|
||||
|
@ -207,6 +209,9 @@ func (c *ConfigFile) GetKeys() subscraping.Keys {
|
|||
keys.FofaSecret = parts[1]
|
||||
}
|
||||
}
|
||||
|
||||
if len(c.FullHunt) > 0 {
|
||||
keys.FullHunt = c.FullHunt[rand.Intn(len(c.FullHunt))]
|
||||
}
|
||||
fmt.Println("full hunt ky", keys.FullHunt)
|
||||
return keys
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package fullhunt
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/projectdiscovery/subfinder/v2/pkg/subscraping"
|
||||
)
|
||||
|
||||
//fullHunt response
|
||||
type fullHuntResponse struct {
|
||||
Hosts []hostDetails `json:"hosts"`
|
||||
Message string `json:"message"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
//hostDetails struct
|
||||
type hostDetails struct {
|
||||
Host string `json:"host"`
|
||||
}
|
||||
|
||||
// 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)
|
||||
// if session.Keys.FullHunt == "" {
|
||||
// return
|
||||
// }
|
||||
|
||||
resp, err := session.Get(ctx, fmt.Sprintf("https://fullhunt.io/api/v1/domain/%s/details", 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()
|
||||
fmt.Println("reading record data :", len(response.Hosts))
|
||||
var x = ""
|
||||
for _, record := range response.Hosts {
|
||||
x = fmt.Sprintf("\"%s,\"%s\"", x, record.Host)
|
||||
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Subdomain, Value: record.Host}
|
||||
}
|
||||
fmt.Print(len(x))
|
||||
}()
|
||||
return results
|
||||
}
|
||||
|
||||
// Name returns the name of the source
|
||||
func (s *Source) Name() string {
|
||||
return "fullhunt"
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue