Configs for censys

master
Ice3man543 2019-12-05 15:39:42 +05:30
parent 8c55e4201a
commit 72be49a73c
3 changed files with 17 additions and 11 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/subfinder/subfinder/pkg/subscraping/sources/archiveis"
"github.com/subfinder/subfinder/pkg/subscraping/sources/binaryedge"
"github.com/subfinder/subfinder/pkg/subscraping/sources/bufferover"
"github.com/subfinder/subfinder/pkg/subscraping/sources/censys"
"github.com/subfinder/subfinder/pkg/subscraping/sources/certspotter"
"github.com/subfinder/subfinder/pkg/subscraping/sources/certspotterold"
"github.com/subfinder/subfinder/pkg/subscraping/sources/commoncrawl"
@ -31,6 +32,7 @@ var DefaultSources = []string{
"archiveis",
"binaryedge",
"bufferover",
"censys",
"certspotter",
"certspotterold",
"commoncrawl",
@ -80,6 +82,8 @@ func (a *Agent) addSources(sources []string) {
a.sources[source] = &binaryedge.Source{}
case "bufferover":
a.sources[source] = &bufferover.Source{}
case "censys":
a.sources[source] = &censys.Source{}
case "certspotter":
a.sources[source] = &certspotter.Source{}
case "certspotterold":

View File

@ -20,8 +20,8 @@ type ConfigFile struct {
ExcludeSources []string `yaml:"exclude-sources,omitempty"`
// API keys for different sources
Binaryedge []string `yaml:"binaryedge"`
Censys []string `yaml:"censys"`
Certspotter []string `yaml:"certspotter"`
Facebook []string `yaml:"facebook"`
PassiveTotal []string `yaml:"passivetotal"`
SecurityTrails []string `yaml:"securitytrails"`
Shodan []string `yaml:"shodan"`
@ -94,18 +94,20 @@ func (c ConfigFile) GetKeys() subscraping.Keys {
if len(c.Binaryedge) > 0 {
keys.Binaryedge = c.Binaryedge[rand.Intn(len(c.Binaryedge))]
}
if len(c.Censys) > 0 {
censysKeys := c.Censys[rand.Intn(len(c.Censys))]
parts := strings.Split(censysKeys, ":")
if len(parts) == 2 {
keys.CensysUsername = parts[0]
keys.CensysPassword = parts[1]
}
}
if len(c.Certspotter) > 0 {
keys.Certspotter = c.Certspotter[rand.Intn(len(c.Certspotter))]
}
if len(c.Facebook) > 0 {
facebookKeys := c.Facebook[rand.Intn(len(c.Facebook))]
parts := strings.Split(facebookKeys, ":")
if len(parts) == 2 {
keys.FacebookAppID = parts[0]
keys.FacebookAppSecret = parts[1]
}
}
if len(c.PassiveTotal) > 0 {
passiveTotalKeys := c.PassiveTotal[rand.Intn(len(c.PassiveTotal))]
parts := strings.Split(passiveTotalKeys, ":")

View File

@ -30,9 +30,9 @@ type Session struct {
// Keys contains the current API Keys we have in store
type Keys struct {
Binaryedge string `json:"binaryedge"`
CensysToken string `json:"censysUsername"`
CensysSecret string `json:"censysPassword"`
Certspotter string `json:"certspotter"`
FacebookAppID string `json:"facebook_appid"`
FacebookAppSecret string `json:"facebook_appsecret"`
PassiveTotalUsername string `json:"passivetotal_username"`
PassiveTotalPassword string `json:"passivetotal_password"`
Securitytrails string `json:"securitytrails"`