Updated Jul 14, 2026

OSINT

Query the Shodan device index from a managed node

Search and inspect internet-facing hosts through the Shodan CLI.

Agent

overview

What shodan-python does

shodan-python exposes the Shodan CLI as search, host, count, stats, domain, and honeyscore modes. It takes api-key plus a query or target and writes a file with a results folder.

Use it to confirm what an IP exposes, size a query with count before spending credits, or pull subdomain and service context with domain mode. Trim columns with --fields and cap volume with --limit.

When you only need a one-shot json.gz dump of a full match set, switch to shodan-download. Keep scan mode limited to authorized targets; query modes stay passive against Shodan's index.

source github.com/achillean/shodan-python

use cases

Where shodan-python fits

Look up everything about a host

Run host mode on an IP, with --history when you want past banners, to see every open port, service banner, and certificate Shodan has recorded for it.

Search the index for threat intelligence

Query Shodan for exposed products, ports, or vulnerable software versions, then break the results down with facets and stats to prioritize what matters.

Map a domain's hosts and subdomains

Run domain mode with --details to turn a domain into a list of subdomains and the service inventory behind each resolved IP.

Size a search before exporting

Use count mode to return the number of matches, so you know how large a bulk download will be before spending credits.

Flag likely honeypots

Run honeyscore on an IP to estimate whether a host is a honeypot before treating its banners as real infrastructure.

reference

shodan-python inputs and flags

50 inputs
NameTypeFlagDescription
search-modeBOOLEANsearchSearch the Shodan database for hosts matching a query.
host-mdoeBOOLEANhostView every open port, banner, and certificate for an IP address.
domain-modeBOOLEANdomainLook up a domain's subdomains and associated IPs.
count-modeBOOLEANcountReturn only the number of results for a search.
honeyscore-modeBOOLEANhoneyscoreCheck whether an IP is likely a honeypot.
api-keySTRING·Shodan API key used to authenticate requests.
fieldsSTRING--fieldsComma-separated list of properties to output.
limitSTRING--limitCap the number of results returned.

Showing key inputs. shodan-python exposes 50 inputs in total.

Full flag reference (50 inputs)
NameTypeFlagDescription
typeSTRING--typeResult type for the query.
forceBOOLEAN--forceForce the operation.
limitSTRING--limitLimit the number of results returned.
facetsSTRING--facetsList of facets to get statistics for.
fieldsSTRING--fieldsList of properties to output.
formatSTRING--formatOutput format for the host information: pretty or tsv.
api-keySTRING·Shodan API key used to authenticate requests.
historyBOOLEAN--historyInclude historical data in the results.
verboseBOOLEAN--verboseVerbose output.
data-setSTRING--datasetSee the available files in the given dataset.
filenameSTRING--filenameSave the host information in the given file.
no-colorBOOLEAN--no-colorDisable colors in the output.
org-modeSTRINGorgManage your organization's access to Shodan.
data-modeBOOLEANdataBulk data access to Shodan.
host-mdoeBOOLEANhostView all available information for an IP address.
scan-modeBOOLEANscanScan an IP or netblock using Shodan.
separatorSTRING--separatorThe separator between the properties of the search results.
count-modeBOOLEANcountReturn the number of results for a search.
parse-modeBOOLEANparseExtract information out of compressed JSON files.
stats-modeBOOLEANstatsProvide summary information about a search query.
domain-modeBOOLEANdomainLook up DNS records and subdomains for a domain.
domain-nameSTRING·Domain name to look up in domain mode.
search-modeBOOLEANsearchSearch the Shodan database.
silent-modeSTRING--silentDo not send a notification to the user.
convert-modeBOOLEANconvertConvert the given input data file into a different format.
host-mode-ipSTRING·IP address to inspect in host mode.
org-mode-addSTRINGaddAdd a new member to the organization.
scan-mode-ipSTRING·IP address or netblock to scan.
wait-resultsSTRING--waitHow long to wait for results to come back.
honeyscore-ipSTRING·IP address to check whether it is a honeypot.
org-mode-infoBOOLEANinfoShow an overview of the organization.
data-mode-listBOOLEANlistList available bulk data files.
scan-mode-listBOOLEANlistShow recently launched scans.
honeyscore-modeBOOLEANhoneyscoreCheck whether the IP is a honeypot or not.
org-mode-removeSTRINGremoveRemove and downgrade a member.
save-informationBOOLEAN--saveSave the information in a file.
scan-mode-statusSTRINGstatusCheck the status of an on-demand scan by SCAN_ID.
scan-mode-submitSTRINGsubmitSubmit an IP or netblock to scan using Shodan.
stats-mode-querySTRING·Search query to summarize in stats mode.
search-mode-querySTRING·Search query to run in search mode.
count-search-querySTRING·Search query to count in count mode.
data-mode-downloadFILEdownloadDataset to download in bulk data mode.
parse-mode-filtersSTRING--filtersFilter the results for specific values using key:value.
scan-mode-internetSTRINGinternetScan the internet for a specific port and protocol using Shodan infrastructure.
domain-mode-detailsSTRING--detailsLook up host information for any IPs in the domain results.
parse-mode-filenameFILE·JSON file to parse.
scan-mode-protocolsSTRINGprotocolsList the protocols you can scan with using Shodan.
convert-mode-filenameFILE·Input file to convert.
data-mode-search-querySTRING·Search query used to select bulk data.
convert-mode-output-formatSTRING·Convert output format, for example kml, csv, geo.json, images, xlsx.

example

Run shodan-python

shodan-python · command
# search the index, cap the results, and print selected fieldsshodan search --limit 25 --fields ip_str,port,org,product 'product:nginx port:443'
sample output
198.51.100.23	443	Example Networks	nginx198.51.100.24	443	Example Networks	nginx203.0.113.10	443	Cloud Example BV	nginx203.0.113.42	8443	Example Hosting	nginx198.51.100.9	443	Example Networks	nginx203.0.113.77	443	Example Telecom	nginx

guidance

Choosing shodan-python

Use shodan-python for interactive Shodan work: searching the device index, inspecting a host, counting matches, or pulling stats. For a one-shot bulk dump to json.gz, use shodan-download.

shodan-download

Bulk-exports a query to json.gz for offline processing. Prefer it when you only need the raw dump.

securitytrails-subdomains

Passive DNS inventory rather than device banners. Complementary OSINT, not a substitute.

sherlock

Social-identity OSINT. A different axis from device and service intelligence.

faq

shodan-python questions

Common modes include search, host, count, stats, domain, and honeyscore. Toggle the mode on the node, pass a query or target, and set api-key. The key input replaces an upstream shodan init step.

Run shodan-python yourself

A search query feeds shodan-python, which queries the device index and writes the matching hosts and services as a queryable output.

Facts on this page come from the live Trickest tool library.