shodan

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package shodan contains all of the data structures and logic required to interact with the Shodan API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	Status      int     `json:"status" yaml:"status"`
	RobotsHash  *int    `json:"robots_hash" yaml:"robots_hash"`
	SecurityTxt *string `json:"securitytxt" yaml:"securitytxt"`
	Title       string  `json:"title" yaml:"title"`
	SitemapHash *int    `json:"sitemap_hash" yaml:"sitemap_hash"`
	Robots      *string `json:"robots" yaml:"robots"`
}

HTTP represents the HTTP information for a Shodan record.

type MacAddressInfo

type MacAddressInfo struct {
	Assignment string `json:"assignment" required:"true" yaml:"assignment"`
	Date       string `json:"date" yaml:"date"`
	Org        string `json:"org" required:"true" yaml:"org"`
}

MacAddressInfo represents the information for a MAC address in a Shodan record.

type Record

type Record struct {
	ASN        string                    `json:"asn" yaml:"asn"`
	CPE        []string                  `json:"cpe" yaml:"cpe"`
	CPE23      []string                  `json:"cpe23" yaml:"cpe23"`
	Data       string                    `json:"data" required:"true" yaml:"data"`
	Device     string                    `json:"device" yaml:"device"`
	DeviceType string                    `json:"devicetype" yaml:"devicetype"`
	Domains    []string                  `json:"domains" required:"true" yaml:"domains"`
	Hash       int                       `json:"hash" required:"true" yaml:"hash"`
	Hostnames  []string                  `json:"hostnames" yaml:"hostnames"`
	HTTP       HTTP                      `json:"http" yaml:"http"`
	IPStr      string                    `json:"ip_str" yaml:"ip_str"`
	Info       string                    `json:"info" yaml:"info"`
	IPv6       string                    `json:"ipv6" yaml:"ipv6"`
	ISP        string                    `json:"isp" yaml:"isp"`
	Link       string                    `json:"link" yaml:"link"`
	MAC        map[string]MacAddressInfo `json:"mac" yaml:"mac"`
	Opts       map[string]interface{}    `json:"opts" yaml:"opts"`
	Org        string                    `json:"org" yaml:"org"`
	OS         string                    `json:"os" yaml:"os"`
	Platform   string                    `json:"platform" yaml:"platform"`
	Port       int                       `json:"port" yaml:"port"`
	Product    string                    `json:"product" yaml:"product"`
	Tags       []Tag                     `json:"tags" yaml:"tags"`
	Timestamp  shodanTime                `json:"timestamp" required:"true" yaml:"timestamp"`
	Title      string                    `json:"title" yaml:"title"`
	Transport  string                    `json:"transport" required:"true" yaml:"transport"`
	Uptime     int                       `json:"uptime" yaml:"uptime"`
	Vendor     string                    `json:"vendor" yaml:"vendor"`
	Version    string                    `json:"version" yaml:"version"`
	Vulns      map[string]Vulnerability  `json:"vulns" yaml:"vulns"`
}

Record represents a single Shodan record.

type Report

type Report struct {
	Query         string   `json:"query" yaml:"query"`
	QueryType     string   `json:"query_type" yaml:"query_type"`
	ShodanRecords []Record `json:"shodan_records" yaml:"shodan_records"`
	Errors        []string `json:"errors" yaml:"errors"`
}

Report represents the report of all Shodan records for a given query including all non-fatal errors that occurred.

func QueryShodanHostStrictHostnameMatch

func QueryShodanHostStrictHostnameMatch(ctx context.Context, apiKey string, query string, hostname string) (Report, error)

QueryShodanHostStrictHostnameMatch queries Shodan for a given query string and ensures that the hostname contains the given hostname string.

type Response

type Response struct {
	Matches []json.RawMessage `json:"matches" yaml:"matches"`
}

Response represents the response from the Shodan API.

type Tag

type Tag string

Tag represents a Shodan tag.

const (
	C2             Tag = "c2"
	CDN            Tag = "cdn"
	Cloud          Tag = "cloud"
	Compromised    Tag = "compromised"
	Cryptocurrency Tag = "cryptocurrency"
	Database       Tag = "database"
	DevOps         Tag = "devops"
	DoublePulsar   Tag = "doublepulsar"
	EOLOS          Tag = "eol-os"
	EOLProduct     Tag = "eol-product"
	Honeypot       Tag = "honeypot"
	ICS            Tag = "ics"
	IOT            Tag = "iot"
	Malware        Tag = "malware"
	Medical        Tag = "medical"
	Onion          Tag = "onion"
	Proxy          Tag = "proxy"
	SelfSigned     Tag = "self-signed"
	Scanner        Tag = "scanner"
	SSHBadKey      Tag = "ssh-bad-key"
	StartTLS       Tag = "starttls"
	Tor            Tag = "tor"
	Videogame      Tag = "videogame"
	VPN            Tag = "vpn"
)

type Vulnerability

type Vulnerability struct {
	CVSS       float64  `json:"cvss" yaml:"cvss"`
	References []string `json:"references" required:"true" yaml:"references"`
	Summary    string   `json:"summary" required:"true" yaml:"summary"`
	Verified   bool     `json:"verified" yaml:"verified"`
}

Vulnerability represents a Shodan vulnerability.

Jump to

Keyboard shortcuts

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