Documentation ¶
Overview ¶
Package shodan is an interface for the Shodan API
Index ¶
- type APIInfo
- type DNSResolve
- type DNSReverse
- type Error
- type Exploit
- type Host
- type HostCount
- type HostSearch
- type HostSearchTokens
- type Query
- type QueryTags
- type Scan
- type ScanInternet
- type ShodanClient
- func (c *ShodanClient) APIInfo() (*APIInfo, error)
- func (c *ShodanClient) DNSResolve(hostnames []string) ([]DNSResolve, error)
- func (c *ShodanClient) DNSReverse(ips []string) ([]DNSReverse, error)
- func (c *ShodanClient) Exploits(query string, facets []string) (*Exploit, error)
- func (c *ShodanClient) Host(ip string, params map[string]string) (*Host, error)
- func (c *ShodanClient) HostCount(query string, facets []string) (*HostCount, error)
- func (c *ShodanClient) HostSearch(query string, facets []string, params map[string]string) (*HostSearch, error)
- func (c *ShodanClient) HostSearchTokens(query string) (*HostSearchTokens, error)
- func (c *ShodanClient) Protocols() (map[string]string, error)
- func (c *ShodanClient) Query(params map[string]string) (*Query, error)
- func (c *ShodanClient) QuerySearch(query string, params map[string]string) (*Query, error)
- func (c *ShodanClient) QueryTags(params map[string]string) (*QueryTags, error)
- func (c *ShodanClient) Services() (map[string]string, error)
- func (c *ShodanClient) UserProfile() ([]byte, error)
- type ShodanUser
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIInfo ¶
type APIInfo struct { QueryCredits int `json:"query_credits"` ScanCredits int `json:"scan_credits"` Telnet bool `json:"telnet"` Plan string `json:"plan"` HTTPS bool `json:"https"` Unlocked bool `json:"unlocked"` }
APIInfo is used to unmarshal the JSON response from '/shodan/api-info'.
type DNSResolve ¶
DNSResolve is used to transform the map[string]string response from '/dns/resolve' into a struct that is a bit easier to work with.
type DNSReverse ¶
DNSReverse is used to transform the map[string][]string response from '/dns/reverse' into a struct that is a bit easier to work with.
type Error ¶
type Error struct {
Error string `json:"error"`
}
Error used to unmarshal the JSON response of an error.
type Exploit ¶
type Exploit struct { Matches []struct { Source string `json:"source"` ID interface{} `json:"_id"` Author interface{} `json:"author"` Code interface{} `json:"code"` Date time.Time `json:"date"` Platform interface{} `json:"platform"` Port int `json:"port"` Type string `json:"type"` Description string `json:"description"` Osvdb []int `json:"osvdb"` Bid []int `json:"bid"` Cve []string `json:"cve"` Msb []interface{} `json:"msb"` } `json:"matches"` Total int `json:"total"` }
Exploit is used to unmarshal the JSON response from '/api/search'.
type Host ¶
type Host struct { RegionCode string `json:"region_code"` IP int `json:"ip"` AreaCode int `json:"area_code"` Latitude float64 `json:"latitude"` Hostnames []string `json:"hostnames"` PostalCode string `json:"postal_code"` DmaCode int `json:"dma_code"` CountryCode string `json:"country_code"` Org string `json:"org"` Data []struct { Product string `json:"product"` Title string `json:"title"` Opts struct{} `json:"opts"` Timestamp string `json:"timestamp"` Isp string `json:"isp"` Cpe []string `json:"cpe"` Data string `json:"data"` HTML string `json:"html"` Location struct { City string `json:"city"` RegionCode string `json:"region_code"` AreaCode int `json:"area_code"` Longitude float64 `json:"longitude"` CountryCode3 string `json:"country_code3"` Latitude float64 `json:"latitude"` PostalCode string `json:"postal_code"` DmaCode int `json:"dma_code"` CountryCode string `json:"country_code"` CountryName string `json:"country_name"` } `json:"location"` IP int `json:"ip"` Domains []string `json:"domains"` Org string `json:"org"` Os interface{} `json:"os"` Port int `json:"port"` Hostnames []string `json:"hostnames"` IPStr string `json:"ip_str"` } `json:"data"` City string `json:"city"` Isp string `json:"isp"` Asn string `json:"asn"` Longitude float64 `json:"longitude"` LastUpdate string `json:"last_update"` CountryCode3 string `json:"country_code3"` CountryName string `json:"country_name"` IPStr string `json:"ip_str"` Os interface{} `json:"os"` Ports []int `json:"ports"` }
Host is used to unmarshal the JSON response from '/shodan/host/{ip}'.
type HostCount ¶
type HostCount struct { Matches []interface{} `json:"matches"` Facets struct { Org []struct { Count int `json:"count"` Value string `json:"value"` } `json:"org"` } `json:"facets"` Total int `json:"total"` }
HostCount is used to unmarshal the JSON response from '/shodan/host/count'.
type HostSearch ¶
type HostSearch struct { Matches []struct { Os interface{} `json:"os"` Timestamp string `json:"timestamp"` Isp string `json:"isp"` Asn string `json:"asn"` Hostnames []interface{} `json:"hostnames"` Location struct { City interface{} `json:"city"` RegionCode interface{} `json:"region_code"` AreaCode interface{} `json:"area_code"` Longitude float64 `json:"longitude"` CountryCode3 string `json:"country_code3"` CountryName string `json:"country_name"` PostalCode interface{} `json:"postal_code"` DmaCode interface{} `json:"dma_code"` CountryCode string `json:"country_code"` Latitude float64 `json:"latitude"` } `json:"location"` HTTP struct { RobotsHash interface{} `json:"robots_hash"` Redirects []interface{} `json:"redirects"` Securitytxt interface{} `json:"securitytxt"` Title string `json:"title"` SitemapHash interface{} `json:"sitemap_hash"` Robots interface{} `json:"robots"` Server string `json:"server"` Host string `json:"host"` HTML string `json:"html"` Location string `json:"location"` Components map[string]interface{} `json:"components"` SecuritytxtHash interface{} `json:"securitytxt_hash"` Sitemap interface{} `json:"sitemap"` HTMLHash int `json:"html_hash"` } IP int64 `json:"ip"` Domains []interface{} `json:"domains"` Data string `json:"data"` Org string `json:"org"` Port int `json:"port"` IPStr string `json:"ip_str"` } `json:"matches"` Facets struct { Org []struct { Count int `json:"count"` Value string `json:"value"` } `json:"org"` } `json:"facets"` Total int `json:"total"` }
HostSearch is used to unmarshal the JSON response from '/shodan/host/search'.
type HostSearchTokens ¶
type HostSearchTokens struct { Attributes struct { Ports []int `json:"ports"` } `json:"attributes"` Errors []interface{} `json:"errors"` String string `json:"string"` Filters []string `json:"filters"` }
HostSearchTokens is used to unmarshal the JSON response from '/shodan/host/search/tokens'.
type Query ¶
type Query struct { Total int `json:"total"` Matches []struct { Votes int `json:"votes"` Description string `json:"description"` Title string `json:"title"` Timestamp string `json:"timestamp"` Tags []string `json:"tags"` Query string `json:"query"` } `json:"matches"` }
Query is used to unmarshal the JSON response from '/shodan/query/{search}'.
type QueryTags ¶
type QueryTags struct { Total int `json:"total"` Matches []struct { Value string `json:"value"` Count int `json:"count"` } `json:"matches"` }
QueryTags is used to unmarshal the JSON response from '/shodan/query/tags'.
type Scan ¶
type Scan struct { ID string `json:"id"` Count int `json:"count"` CreditsLeft int `json:"credits_left"` }
Scan is used to unmarshal the JSON response from '/shodan/scan'. This is not implemented.
type ScanInternet ¶
type ScanInternet struct {
ID string `json:"id"`
}
ScanInternet is used to unmarshal the JSON response from '/shodan/scan/internet'. This is not implemented.
type ShodanClient ¶
type ShodanClient struct { *base.BaseSpaceEngineClient // contains filtered or unexported fields }
ShodanClient stores shared data that is used to interact with the API.
func NewClientEx ¶
func NewClientEx(key string, apiHost string) *ShodanClient
NewClientEx returns a new Client with custom host.
func (*ShodanClient) APIInfo ¶
func (c *ShodanClient) APIInfo() (*APIInfo, error)
APIInfo calls '/api-info' and returns the unmarshalled response.
func (*ShodanClient) DNSResolve ¶
func (c *ShodanClient) DNSResolve(hostnames []string) ([]DNSResolve, error)
DNSResolve calls '/dns/resolve' and returns the unmarshalled response.
func (*ShodanClient) DNSReverse ¶
func (c *ShodanClient) DNSReverse(ips []string) ([]DNSReverse, error)
DNSReverse calls '/dns/reverse' and returns the unmarshalled response.
func (*ShodanClient) Exploits ¶
func (c *ShodanClient) Exploits(query string, facets []string) (*Exploit, error)
Exploits calls '/api/exploits' from the exploit API and returns the unmarshalled response. query is the search query string. facets are any facets to add to the request.
func (*ShodanClient) Host ¶
Host calls '/shodan/host/{ip}' and returns the unmarshalled response. ip is the IP address to search for. opts are all query paramters to pass in the request. You do not have to provide your API key.
func (*ShodanClient) HostCount ¶
func (c *ShodanClient) HostCount(query string, facets []string) (*HostCount, error)
HostCount calls '/shodan/host/count' and returns the unmarshalled response. query is the search query to pass in the request. facets are any facets to pass in the request.
func (*ShodanClient) HostSearch ¶
func (c *ShodanClient) HostSearch(query string, facets []string, params map[string]string) (*HostSearch, error)
HostSearch calls '/shodan/host/search' and returns the unmarshalled response. query is the search query to pass in the request. facets are any facets to pass in the request. opts are any additional query parameters to set, such as page and minify.
func (*ShodanClient) HostSearchTokens ¶
func (c *ShodanClient) HostSearchTokens(query string) (*HostSearchTokens, error)
HostSearchTokens calls '/shodan/host/search/tokens' and returns the unmarshalled response. query is the search query to pass in the request.
func (*ShodanClient) Protocols ¶
func (c *ShodanClient) Protocols() (map[string]string, error)
Protocols calls '/shodan/protocols' and returns the unmarshalled response.
func (*ShodanClient) Query ¶
func (c *ShodanClient) Query(params map[string]string) (*Query, error)
Query calls '/shodan/query' and returns the unmarshalled response. opts are additional query parameters. You do not need to provide your API key.
func (*ShodanClient) QuerySearch ¶
QuerySearch calls '/shodan/query/search' and returns the unmarshalled response. query is the search query to pass in the request. opts are additional query parameters. You do not need to provide your API key.
func (*ShodanClient) QueryTags ¶
func (c *ShodanClient) QueryTags(params map[string]string) (*QueryTags, error)
QueryTags calls '/shodan/query/tags' and returns the unmarshalled response. opts are additional query parameters. You do not need to provide your API key.
func (*ShodanClient) Services ¶
func (c *ShodanClient) Services() (map[string]string, error)
Services calls '/shodan/services' and returns the unmarshalled response.
func (*ShodanClient) UserProfile ¶
func (c *ShodanClient) UserProfile() ([]byte, error)