sources

package
v1.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Todo: replace from utils with ConfigDirOrDefault
	UncoverConfigDir = filepath.Join(folderutil.HomeDirOrDefault("."), ".config/uncover")
	// DefaultProviderConfigLocation where keys and config of providers are stored
	DefaultProviderConfigLocation = filepath.Join(UncoverConfigDir, "provider-config.yaml")
)
View Source
var DefaultRateLimits = map[string]*ratelimit.Options{
	"shodan":     {Key: "shodan", MaxCount: 1, Duration: time.Second},
	"shodan-idb": {Key: "shodan-idb", MaxCount: 1, Duration: time.Second},
	"fofa":       {Key: "fofa", MaxCount: 1, Duration: time.Second},
	"censys":     {Key: "censys", MaxCount: 1, Duration: 3 * time.Second},
	"quake":      {Key: "quake", MaxCount: 1, Duration: time.Second},
	"hunter":     {Key: "hunter", MaxCount: 15, Duration: time.Second},
	"zoomeye":    {Key: "zoomeye", MaxCount: 1, Duration: time.Second},
	"netlas":     {Key: "netlas", MaxCount: 1, Duration: time.Second},
	"criminalip": {Key: "criminalip", MaxCount: 1, Duration: time.Second},
	"publicwww":  {Key: "publicwww", MaxCount: 1, Duration: time.Minute},
	"hunterhow":  {Key: "hunterhow", MaxCount: 1, Duration: 3 * time.Second},
}

DefaultRateLimits of all/most of sources are hardcoded by default to improve performance engine is not present in default ratelimits then user given ratelimit from cli options is used

Functions

func GetHostname

func GetHostname(u string) (string, error)

func NewHTTPRequest

func NewHTTPRequest(method, url string, body io.Reader) (*retryablehttp.Request, error)

Types

type Agent

type Agent interface {
	Query(*Session, *Query) (chan Result, error)
	Name() string
}

type Keys

type Keys struct {
	CensysToken     string
	CensysSecret    string
	Shodan          string
	FofaEmail       string
	FofaKey         string
	QuakeToken      string
	HunterToken     string
	ZoomEyeToken    string
	NetlasToken     string
	CriminalIPToken string
	PublicwwwToken  string
	HunterHowToken  string
}

func (Keys) Empty

func (keys Keys) Empty() bool

type Provider

type Provider struct {
	Shodan     []string `yaml:"shodan"`
	Censys     []string `yaml:"censys"`
	Fofa       []string `yaml:"fofa"`
	Quake      []string `yaml:"quake"`
	Hunter     []string `yaml:"hunter"`
	ZoomEye    []string `yaml:"zoomeye"`
	Netlas     []string `yaml:"netlas"`
	CriminalIP []string `yaml:"criminalip"`
	Publicwww  []string `yaml:"publicwww"`
	HunterHow  []string `yaml:"hunterhow"`
}

func NewProvider

func NewProvider() *Provider

NewProvider loads provider keys from default location and env variables

func (*Provider) GetKeys

func (provider *Provider) GetKeys() Keys

func (*Provider) HasKeys

func (provider *Provider) HasKeys() bool

HasKeys returns true if at least one agent/source has keys

func (*Provider) LoadProviderConfig

func (provider *Provider) LoadProviderConfig(location string) error

LoadProvidersFrom loads provider config from given location

func (*Provider) LoadProviderKeysFromEnv

func (provider *Provider) LoadProviderKeysFromEnv()

LoadProviderKeysFromEnv loads provider keys from env variables

type Query

type Query struct {
	Query string
	Limit int
}

type Result

type Result struct {
	Timestamp int64  `json:"timestamp"`
	Source    string `json:"source"`
	IP        string `json:"ip"`
	Port      int    `json:"port"`
	Host      string `json:"host"`
	Url       string `json:"url"`
	Raw       []byte `json:"-"`
	Error     error  `json:"-"`
}

func (*Result) HostPort

func (result *Result) HostPort() string

func (*Result) IpPort

func (result *Result) IpPort() string

func (*Result) JSON

func (result *Result) JSON() string

func (*Result) RawData

func (result *Result) RawData() string

type Session

type Session struct {
	Keys       *Keys
	Client     *retryablehttp.Client
	RetryMax   int
	RateLimits *ratelimit.MultiLimiter
}

Session handles session agent sessions

func NewSession

func NewSession(keys *Keys, retryMax, timeout, rateLimit int, engines []string, duration time.Duration) (*Session, error)

func (*Session) Do

func (s *Session) Do(request *retryablehttp.Request, source string) (*http.Response, error)

Directories

Path Synopsis
agent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL