Skip to content

Shodan CLI

19 commands

The command line for Shodan, the search engine for internet-connected devices: search banners, look up hosts and monitor networks.

  • internet scanning
  • devices
  • search

Install Shodan CLI

pipx install shodan

Setup3

shodan init <api_key>

Stores your API key. Query credits and filters depend on your plan.

Link
shodan info

Shows remaining query and scan credits.

Link
shodan myip

Your public IP address as Shodan sees it.

Link

Searching8

shodan search "<query>"

Searches banners. Uses query credits for filters and paging.

Link
shodan search --fields ip_str,port,org,hostnames "<query>"

Prints only the chosen fields.

Link
shodan count "<query>"

Number of results without spending credits on the data.

Link
shodan stats --facets <facet> "<query>"

Top values for a facet — a fast attack-surface overview.

Link
shodan search "hostname:<domain>"

Hosts whose reverse DNS or certificates match a domain.

Link
shodan search "net:<cidr>"

Everything Shodan has seen in a network range.

Link
shodan search "http.title:\"<title>\""

Finds web apps by page title.

Link
shodan search "vuln:<cve>"

Hosts flagged as vulnerable to a CVE (needs a qualifying plan).

Link

Hosts and data5

shodan host <ip>

Every service, banner, location and known vulnerability for one IP.

Link
shodan domain <domain>

Subdomains and DNS records Shodan knows about.

Link
shodan download <file> "<query>"

Saves full results to a compressed JSON file.

Link
shodan parse --fields ip_str,port <file>.json.gz

Extracts fields from a download.

Link
shodan convert <file>.json.gz <format>

Converts downloads to csv, kml, xlsx or images.

Link

Scanning and alerts3

shodan scan submit <cidr>

Requests an on-demand scan of your own network (uses scan credits).

Link
shodan alert create "<name>" <cidr>

Monitors a range and notifies you about new services.

Link
shodan stream --ports <ports>

Real-time stream of new banners (higher plans).

Link