shodan

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: MIT Imports: 19 Imported by: 3

Documentation

Index

Constants

View Source
const (

	// ExploitSourceCVE is "CVE".
	ExploitSourceCVE ExploitSource = "CVE"

	// ExploitSourceMetasploit is "Metasploit".
	ExploitSourceMetasploit ExploitSource = "Metasploit"

	// ExploitSourceExploitDB is "ExploitDB".
	ExploitSourceExploitDB ExploitSource = "ExploitDB"

	// ExploitTypeDOS is "dos".
	ExploitTypeDOS ExploitType = "dos"

	// ExploitTypeExploit is "exploit".
	ExploitTypeExploit ExploitType = "exploit"

	// ExploitTypeLocal is "local".
	ExploitTypeLocal ExploitType = "local"

	// ExploitTypeRemote is "remote".
	ExploitTypeRemote ExploitType = "remote"

	// ExploitTypeShellcode is "shellcode".
	ExploitTypeShellcode ExploitType = "shellcode"

	// ExploitTypeWebapps is "webapps".
	ExploitTypeWebapps ExploitType = "webapps"

	// ExploitPlatformAix is "aix".
	ExploitPlatformAix ExploitPlatform = "aix"

	// ExploitPlatformCGI is "cgi".
	ExploitPlatformCGI ExploitPlatform = "cgi"

	// ExploitPlatformFreeBSD is "freebsd".
	ExploitPlatformFreeBSD ExploitPlatform = "freebsd"

	// ExploitPlatformHardware is "hardware".
	ExploitPlatformHardware ExploitPlatform = "hardware"

	// ExploitPlatformJava is "Java".
	ExploitPlatformJava ExploitPlatform = "Java"

	// ExploitPlatformJSP is "jsp".
	ExploitPlatformJSP ExploitPlatform = "jsp"

	// ExploitPlatformLin86 is "lin_x86".
	ExploitPlatformLin86 ExploitPlatform = "lin_x86"

	// ExploitPlatformLinux is "Linux".
	ExploitPlatformLinux ExploitPlatform = "Linux"

	// ExploitPlatformMultiple is "multiple".
	ExploitPlatformMultiple ExploitPlatform = "multiple"

	// ExploitPlatformNovell is "novell".
	ExploitPlatformNovell ExploitPlatform = "novell"

	// ExploitPlatformOSX is "osx".
	ExploitPlatformOSX ExploitPlatform = "osx"

	// ExploitPlatformPHP is "PHP".
	ExploitPlatformPHP ExploitPlatform = "PHP"

	// ExploitPlatformTrue64 is "true64".
	ExploitPlatformTrue64 ExploitPlatform = "true64"

	// ExploitPlatformUnix is "Unix".
	ExploitPlatformUnix ExploitPlatform = "Unix"

	// ExploitPlatformWindows is "Windows".
	ExploitPlatformWindows ExploitPlatform = "Windows"
)

Variables

View Source
var (
	// ErrInvalidQuery is returned when query is not valid.
	ErrInvalidQuery = errors.New("query is invalid")

	// ErrBodyRead is returned when response's body cannot be read.
	ErrBodyRead = errors.New("could not read error response")
)

Functions

This section is empty.

Types

type APIInfo

type APIInfo struct {
	Plan         string `json:"plan"`
	QueryCredits int    `json:"query_credits"`
	ScanCredits  int    `json:"scan_credits"`
	Telnet       bool   `json:"telnet"`
	HTTPS        bool   `json:"https"`
	Unlocked     bool   `json:"unlocked"`
	UnlockedLeft int    `json:"unlocked_left"`
}

APIInfo holds API information.

type AddMemberToOrganizationOptions

type AddMemberToOrganizationOptions struct {
	Notify bool `url:"notify,omitempty"`
}

AddMemberToOrganizationOptions is options for adding members.

type Alert

type Alert struct {
	ID         string        `json:"id"`
	Name       string        `json:"name"`
	Created    string        `json:"created"`
	Expiration string        `json:"expiration"`
	Expires    int           `json:"expires"`
	Expired    bool          `json:"expired"`
	Size       int           `json:"size"`
	Filters    *AlertFilters `json:"filters"`
	Notifiers  []*Notifier   `json:"notifiers"`
	// not documented for now :-(
	Triggers map[string]interface{} `json:"triggers"`
}

Alert represents a trigger to react to network scan request.

type AlertFilters

type AlertFilters struct {
	IP []string `json:"ip"`
}

AlertFilters holds alert criteria (only ip for now).

type AlertTrigger

type AlertTrigger struct {
	Name        string `json:"name"`
	Rule        string `json:"rule"`
	Description string `json:"description"`
}

AlertTrigger represents a trigger.

type AlertTriggerIdent

type AlertTriggerIdent struct {
	AlertID     string
	TriggerName string
}

type AlertTriggerServiceIdent

type AlertTriggerServiceIdent struct {
	*AlertTriggerIdent
	ServiceName string
}

type Client

type Client struct {
	Token          string
	BaseURL        string
	ExploitBaseURL string
	StreamBaseURL  string
	Debug          bool
	Client         *http.Client
	// contains filtered or unexported fields
}

Client represents Shodan HTTP client

func NewClient

func NewClient(client *http.Client, token string) *Client

NewClient creates new Shodan client

func NewEnvClient

func NewEnvClient(client *http.Client) *Client

NewEnvClient creates new Shodan client using environment variable SHODAN_KEY as the token.

func (*Client) AddAlertNotifier added in v4.2.0

func (c *Client) AddAlertNotifier(ctx context.Context, alertID string, notifierID string) (bool, error)

AddAlertNotifier adds the specified notifier to the network alert. Notifications are only sent if triggers have also been enabled.

func (*Client) AddMemberToOrganization

func (c *Client) AddMemberToOrganization(
	ctx context.Context,
	user string,
	options *AddMemberToOrganizationOptions,
) (bool, error)

Add a Shodan user to the organization and upgrade them.

func (*Client) AddServiceToAlertTriggerWhitelist

func (c *Client) AddServiceToAlertTriggerWhitelist(
	ctx context.Context,
	service *AlertTriggerServiceIdent,
) (bool, error)

Ignore the specified service when it is matched for the trigger.

func (*Client) BreakQueryIntoTokens

func (c *Client) BreakQueryIntoTokens(ctx context.Context, query string) (*HostQueryTokens, error)

BreakQueryIntoTokens determines which filters are being used by the query string and what parameters were provided to the filters.

func (*Client) CalcHoneyScore

func (c *Client) CalcHoneyScore(ctx context.Context, ip net.IP) (float64, error)

CalcHoneyScore calculates a honeypot probability score ranging from 0 (not a honeypot) to 1.0 (is a honeypot).

func (*Client) CountExploits

func (c *Client) CountExploits(ctx context.Context, options *ExploitSearchOptions) (*ExploitSearch, error)

CountExploits behaves identical to the "/search" method with the difference that it doesn't return any results.

func (*Client) CreateAlert

func (c *Client) CreateAlert(ctx context.Context, name string, ip []string, expires int) (*Alert, error)

CreateAlert creates a network alert for a defined IP/netblock which can be used to subscribe to changes/events that are discovered within that range.

func (*Client) CreateNotifier added in v4.2.0

func (c *Client) CreateNotifier(ctx context.Context, notifier *Notifier) (bool, error)

CreateNotifier creates a new notification service endpoint that Shodan services can send notifications through.

func (*Client) DeleteAlert

func (c *Client) DeleteAlert(ctx context.Context, id string) (bool, error)

DeleteAlert removes the specified network alert.

func (*Client) DeleteAlertNotifier added in v4.2.0

func (c *Client) DeleteAlertNotifier(ctx context.Context, alertID string, notifierID string) (bool, error)

DeleteAlertNotifier removes the notification service from the alert. Notifications are only sent if triggers have also been enabled.

func (*Client) DeleteNotifier added in v4.2.0

func (c *Client) DeleteNotifier(ctx context.Context, id string) (bool, error)

DeleteNotifier deletes the notification service created for the user.

func (*Client) DisableAlertTrigger

func (c *Client) DisableAlertTrigger(ctx context.Context, ident *AlertTriggerIdent) (bool, error)

Stop getting notifications for the specified trigger.

func (*Client) Do

func (c *Client) Do(ctx context.Context, req *http.Request, destination interface{}) error

Do executes common (non-streaming) request.

func (*Client) DoStream

func (c *Client) DoStream(ctx context.Context, req *http.Request) (*http.Response, error)

DoStream executes streaming request.

func (*Client) EnableAlertTrigger

func (c *Client) EnableAlertTrigger(ctx context.Context, ident *AlertTriggerIdent) (bool, error)

Get notifications when the specified trigger is met.

func (*Client) GetAPIInfo

func (c *Client) GetAPIInfo(ctx context.Context) (*APIInfo, error)

GetAPIInfo returns information about the API plan belonging to the given API key.

func (*Client) GetAccountProfile

func (c *Client) GetAccountProfile(ctx context.Context) (*Profile, error)

GetAccountProfile returns information about the Shodan account linked to the API key

func (*Client) GetAlert

func (c *Client) GetAlert(ctx context.Context, id string) (*Alert, error)

GetAlert returns the information about a specific network alert.

func (*Client) GetAlertTriggers

func (c *Client) GetAlertTriggers(ctx context.Context) ([]*AlertTrigger, error)

Returns a list of all the triggers that can be enabled on network alerts.

func (*Client) GetAlerts

func (c *Client) GetAlerts(ctx context.Context) ([]*Alert, error)

GetAlerts returns a listing of all the network alerts that are currently active on the account.

func (*Client) GetBanners

func (c *Client) GetBanners(ctx context.Context, ch chan *HostData) error

GetBanners provides ALL of the data that Shodan collects. Use this stream if you need access to everything and / or want to store your own Shodan database locally. If you only care about specific ports, please use the Ports stream.

func (*Client) GetBannersByASN

func (c *Client) GetBannersByASN(ctx context.Context, asn []string, ch chan *HostData) error

GetBannersByASN provides a filtered, bandwidth-saving view of the Banners stream in case you are only interested in devices located in certain ASNs.

func (*Client) GetBannersByAlert

func (c *Client) GetBannersByAlert(ctx context.Context, id string, ch chan *HostData) error

GetBannersByAlert subscribes to banners discovered on the IP range defined in a specific network alert.

func (*Client) GetBannersByAlerts

func (c *Client) GetBannersByAlerts(ctx context.Context, ch chan *HostData) error

GetBannersByAlerts subscribes to banners discovered on all IP ranges described in the network alerts.

func (*Client) GetBannersByCountries

func (c *Client) GetBannersByCountries(ctx context.Context, countries []string, ch chan *HostData) error

GetBannersByCountries provides a filtered, bandwidth-saving view of the Banners stream in case you are only interested in devices located in certain countries.

func (*Client) GetBannersByPorts

func (c *Client) GetBannersByPorts(ctx context.Context, ports []int, ch chan *HostData) error

GetBannersByPorts returns only banner data for the list of specified hosts. This stream provides a filtered, bandwidth-saving view of the Banners stream in case you are only interested in a specific list of ports.

func (*Client) GetDNSResolve

func (c *Client) GetDNSResolve(ctx context.Context, hostnames []string) (map[string]*net.IP, error)

GetDNSResolve looks up the IP address for the provided list of hostnames

func (*Client) GetDNSReverse

func (c *Client) GetDNSReverse(ctx context.Context, ip []net.IP) (map[string]*[]string, error)

GetDNSReverse looks up the hostnames that have been defined for the given list of IP addresses

func (*Client) GetDatasetFiles

func (c *Client) GetDatasetFiles(ctx context.Context, name string) ([]*DatasetFile, error)

GetDatasetFiles returns a list of files that are available for download from the provided dataset.

func (*Client) GetDatasets

func (c *Client) GetDatasets(ctx context.Context) ([]*Dataset, error)

GetDatasets provides list of the datasets that are available for download.

func (*Client) GetDomain

func (c *Client) GetDomain(ctx context.Context, domain string) (*DomainDNSInfo, error)

GetDomain returns all the subdomains and other DNS entries for the given domain. Uses 1 query credit per lookup.

func (*Client) GetFacets added in v4.2.0

func (c *Client) GetFacets(ctx context.Context) ([]string, error)

GetFacets returns a list of facets that can be used to get a breakdown of the top values for a property.

func (*Client) GetFilters added in v4.2.0

func (c *Client) GetFilters(ctx context.Context) ([]string, error)

GetFilters returns a list of search filters that can be used in the search query.

func (*Client) GetHTTPHeaders

func (c *Client) GetHTTPHeaders(ctx context.Context) (map[string]string, error)

GetHTTPHeaders shows the HTTP headers that your client sends when connecting to a webserver.

func (*Client) GetHostsCountForQuery

func (c *Client) GetHostsCountForQuery(ctx context.Context, options *HostQueryOptions) (*HostMatch, error)

GetHostsCountForQuery behaves identical to "/shodan/host/search" with the only difference that this method does not return any host results, it only returns the total number of results that matched the query and any facet information that was requested. As a result this method does not consume query credits

func (*Client) GetHostsForQuery

func (c *Client) GetHostsForQuery(ctx context.Context, options *HostQueryOptions) (*HostMatch, error)

GetHostsForQuery searches Shodan using the same query syntax as the website and use facets to get summary information for different properties. This method may use API query credits depending on usage. If any of the following criteria are met, your account will be deducated 1 query credit: 1. The search query contains a filter 2. Accessing results past the 1st page using the "page". For every 100 results past the 1st page 1 query credit is deducted

func (*Client) GetMyIP

func (c *Client) GetMyIP(ctx context.Context) (net.IP, error)

GetMyIP returns your current IP address as seen from the Internet API key for this method is unnecessary.

func (*Client) GetNotifier added in v4.2.0

func (c *Client) GetNotifier(ctx context.Context, id string) (*Notifier, error)

GetNotifier gets information about a notifier.

func (*Client) GetNotifierProviders added in v4.2.0

func (c *Client) GetNotifierProviders(ctx context.Context) (map[string]*NotifierProvider, error)

GetNotifierProviders gets a list of all the notification providers that are available and the parameters to submit when creating them.

func (*Client) GetNotifiers added in v4.2.0

func (c *Client) GetNotifiers(ctx context.Context) ([]*Notifier, error)

GetNotifiers gets a list of all the notifiers that the user has created.

func (*Client) GetOrganization

func (c *Client) GetOrganization(ctx context.Context) (*Organization, error)

Get information about your organization such as the list of its members, upgrades, authorized domains and more.

func (*Client) GetPorts

func (c *Client) GetPorts(ctx context.Context) ([]int, error)

GetPorts returns a list of port numbers that the crawlers are looking for

func (*Client) GetProtocols

func (c *Client) GetProtocols(ctx context.Context) (map[string]string, error)

GetProtocols returns an object containing all the protocols that can be used when launching an Internet scan.

func (*Client) GetQueries

func (c *Client) GetQueries(ctx context.Context, options *QueryOptions) (*QuerySearch, error)

GetQueries obtains a list of search queries that users have saved in Shodan.

func (*Client) GetQueryTags

func (c *Client) GetQueryTags(ctx context.Context, options *QueryTagsOptions) (*QueryTags, error)

GetQueryTags obtains a list of popular tags for the saved search queries in Shodan.

func (*Client) GetScanStatus

func (c *Client) GetScanStatus(ctx context.Context, id string) (*ScanStatus, error)

GetScanStatus checks the progress of a previously submitted scan request.

func (*Client) GetServices

func (c *Client) GetServices(ctx context.Context) (map[string]string, error)

GetServices returns an object containing all the services that the Shodan crawlers look at It can also be used as a quick and practical way to resolve a port number to the name of a service

func (*Client) GetServicesForHost

func (c *Client) GetServicesForHost(ctx context.Context, ip string, options *HostServicesOptions) (*Host, error)

GetServicesForHost returns all services that have been found on the given host IP

func (*Client) NewExploitRequest

func (c *Client) NewExploitRequest(
	method string,
	path string,
	params interface{},
	body io.Reader,
) (*http.Request, error)

NewExploitRequest prepares new request to exploit shodan api.

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, params interface{}, body io.Reader) (*http.Request, error)

NewRequest prepares new request to common shodan api.

func (*Client) NewStreamingRequest

func (c *Client) NewStreamingRequest(path string, params interface{}) (*http.Request, error)

NewStreamingRequest prepares new request to streaming api.

func (*Client) RemoveMemberFromOrganization

func (c *Client) RemoveMemberFromOrganization(ctx context.Context, user string) (bool, error)

Remove and downgrade the provided member from the organization.

func (*Client) RemoveServiceFromAlertTriggerWhitelist

func (c *Client) RemoveServiceFromAlertTriggerWhitelist(
	ctx context.Context,
	service *AlertTriggerServiceIdent,
) (bool, error)

Start getting notifications again for the specified trigger.

func (*Client) Scan

func (c *Client) Scan(ctx context.Context, ip []string) (*CrawlScanStatus, error)

Scan requests Shodan to crawl a network. This method uses API scan credits: 1 IP consumes 1 scan credit. You must have a paid API plan (either one-time payment or subscription) in order to use this method.

func (*Client) ScanInternet

func (c *Client) ScanInternet(ctx context.Context, port int, protocol string) (string, error)

ScanInternet requests Shodan to crawl the Internet for a specific port. This method is restricted to security researchers and companies with a Shodan Data license.

func (*Client) SearchExploits

func (c *Client) SearchExploits(ctx context.Context, options *ExploitSearchOptions) (*ExploitSearch, error)

SearchExploits searches across a variety of data sources for exploits and use facets to get summary information.

func (*Client) SearchQueries

func (c *Client) SearchQueries(ctx context.Context, options *SearchQueryOptions) (*QuerySearch, error)

SearchQueries searches the directory of search queries that users have saved in Shodan.

func (*Client) SetDebug

func (c *Client) SetDebug(debug bool)

SetDebug toggles the debug mode.

func (*Client) UpdateNotifierArgs added in v4.2.0

func (c *Client) UpdateNotifierArgs(ctx context.Context, id string, args map[string]string) (bool, error)

UpdateNotifier updates the parameters of a notifier.

type CrawlScanStatus

type CrawlScanStatus struct {
	ID          string `json:"id"`
	Count       int    `json:"count"`
	CreditsLeft int    `json:"credits_left"`
}

CrawlScanStatus is the response to a scan request.

type Dataset

type Dataset struct {
	Name        string `json:"name"`
	Scope       string `json:"scope"`
	Description string `json:"description"`
}

Dataset represents short information about single dataset.

type DatasetFile

type DatasetFile struct {
	URL       *url.URL  `json:"url"`
	Timestamp time.Time `json:"timestamp"`
	Name      string    `json:"name"`
	Size      int64     `json:"size"`
}

DatasetFile contains files to a dataset.

func (*DatasetFile) MarshalJSON

func (f *DatasetFile) MarshalJSON() ([]byte, error)

MarshalJSON implements Marshaler interface to restore original json.

1. transform time.Time into int 2. transform *url.URL into string

func (*DatasetFile) UnmarshalJSON

func (f *DatasetFile) UnmarshalJSON(data []byte) error

UnmarshalJSON implements Unmarshaler interface for 2 reasons:

1. transform int timestamp into valid time.Time 2. transform url string into *url.URL

type DomainDNSInfo

type DomainDNSInfo struct {
	Domain     string              `json:"domain"`
	Tags       []string            `json:"tags"`
	Data       []*SubdomainDNSInfo `json:"data"`
	Subdomains []string            `json:"subdomains"`
}

type Exploit

type Exploit struct {
	// Unique ID for the exploit/ vulnerability (integer or string)
	ID interface{} `json:"_id"`

	// An array of Bugtraq IDs that reference this vulnerability
	BID []int `json:"bid"`

	// An array of relevant CVE IDs that reference this exploit
	CVE []string `json:"cve"`

	// An array of Microsoft Security Bulletin reference IDs for this exploit
	MSB []string `json:"msb"`

	// An array (integer or string) of OSVDB IDs that are relevant to this exploit
	OSVDB []interface{} `json:"osvdb"`

	// A description explaining the details of the exploit
	Description string `json:"description"`

	// The name of the data source
	Source ExploitSource `json:"source"`

	// The author of the exploit/vulnerability
	Author interface{} `json:"author"`

	// The actual code for the exploit
	Code string `json:"code"`

	// The timestamp for when the exploit was released in the UTC timezone. Example: "2014-01-15T05:49:56.283713"
	Date string `json:"date"`

	// An array of platforms or a single platform that the exploit targets
	Platform interface{} `json:"platform"`

	// The port number for the affected service
	Port int `json:"port"`

	// The type of exploit
	Type ExploitType `json:"type"`

	// Is Privileged?
	Privileged bool `json:"privileged"`

	// Rank, i.e. "excellent"
	Rank string `json:"rank"`

	// Version
	Version string `json:"version"`
}

Exploit represents the normalized data from a variety of vulnerability data sources.

type ExploitPlatform

type ExploitPlatform string

ExploitPlatform is the target platform type.

type ExploitSearch

type ExploitSearch struct {
	Matches []*Exploit          `json:"matches"`
	Facets  map[string][]*Facet `json:"facets"`
	Total   int                 `json:"total"`
}

ExploitSearch is exploit search results.

type ExploitSearchOptions

type ExploitSearchOptions struct {
	// Search query used to search the database of known exploits
	Query string `url:"query"`

	// A comma-separated list of properties to get summary information on
	Facets string `url:"facets,omitempty"`

	// The page number to page through results 100 at a time. It is ignored in CountExploits method
	Page int `url:"page,omitempty"`
}

ExploitSearchOptions is options for exploit search query.

type ExploitSource

type ExploitSource string

ExploitSource is the name of the data source.

type ExploitType

type ExploitType string

ExploitType is the type of exploit.

type Facet

type Facet struct {
	Count int    `json:"count"`
	Value string `json:"value"`
}

Facet is a property to get summary information on.

type Host

type Host struct {
	OS              string      `json:"os"`
	Ports           []int       `json:"ports"`
	IP              net.IP      `json:"ip_str"`
	ISP             string      `json:"isp"`
	Hostnames       []string    `json:"hostnames"`
	Organization    string      `json:"org"`
	Vulnerabilities []string    `json:"vulns"`
	ASN             string      `json:"asn"`
	LastUpdate      string      `json:"last_update"`
	Data            []*HostData `json:"data"`
	HostLocation
}

Host is the all information about the host.

type HostCertificate

type HostCertificate struct {
	SignatureAlgorithm string                      `json:"sig_alg"`
	IsExpired          bool                        `json:"expired"`
	Version            int                         `json:"version"`
	Serial             *big.Int                    `json:"serial"`
	Issued             string                      `json:"issued"`
	Expires            string                      `json:"expires"`
	Fingerprint        map[string]string           `json:"fingerprint"`
	Issuer             *HostCertificateAttributes  `json:"issuer"`
	Subject            *HostCertificateAttributes  `json:"subject"`
	PublicKey          *HostCertificatePublicKey   `json:"pubkey"`
	Extensions         []*HostCertificateExtension `json:"extensions"`
}

HostCertificate contains common certificate description.

type HostCertificateAttributes

type HostCertificateAttributes struct {
	CountryName         string `json:"C,omitempty"`
	CommonName          string `json:"CN,omitempty"`
	Locality            string `json:"L,omitempty"`
	Organization        string `json:"O,omitempty"`
	StateOrProvinceName string `json:"ST,omitempty"`
	OrganizationalUnit  string `json:"OU,omitempty"`
}

HostCertificateAttributes is an ordinary certificate attributes description.

type HostCertificateExtension

type HostCertificateExtension struct {
	Data       string `json:"data"`
	Name       string `json:"name"`
	IsCritical bool   `json:"critical,omitempty"`
}

HostCertificateExtension represent single cert extension.

type HostCertificatePublicKey

type HostCertificatePublicKey struct {
	Type string `json:"type"`
	Bits int    `json:"bits"`
}

HostCertificatePublicKey holds type and bits length of the key.

type HostCipher

type HostCipher struct {
	Version string `json:"version"`
	Bits    int    `json:"bits"`
	Name    string `json:"name"`
}

HostCipher is a cipher description.

type HostDHParams

type HostDHParams struct {
	Prime       string     `json:"prime"`
	PublicKey   string     `json:"public_key"`
	Bits        int        `json:"bits"`
	Generator   *IntString `json:"generator"`
	Fingerprint string     `json:"fingerprint"`
}

HostDHParams is the Diffie-Hellman parameters if available.

type HostData

type HostData struct {
	Product      string                 `json:"product"`
	Hostnames    []string               `json:"hostnames"`
	Version      IntString              `json:"version"`
	Title        string                 `json:"title"`
	SSL          *HostSSL               `json:"ssl"`
	IP           net.IP                 `json:"ip_str"`
	OS           string                 `json:"os"`
	Organization string                 `json:"org"`
	ISP          string                 `json:"isp"`
	CPE          []string               `json:"cpe"`
	Data         string                 `json:"data"`
	ASN          string                 `json:"asn"`
	Port         int                    `json:"port"`
	HTML         string                 `json:"html"`
	Banner       string                 `json:"banner"`
	Link         string                 `json:"link"`
	Transport    string                 `json:"transport"`
	Domains      []string               `json:"domains"`
	Timestamp    string                 `json:"timestamp"`
	DeviceType   string                 `json:"devicetype"`
	Location     *HostLocation          `json:"location"`
	ShodanData   map[string]interface{} `json:"_shodan"`
	Opts         map[string]interface{} `json:"opts"`
}

HostData is all services that have been found on the given host IP.

type HostLocation

type HostLocation struct {
	City         string  `json:"city"`
	RegionCode   string  `json:"region_code"`
	AreaCode     int     `json:"area_code"`
	Latitude     float64 `json:"latitude"`
	Longitude    float64 `json:"longitude"`
	Country      string  `json:"country_name"`
	CountryCode  string  `json:"country_code"`
	CountryCode3 string  `json:"country_code3"`
	Postal       string  `json:"postal_code"`
	DMA          int     `json:"dma_code"`
}

HostLocation is the location of the host.

type HostMatch

type HostMatch struct {
	Total   int                 `json:"total"`
	Facets  map[string][]*Facet `json:"facets"`
	Matches []*HostData         `json:"matches"`
}

HostMatch is the search results with all matched hosts.

type HostQueryOptions

type HostQueryOptions struct {
	Query  string `url:"query"`
	Facets string `url:"facets,omitempty"`
	Minify bool   `url:"minify,omitempty"`
	Page   int    `url:"page,omitempty"`
}

HostQueryOptions is Shodan search query options.

type HostQueryTokens

type HostQueryTokens struct {
	Filters    []string               `json:"filters"`
	String     string                 `json:"string"`
	Errors     []string               `json:"errors"`
	Attributes map[string]interface{} `json:"attributes"`
}

HostQueryTokens is filters are being used by the query string and what parameters were provided to the filters.

type HostSSL

type HostSSL struct {
	Versions    []string           `json:"versions"`
	Chain       []string           `json:"chain"`
	DHParams    *HostDHParams      `json:"dhparams"`
	TLSExt      []*HostTLSExtEntry `json:"tlsext"`
	Cipher      *HostCipher        `json:"cipher"`
	Certificate *HostCertificate   `json:"cert"`
}

HostSSL holds ssl host information.

type HostServicesOptions

type HostServicesOptions struct {
	History bool `url:"history,omitempty"`
	Minify  bool `url:"minify,omitempty"`
}

HostServicesOptions is options for querying services.

type HostTLSExtEntry

type HostTLSExtEntry struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

HostTLSExtEntry contains id and name.

type IntString

type IntString string

IntString is string with custom unmarshaling.

func (*IntString) String

func (v *IntString) String() string

String method just returns string out of IntString.

func (*IntString) UnmarshalJSON

func (v *IntString) UnmarshalJSON(b []byte) error

UnmarshalJSON handles either a string or a number and casts it to string.

type Notifier added in v4.2.0

type Notifier struct {
	ID          string            `json:"id"`
	Provider    string            `json:"provider"`
	Description string            `json:"description"`
	Args        map[string]string `json:"args"`
}

type NotifierProvider added in v4.2.0

type NotifierProvider struct {
	Required []string `json:"required"`
}

type Organization

type Organization struct {
	ID          string                `json:"id"`
	Name        string                `json:"name"`
	Created     string                `json:"created"`
	Admins      []*OrganizationMember `json:"admins"`
	Members     []*OrganizationMember `json:"members"`
	UpgradeType string                `json:"upgrade_type"`
	Domains     []string              `json:"domains"`
}

Organization contains everything about a company.

type OrganizationMember

type OrganizationMember struct {
	Username string `json:"username"`
	Email    string `json:"email"`
}

OrganizationMember is a company's employee.

type Profile

type Profile struct {
	Member  bool   `json:"member"`
	Credits int    `json:"credits"`
	Name    string `json:"display_name"`
	Created string `json:"created"`
}

Profile holds account's information

type QueryOptions

type QueryOptions struct {
	// Page number to iterate over results; each page contains 10 items.
	Page int `url:"page,omitempty"`

	// Sort the list based on a property. Possible values are: votes, timestamp.
	Sort string `url:"sort,omitempty"`

	// Whether to sort the list in ascending or descending order. Possible values are: asc, desc.
	Order string `url:"order,omitempty"`
}

QueryOptions represents query options for fetching saved queries.

type QuerySearch

type QuerySearch struct {
	Total   int                 `json:"total"`
	Matches []*QuerySearchMatch `json:"matches"`
}

QuerySearch is the results of querying saved search queries.

type QuerySearchMatch

type QuerySearchMatch struct {
	Title       string   `json:"title"`
	Description string   `json:"description"`
	Query       string   `json:"query"`
	Votes       int      `json:"votes"`
	Timestamp   string   `json:"timestamp"`
	Tags        []string `json:"tags"`
}

QuerySearchMatch is a match of QuerySearch.

type QueryTags

type QueryTags struct {
	Total   int               `json:"total"`
	Matches []*QueryTagsMatch `json:"matches"`
}

QueryTags represents matched tags.

type QueryTagsMatch

type QueryTagsMatch struct {
	Value string `json:"value"`
	Count int    `json:"count"`
}

QueryTagsMatch represents a matched tag.

type QueryTagsOptions

type QueryTagsOptions struct {
	// The number of tags to return (default: 10).
	Size int `url:"size,omitempty"`
}

QueryTagsOptions represents options for GetQueryTags.

type ScanStatus

type ScanStatus struct {
	ID     string          `json:"id"`
	Count  int             `json:"count"`
	Status ScanStatusState `json:"status"`
}

ScanStatus is a current scan status.

type ScanStatusState

type ScanStatusState string

ScanStatusState is an alias to string that represents a scan state.

const (

	// ScanStatusSubmitting is "SUBMITTING"
	ScanStatusSubmitting ScanStatusState = "SUBMITTING"

	// ScanStatusQueue is "QUEUE"
	ScanStatusQueue ScanStatusState = "QUEUE"

	// ScanStatusProcessing is "PROCESSING"
	ScanStatusProcessing ScanStatusState = "PROCESSING"

	// ScanStatusDone is "DONE"
	ScanStatusDone ScanStatusState = "DONE"
)

type SearchQueryOptions

type SearchQueryOptions struct {
	// What to search for in the directory of saved search queries.
	Query string `url:"query"`

	// Page number to iterate over results; each page contains 10 items.
	Page int `url:"page,omitempty"`
}

SearchQueryOptions is options for SearchQueries.

type SubdomainDNSInfo

type SubdomainDNSInfo struct {
	Subdomain string    `json:"subdomain"`
	Type      string    `json:"type"`
	Value     string    `json:"value"`
	LastSeen  time.Time `json:"last_seen"`
}

Jump to

Keyboard shortcuts

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