Shodan Complete Tutorial 2026: Search Filters, CLI, API & Attack Surface Monitoring

·

Google indexes web pages. Shodan indexes devices. It continuously scans the public IPv4 (and increasingly IPv6) internet, connects to open ports, grabs the service banner each host returns, and stores it — the software, version, TLS certificate, geolocation, owning organisation, and any CVEs that banner is known to carry. The result is a search engine for everything plugged into the internet: databases with no password, industrial controllers, exposed RDP, forgotten dev servers, printers, cameras, and your own shadow IT.

This guide is written for the two people who get the most out of Shodan: the defender mapping their organisation's real external attack surface, and the penetration tester doing passive reconnaissance before ever sending a packet at the target. You will install the CLI three different ways, learn the filter language that turns noise into precision, automate everything with the official Python API, and stand up Shodan Monitor so you get an alert the moment a new port opens on your network.

Everything below is passive OSINT against banners Shodan already collected — but the on-demand scan and monitor features do touch hosts directly, so the legal and OPSEC rules in the final phase are not optional reading.

◈ Table of Contents

01 What Shodan Is & Why Defenders Use It 02 Account, API Key & Credit Model 03 Method 1 — Install the CLI Natively 04 Method 2 & 3 — venv & Docker 05 Web Interface & Search Filters 06 Command-Line Reconnaissance 07 Automate with the Python API 08 Attack Surface Monitoring 09 Integrations: Nmap, Metasploit, Nuclei 10 Advanced, OPSEC, Troubleshooting 11 Sources & References
📡

01 — WHAT SHODAN IS & WHY DEFENDERS USE IT

CONCEPTS
01
Banner Grabbing, Not Web Crawling
How it works

Shodan runs a fleet of crawlers that pick random public IP addresses around the clock, connect to a large set of common ports, and record the raw response — the "banner" — that each service sends back. It never follows links like a web crawler; it talks directly to services. A single result therefore describes one service on one host: its IP, port, transport, detected product and version, TLS certificate details, hostnames, ASN/organisation, country and city, and any CVEs historically tied to that product version.

WHAT A RAW BANNER LOOKS LIKE (SSH)
# The service literally sends this string on connect; # Shodan stores and indexes it verbatim. SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.6 # From that single line Shodan derives: # product = OpenSSH version = 8.9p1 # os hint = Ubuntu port = 22

Because Shodan indexes the banner, your searches match on what a service advertises about itself — not on live behaviour. A device may have been patched hours ago but still show a vulnerable version until Shodan re-crawls it (typically every few days to a couple of weeks). Always treat results as a lead to verify, never as ground truth.

02
Where Shodan Fits — Blue Team vs Red Team
Use cases

The same dataset serves opposite missions. Defenders use Shodan to see themselves the way an attacker does — an external, unauthenticated view of every service they have accidentally left exposed. Offensive testers use it to build a target's footprint without sending a single probe, keeping the reconnaissance phase completely off the target's radar.

🛡️

External Attack Surface Mgmt

Enumerate every port, service and certificate exposed on your org or net ranges, then close what should not be public.

🔎

Passive Recon

Map a target's IP ranges, subdomains and tech stack from Shodan's cache — zero packets to the target, zero logs on their side.

⚠️

Exposure Hunting

Find unauthenticated databases, exposed admin panels and known-CVE services across an ASN before an adversary does.

📡

Continuous Monitoring

Shodan Monitor watches your ranges and alerts on new open ports, new vulns, or newly exposed services in near real time.

Shodan is powerful precisely because it lowers the barrier to finding exposed systems. Searching is legal; connecting to, logging into, or exploiting anything you find is not, unless you own it or hold written authorisation. This guide is for defending your own assets and for authorised testing only.

🔑

02 — ACCOUNT, API KEY & CREDIT MODEL

SETUP
01
Create the Account & Grab Your API Key
Prereq

Almost every useful Shodan feature — the CLI, the API, monitoring — authenticates with a single API key. Register a free account first, then copy the key from your account page. Keep it secret: your key is tied to your credit balance and can be abused if leaked.

  • 1Register at account.shodan.io/register and confirm your email.
  • 2Sign in and open account.shodan.io — your API Key is shown at the top of the page.
  • 3Treat it like a password. You will feed it to the CLI once with shodan init, and reference it from scripts via an environment variable.
🔗
Shodan Account & API Key
account.shodan.io — official key management page
OPEN →
02
Membership Tiers & What Each Unlocks
Plans

A free account lets you log in and run basic searches, but the filter language, bulk export and monitoring are gated behind a paid tier. The most cost-effective option for individuals has long been the one-time Membership unlock (a lifetime upgrade, not a subscription); ongoing high-volume automation uses metered API subscription plans.

TierSearch filtersMonitoringBest for
FreeVery limited; most filters blocked1 IPTrying it out
Membership (one-time)Full filter language, screenshots, export16 IPsIndividuals, learners, CTF
API subscriptionFull + high query/scan volumeLarge rangesAutomation, ASM at scale

Shodan frequently discounts the lifetime Membership around Black Friday. If you only need it for study or occasional recon, wait for that window — it is dramatically cheaper than any subscription and never expires.

03
The Three Credit Types — Don't Burn Them
Credits

Shodan meters usage with three separate credit pools. Understanding them is the difference between a productive month and hitting a wall on day three. Credits from a Membership refresh monthly and do not roll over; the first page of any web search is free, and the count command never costs a credit.

Credit typeSpent whenFree alternative
Query creditsPaginating past page 1 of results, or API search() beyond the first 100 resultsUse count / facets for totals
Scan creditsYou request an on-demand scan of a host with shodan scanQuery existing cached data instead
Export creditsYou bulk-download results with shodan downloadStream/parse smaller result sets

The classic beginner mistake: running broad shodan download or deep pagination and draining a whole month of query credits in minutes. Always prototype a query with shodan count (free) to see how many results exist before you spend a credit pulling them.

💾

03 — METHOD 1: INSTALL THE CLI NATIVELY

INSTALL
01
Linux (Kali / Debian / Ubuntu)
Linux

The Shodan CLI is a Python package published on PyPI. On any Linux system with Python 3 and pip you can install it in one line. On modern Kali and Debian releases, the system Python is "externally managed", so prefer a per-user or pipx install to avoid clobbering distro packages.

PIP — PER USER (RECOMMENDED)
$ python3 -m pip install --user -U shodan # Verify the binary is on PATH and check the version $ shodan version 1.31.0
PIPX — ISOLATED, CLEANEST ON KALI 2026
$ sudo apt update && sudo apt install pipx -y $ pipx install shodan $ pipx ensurepath # adds ~/.local/bin to PATH; re-open shell after

If you see error: externally-managed-environment, do not force it with --break-system-packages on your main box. Use pipx (above) or a virtualenv (Method 2). Breaking system packages is how you brick a Kali install.

02
macOS & Windows
Cross-platform

The same pip package works everywhere Python runs. On macOS use Homebrew's Python or pipx; on Windows install from python.org (tick "Add Python to PATH") and use pip from PowerShell.

MACOS — HOMEBREW + PIPX
$ brew install pipx $ pipx install shodan $ shodan version
WINDOWS — POWERSHELL
PS> py -m pip install -U --user shodan # If 'shodan' is not recognised, call it via the module: PS> py -m shodan version

On Windows, if shodan isn't found after install, your user Scripts directory isn't on PATH. Either add %APPDATA%\Python\Python3x\Scripts to PATH, or just invoke everything as py -m shodan ... — the subcommands are identical.

03
Authenticate the CLI with Your Key
Init

Before any command works you must bind your API key to the CLI. This is a one-time step; the key is written to a small config file in your home directory (~/.config/shodan/api_key on Linux) and reused by every subsequent command.

ONE-TIME INITIALISATION
$ shodan init YOUR_API_KEY_HERE Successfully initialized # Confirm the key works and see your plan + remaining credits $ shodan info Query credits available: 100 Scan credits available: 100 Plan: dev
CLI Ready When
  • shodan version prints a version number
  • shodan init returns "Successfully initialized"
  • shodan info shows your plan and credit balances
🐳

04 — METHOD 2 & 3: VIRTUALENV & DOCKER

INSTALL
01
Method 2 — Isolated Python virtualenv
venv

A virtualenv keeps Shodan and its dependencies out of your system Python entirely — the right choice on "externally managed" distros and when you script against the API library. Everything lives in one folder you can delete to uninstall.

CREATE, ACTIVATE, INSTALL
$ python3 -m venv ~/shodan-env $ source ~/shodan-env/bin/activate (shodan-env) $ pip install -U shodan (shodan-env) $ shodan init YOUR_API_KEY_HERE # When finished: (shodan-env) $ deactivate

Inside a venv, the shodan Python library and the shodan CLI are the same install — so import shodan in your scripts and the command-line tool always agree on version. That consistency matters when you automate (Phase 07).

02
Method 3 — Run Shodan in Docker
Docker

If you want a throwaway, dependency-free environment — or you run Shodan inside CI — a container is ideal. There is no need for a heavyweight image: the official python:slim base plus a one-line pip install gives you a working CLI. Pass the API key as an environment variable so it never bakes into the image.

ONE-OFF CONTAINER RUN
$ docker run --rm -it \ -e SHODAN_API_KEY=$SHODAN_API_KEY \ python:3.12-slim \ bash -c "pip install -q shodan && shodan init \$SHODAN_API_KEY && shodan info"
REUSABLE IMAGE — Dockerfile
# Dockerfile FROM python:3.12-slim RUN pip install --no-cache-dir shodan ENTRYPOINT ["shodan"]
BUILD & USE — with a docker-compose wrapper
# docker-compose.yml — a reusable recon service services: shodan: build: . environment: - SHODAN_API_KEY=${SHODAN_API_KEY} entrypoint: ["sh","-c"] command: ["shodan init $SHODAN_API_KEY && shodan info"] # Build and run: $ export SHODAN_API_KEY=your_key $ docker compose build $ docker compose run --rm shodan

Never COPY your API key into a Dockerfile or commit it to a compose file. Anyone who pulls the image or reads your git history gets your key and your credits. Always inject it at runtime via -e / environment, as shown.

🔍

05 — WEB INTERFACE & SEARCH FILTERS

CORE SKILL
01
The Web Search — Read a Result Correctly
Web UI

At shodan.io, the search bar accepts free-text and filter:value syntax. Every result shows the IP, hostnames, owning org/ISP, location, and a set of facet sidebars — top ports, top countries, top organisations, top products — that let you pivot instantly. Click any host to see its full banner set and a "Vulnerabilities" panel listing CVEs mapped to the detected versions.

  • 1Type a query, e.g. product:MongoDB, and read the left facet rail to understand the population before drilling in.
  • 2Use the map and "Images" tabs (screenshots) to triage exposed panels visually.
  • 3Open a single host page to see all services, the TLS cert chain, and the CVE list Shodan attaches.
02
The Filters That Matter
Reference

Without filters, a keyword search is noise. Filters are how you slice the internet down to exactly the population you care about. These are the filters you will use daily; combine them freely, and remember most require a paid tier.

FilterMatchesExample
port:Open port / serviceport:3389
product:Detected softwareproduct:nginx
version:Software versionproduct:OpenSSH version:8.9p1
org:Owning organisationorg:"Contoso Ltd"
net:CIDR / IP rangenet:203.0.113.0/24
hostname:Hostname substringhostname:.example.com
asn:Autonomous Systemasn:AS13335
country: / city:Geolocationcountry:US city:"New York"
http.title:HTML <title>http.title:"Citrix Gateway"
http.html:Body contenthttp.html:"wp-login"
http.status:HTTP status codehttp.status:200
ssl.cert.subject.cn:TLS cert common namessl.cert.subject.cn:example.com
ssl.jarm:JARM TLS fingerprintssl.jarm:2ad...
vuln:Mapped CVE (paid)vuln:CVE-2021-44228
tag:Shodan tag (paid)tag:database
has_screenshot:Has a screenshothas_screenshot:true
before: / after:Banner date (d/m/Y)after:01/01/2026

The vuln: filter is the sharpest and the most restricted — it typically requires an academic or enterprise-grade API plan, not just Membership. If vuln: returns "requires membership" errors, pivot to product: + version: and cross-reference CVEs yourself.

03
Combining Filters — Worked Queries
Recipes

Precision comes from stacking filters and negating noise with a leading minus. The queries below are the kind you run during an authorised engagement or a self-audit — each narrows the internet to one specific exposure class. Point org:/net: at ranges you own or are authorised to test.

DEFENSIVE SELF-AUDIT — YOUR OWN ORG
# Every RDP endpoint exposed under your org org:"Your Company" port:3389 # Databases that should never face the internet org:"Your Company" port:3306,5432,27017,9200,6379 # Expired-branding or forgotten dev boxes by title org:"Your Company" http.title:"index of /"
EXPOSURE PATTERNS (AUTHORISED SCOPE ONLY)
# Unauthenticated MongoDB banners product:MongoDB "MongoDB Server Information" -authentication # Publicly reachable Kibana / Elasticsearch dashboards product:Elastic port:9200 http.title:"kibana" # A specific edge appliance in one country http.title:"citrix gateway" country:NZ

Quote multi-word values (org:"Palo Alto Networks"), separate OR-values with commas (port:80,443,8080), and prefix a term with - to exclude it (-http.status:401 drops auth-protected hits). These three tricks cover 90% of real query building.

06 — COMMAND-LINE RECONNAISSANCE

CLI DEEP DIVE
01
host — Everything Shodan Knows About One IP
Lookup

The shodan host command is the fastest way to profile a single address: open ports, detected products, hostnames, org, and mapped vulnerabilities — all from cache, so it costs no query credit. Add --history to see how the host changed over time, or --details for the raw banners.

PROFILE A HOST (USE AN IP YOU OWN / ARE SCOPED FOR)
$ shodan host 1.1.1.1 1.1.1.1 Hostnames: one.one.one.one Country: Australia Org: Cloudflare, Inc. Ports: 53/tcp domain 80/tcp http 443/tcp https # Include historical banners and full detail $ shodan host --history --details 1.1.1.1
02
count & search — Size First, Then Pull
Query

Always size a query with count (free) before spending credits with search. search prints matching results and accepts --fields to control columns and --limit to cap output — critical for not burning query credits on a huge result set.

COUNT IS FREE — MEASURE BEFORE YOU PULL
$ shodan count port:3389 country:NZ 18342 # Only now decide whether it is worth a search
SEARCH WITH TIDY, SCRIPTABLE OUTPUT
$ shodan search --fields ip_str,port,org,hostnames \ --limit 25 "product:nginx country:NZ" 203.0.113.10 443 Example ISP web01.example.co.nz 203.0.113.44 80 Example ISP -

Omitting --limit lets search paginate deep and quietly consume one query credit per page beyond the first. On broad queries that is your whole monthly allowance. Cap it, always.

03
stats — Facet Analysis for Attack-Surface Shape
Analytics

Facets are aggregate breakdowns and they are the analyst's best friend: instead of listing hosts, they summarise a population by any field — top ports, top products, top ASNs, top vulns. This is how you understand an org's exposure at a glance, cheaply.

BREAK A POPULATION DOWN BY FIELD
$ shodan stats --facets port,product,org \ "net:203.0.113.0/24" Top 10 Results for Facet: port 443 142 22 88 80 61 Top 10 Results for Facet: product nginx 73 OpenSSH 88 Microsoft IIS 19

Facets read from the search index, so a facet query is far cheaper than pulling every host. When you onboard a new range for monitoring, run a stats --facets pass first to map the shape of the exposure before drilling into individual hosts.

04
download & parse — Offline, Repeatable Analysis
Export

For a snapshot you can diff over time, download writes results to a compressed JSON lines file (costs export credits, one per result set page), and parse extracts fields from that file locally — free, repeatable, and perfect for feeding a spreadsheet or SIEM.

DOWNLOAD ONCE, PARSE MANY TIMES
$ shodan download --limit 500 myrange "net:203.0.113.0/24" Saved 500 results into: myrange.json.gz # Extract just the columns you need — no credits used $ shodan parse --fields ip_str,port,product \ --separator , myrange.json.gz > surface.csv
DIFF TWO SNAPSHOTS TO FIND NEW EXPOSURE
$ shodan parse --fields ip_str,port monday.json.gz | sort > mon.txt $ shodan parse --fields ip_str,port friday.json.gz | sort > fri.txt $ comm -13 mon.txt fri.txt # ports that appeared this week
05
myip, domain & honeyscore — Quick Utilities
Utilities

Three small commands earn their keep constantly. myip returns your current public IP (handy in scripts and VPN checks), domain dumps DNS + subdomain intel for a domain, and honeyscore estimates the probability that an IP is a honeypot — useful before you trust an "easy" target during authorised testing.

EVERYDAY ONE-LINERS
$ shodan myip 198.51.100.23 # DNS records + known subdomains for a domain $ shodan domain example.com # 0.0 = real host, 1.0 = almost certainly a honeypot $ shodan honeyscore 203.0.113.10 0.3

Run shodan domain yourcompany.com against your own domains regularly — it surfaces subdomains and DNS records that Shodan has seen, which is a cheap way to catch forgotten staging., vpn-old. and test. hosts before an attacker enumerates them.

🐍

07 — AUTOMATE WITH THE PYTHON API

AUTOMATION
01
Set Up the Client
SDK

The same shodan package exposes a clean Python client. Read the key from an environment variable — never hard-code it — and you have programmatic access to search, host lookups, counts, facets and alerts.

CLIENT BOOTSTRAP
# pip install shodan (already done in Method 1/2) import os, shodan api = shodan.Shodan(os.environ["SHODAN_API_KEY"]) # Sanity check — plan and remaining credits info = api.info() print(info["query_credits"], info["scan_credits"])

Set the key in your shell (export SHODAN_API_KEY=...) or a .env that is git-ignored. A hard-coded key committed to a public repo is the single most common way Shodan users get their credits drained by scrapers.

02
Search & Paginate Safely
Script

Use count() first (free), then iterate results deliberately. The search_cursor() helper pages through large result sets one item at a time — but every page past the first costs a query credit, so gate it with a hard cap.

SIZE, THEN PULL WITH A HARD CAP
from itertools import islice query = "product:nginx country:NZ" # Free: how big is this population? total = api.count(query)["total"] print(f"{total} matching services") # Credit-aware pull: never exceed 200 results for banner in islice(api.search_cursor(query), 200): print(banner["ip_str"], banner["port"], banner.get("product", "-"))
03
A Real Defensive Script — Exposure Report
Blue team

Here is something you can actually run weekly against ranges you own: it walks your networks, flags any service on a "should-never-be-public" port list, and prints a report you can email or push to a ticket queue. It uses only cached data and cheap host lookups.

exposure_report.py
import os, shodan api = shodan.Shodan(os.environ["SHODAN_API_KEY"]) MY_NETS = ["203.0.113.0/24", "198.51.100.0/24"] FORBIDDEN = {3389, 3306, 5432, 27017, 9200, 6379, 5900, 23} for net in MY_NETS: q = f"net:{net}" for b in api.search_cursor(q): port = b["port"] if port in FORBIDDEN: cves = list(b.get("vulns", {}).keys()) print(f"[EXPOSED] {b['ip_str']}:{port} " f"{b.get('product','?')} vulns={cves}")
This Script Surfaces
  • Any RDP, database, VNC or Telnet service reachable from the internet
  • The product/version banner for each exposed service
  • CVEs Shodan has already mapped to those banners
  • A diff-able text report you can schedule via cron
🔔

08 — ATTACK SURFACE MONITORING

DEFENSIVE
SHODAN MONITOR — CONTINUOUS EXTERNAL ATTACK-SURFACE DIFF
01
Shodan Monitor — the Web Dashboard
Monitor

Shodan Monitor (monitor.shodan.io) lets you register the IP ranges you are responsible for and get notified whenever the exposure changes — a new port opens, a new service appears, or a known CVE is detected. It is the single highest-value defensive feature Shodan offers, and Membership includes a modest IP quota.

  • 1Open monitor.shodan.io and click Add IP / Network.
  • 2Enter your CIDR ranges — only ranges you own or are authorised to watch.
  • 3Configure notifications (email, and via API a webhook) for the trigger types you care about.

Only add networks you are authorised to monitor. Registering someone else's range doesn't scan it for you — Shodan already has the data — but building alerting workflows around third-party assets you don't own is out of bounds.

02
Network Alerts from the CLI
alert

Everything Monitor does in the browser is scriptable through shodan alert. Create an alert bound to a range, list your alerts, and wire triggers so changes generate notifications — perfect for baking attack-surface monitoring into infrastructure-as-code.

CREATE & MANAGE ALERTS
# Create a named alert for a network you own $ shodan alert create "Prod Edge" 203.0.113.0/24 Successfully created network alert! Alert ID: JHU7XKQ2A9RDEXAMPLE # List all alerts and enable triggers $ shodan alert list $ shodan alert triggers # see available trigger types $ shodan alert enable JHU7XKQ2A9RDEXAMPLE malware,new_service,vulnerable
03
Real-Time Stream of Your Alerts
stream

The shodan stream command opens a live feed. Restricted to your own alerts with --alerts, it prints banner events as Shodan observes changes on your monitored ranges — pipe it to a script and you have a home-grown SOC feed.

LIVE FEED, SCOPED TO YOUR ALERTS
# Stream events only for networks you registered $ shodan stream --alerts=all # Pipe to jq or a handler for routing to Slack/SIEM $ shodan stream --alerts=all | while read line; do echo "$line" | logger -t shodan-monitor done

Point shodan stream --alerts at a small handler that forwards new-service and vulnerable-service events into your ticketing or chat system. You now get external-exposure detection with a latency measured in Shodan's crawl interval — for free with an account you already pay for once.

🔧

09 — INTEGRATIONS: NMAP, METASPLOIT, NUCLEI

TOOLING
01
Nmap — Passive Enrichment with the Shodan NSE Script
Nmap

Nmap ships a shodan-api NSE script that queries Shodan's cache for each target's host data — so you learn open ports and CVEs without sending scan packets. That is invaluable when you want an initial picture but must stay quiet on the wire.

PASSIVE HOST DATA VIA NMAP + SHODAN
$ nmap --script shodan-api \ --script-args shodan-api.apikey=$SHODAN_API_KEY \ -sn -Pn 203.0.113.10 # -sn -Pn: no port scan sent; data comes from Shodan's cache

Pair this with our full Nmap tutorial: use the Shodan NSE script to build a cheap, silent host list first, then switch to active Nmap scanning only on the handful of hosts that actually warrant packets.

02
Metasploit — the shodan_search Module
Metasploit

Metasploit's auxiliary/gather/shodan_search module runs a Shodan query from inside the console and drops results into the workspace database, so hosts you discover flow straight into the rest of your (authorised) engagement.

msfconsole
msf6 > use auxiliary/gather/shodan_search msf6 auxiliary(shodan_search) > set SHODAN_APIKEY $SHODAN_API_KEY msf6 auxiliary(shodan_search) > set QUERY "org:\"Your Company\" port:3389" msf6 auxiliary(shodan_search) > run

Feeding Shodan results into Metasploit blurs recon and exploitation fast. Keep the scope document open: a host appearing in Shodan does not put it in your authorised target list. Only act on assets explicitly in scope.

03
InternetDB & Nuclei — Free, Keyless, Scriptable
Pipelines

Shodan's InternetDB API (internetdb.shodan.io) returns open ports, hostnames, tags and CVEs for a single IP with no key and no credits — ideal for lightweight enrichment in a pipeline. Pipe those IPs into a scanner like Nuclei to validate exposures on assets you are authorised to test.

KEYLESS ENRICHMENT — NO CREDITS
# Free, unauthenticated per-IP summary $ curl -s https://internetdb.shodan.io/1.1.1.1 | jq { "ip": "1.1.1.1", "ports": [53, 80, 443], "cpes": [...], "vulns": [], "hostnames": ["one.one.one.one"] }
CHAIN INTO NUCLEI (AUTHORISED SCOPE)
# Pull ports for your range, then template-scan them $ shodan search --fields ip_str --limit 100 "net:203.0.113.0/24" \ | nuclei -silent -tags cve,exposure

InternetDB has no rate-limit gate on a key, so it is the right choice for enriching large IP lists in CI or dashboards. Reserve your credit-bearing Shodan queries for the filter-rich searches InternetDB can't do.

⚠️

10 — ADVANCED, OPSEC & TROUBLESHOOTING

PRO
01
On-Demand Scanning — Use Sparingly
scan

Most Shodan work is passive, reading cached banners. But shodan scan asks Shodan to actively re-scan an IP or range now and costs scan credits. This does send packets at the target, so it is only appropriate against assets you own or are explicitly authorised to test.

REQUEST A FRESH SCAN (OWN / AUTHORISED IPs ONLY)
$ shodan scan submit 203.0.113.10 Starting scan... Scan ID: R7K2EXAMPLE $ shodan scan status R7K2EXAMPLE $ shodan scan list # history of your scans

shodan scan generates real traffic to the target from Shodan's infrastructure. Running it against systems you don't own or have written permission to test can constitute unauthorised scanning. Passive search does not carry this risk; active scan does.

02
Legal & OPSEC Ground Rules
Rules

Shodan makes exposure trivial to find, which makes discipline essential. Searching the index is passive and legal in most jurisdictions; the moment you interact with a discovered host — logging in, downloading data, exploiting a CVE — you leave OSINT and enter conduct that requires authorisation.

Always fine

Searching banners, running facets, profiling your own ranges, monitoring assets you own.

⚠️

Authorisation required

Active scan submit, InternetDB→Nuclei chains, or Metasploit against a target — only within a signed scope.

Never

Logging into an "open" database, screenshotting private panels, or touching third-party systems you don't own.

03
Troubleshooting — Common Errors
Fixes

Most Shodan CLI and API problems come down to four causes: PATH, key binding, plan limits, or credit exhaustion. This table maps the message you see to the fix.

SymptomCauseFix
shodan: command not foundUser scripts dir not on PATHRe-open shell; pipx ensurepath; or run python3 -m shodan
Invalid API keyNever ran init / wrong keyshodan init <key>; re-copy from account.shodan.io
Requires membershipFilter (vuln/tag) needs paid tierUpgrade, or pivot to product:+version:
403 / Access deniedQuery credits exhaustedUse count/facets; wait for monthly refresh
externally-managed-environmentPEP 668 on Kali/DebianInstall with pipx or in a venv
No information availableHost not yet crawledTry scan submit (own IPs) or wait for re-crawl

When automating, always wrap API calls in a handler for shodan.APIError and back off on rate-limit messages. The free/Membership API is rate-limited to roughly one request per second — respect it and your long-running jobs won't get throttled or blocked.

📚

11 — SOURCES & REFERENCES

DOCS

Primary documentation used to verify every command, filter and credit rule in this guide:

Shodan Help Center — official product documentation Shodan CLI — Installation & Getting Started Shodan — Search Query Fundamentals & Filters Shodan REST & Streaming API Reference Shodan Monitor — attack-surface monitoring dashboard Shodan InternetDB — free keyless per-IP API Nmap NSE — shodan-api script documentation Shodan Account — API key & membership management

Everything in this tutorial is for defending assets you own and for authorised security testing only. Passive Shodan searches are OSINT; the scan, monitor and integration features touch live hosts and must be limited to systems you own or hold written permission to test. Unauthorised scanning or access violates computer-misuse law in most jurisdictions. CyberHawk Threat Intel and the author accept no responsibility for misuse of these techniques.

What to Learn Next
  • Nmap Complete Tutorial — turn Shodan leads into verified, active scans
  • theHarvester & Recon-ng — round out passive OSINT and subdomain enumeration
  • Nuclei & OpenVAS — validate the exposures Shodan surfaces on in-scope hosts
  • CyberHawk SOPs — structured response for when an exposure turns into an incident
🔍 Check an IP or domain in the CyberHawk IOC Scanner

◈ Stay Connected

Follow CyberHawk Threat Intel for threat intelligence, deployment guides and hands-on SOC tooling content.

🌐 Website ▶️ YouTube ▶️ YouTube (2) 𝕏 Twitter / X ♪ TikTok ✈️ Telegram
🔍 IOC Scanner 🛠️ Live Tools 📚 Courses 🚨 Threat Intel 📝 Blog 📋 SOPs

"They can't exploit you if you are the Exploit."