Shodan Guide: Searching the Internet of Things
Learn to use Shodan for discovering internet-connected devices, analyzing exposed services, and identifying vulnerable systems through search queries.
Internet-Wide Reconnaissance
Shodan is a methodology for intelligence gathering across the entire internet. Unlike search engines that index web pages, Shodan scans IP addresses and indexes service banners, response headers, and device metadata — turning the global network of connected devices into a searchable intelligence database. This approach reveals exposed services, unsecured infrastructure, and the digital footprint of any organization connected to the internet.
Prerequisites
Before studying Shodan, you should understand:
Shodan Search Filters
Basic Filters
# Search by service/port
port:80
port:22
port:443
# Search by protocol
protocol:ssh
protocol:http
protocol:mysql
# Search by country
country:US
country:JP
country:DE
# Search by city
city:"San Francisco"
city:London
# Search by organization
org:"Google"
org:"Microsoft"
Advanced Filters
# Operating system
os:"Windows 10"
os:"Linux"
# Product and version
product:Apache
product:nginx
product:"Microsoft IIS"
version:2.4.49
# Hostname
hostname:target.com
hostname:*.target.com
# Network range
net:192.168.1.0/24
net:10.0.0.0/8
# SSL/TLS certificate
ssl.cert.subject.cn:target.com
ssl.cert.issuer.cn:"Let's Encrypt"
Practical Shodan Queries
Finding Vulnerable Systems
# Apache 2.4.49 (vulnerable to CVE-2021-41773)
apache version:2.4.49
# EternalBlue (SMBv1)
port:445 os:"Windows 7"
# Default credentials
"220" "VSFTPd" "ready"
# Unsecured Redis
product:Redis port:6379 "NOAUTH"
# Unsecured MongoDB
product:MongoDB port:27017 -authentication
# Open Elasticsearch
product:Elasticsearch port:9200
Discovering IoT Devices
# Webcams
webcam
"webcamxp" port:8080
"ip camera" port:80
# Industrial control systems
"modbus" port:502
"siemens" port:102
"bacnet" port:47808
# Network printers
"printer" port:9100
"JetDirect"
# Routers
"router" os:"Linux"
product: "MikroTik"
Organization-Specific Queries
# All services for an organization
org:"Target Corporation"
# SSL certificates for a domain
ssl.cert.subject.cn:target.com
# Subdomains
hostname:*.target.com
# All devices in a network
net:203.0.113.0/24
Using the Shodan CLI
Installation
# Install Shodan CLI
pip install shodan
# Initialize with API key
shodan init YOUR_API_KEY
Command Line Searches
# Basic search
shodan search "apache"
# Search with count
shodan count "nginx"
# Get host information
shodan host 8.8.8.8
# Download search results
shodan download results.txt "product:nginx"
# Parse downloaded results
shodan parse --fields ip_str,port,org results.txt.json.gz
# Get my IP info
shodan myip
Port Scanning with Shodan
# Use Shodan's scan infrastructure
shodan scan submit 203.0.113.0/28
# Check scan status
shodan scan status SCAN_ID
# List protocols Shodan can scan
shodan protocols
Using the Shodan API
import shodan
api = shodan.Shodan('YOUR_API_KEY')
# Search for devices
def search_devices(query):
try:
results = api.search(query)
for result in results['matches'][:10]:
ip = result['ip_str']
port = result['port']
org = result.get('org', 'N/A')
print(f"{ip}:{port} - {org}")
except shodan.APIError as e:
print(f"Error: {e}")
# Get host details
def get_host(ip):
try:
host = api.host(ip)
print(f"IP: {host['ip_str']}")
print(f"Organization: {host.get('org', 'N/A')}")
print(f"OS: {host.get('os', 'N/A')}")
for item in host['data']:
print(f"Port {item['port']}: {item['product']}")
except shodan.APIError as e:
print(f"Error: {e}")
search_devices("apache")
Shodan Monitor
Shodan Monitor provides continuous monitoring of your network:
# Create a monitor network
shodan monitor add "My Network" 203.0.113.0/24
# List monitored networks
shodan monitor list
# Get alerts
shodan alert
Real-World Use Cases
Exposure Assessment
# Find all exposed databases in your organization
shodan search "org:YourCompany port:5432,3306,6379,27017"
# Check for end-of-life software
shodan search "org:YourCompany windows 7"
shodan search "org:YourCompany apache 2.2"
Incident Response
# During breach investigation, check attacker infrastructure
shodan host ATTACKER_IP
# Find other systems using the same SSH key
shodan search "ssh fingerprint:KEY_HASH"
Competitive Intelligence
# Map competitor's exposure
shodan search "org:Competitor port:3389"
shodan search "org:Competitor product:mysql"
Common Mistakes
Using free tier only: The free Shodan tier shows limited results and filters. A paid account is needed for serious work.
Ignoring rate limits: API calls are rate-limited. Batch processing requires pagination.
Not filtering results: Shodan can return thousands of results. Use specific filters to narrow down.
Forgetting about false positives: Shodan banners may not reflect current state. Verify findings directly.
Best Practices
Related Tools
Related Articles
Summary
Shodan is a search engine for internet-connected devices that indexes service banners and metadata. Using filters for ports, products, organizations, and locations, security professionals can discover exposed services, find vulnerable devices, and map organizational attack surfaces. The CLI and API enable automation and integration into workflows.
Knowledge Check
Frequently Asked Questions
Continue Learning
Amass Guide: Open Source Attack Surface Mapping
Learn to use Amass for comprehensive attack surface mapping including DNS enumeration, subdomain discovery, integration with APIs, and visualizations.
OSINT · IntermediateAttack Surface Mapping: Complete External Reconnaissance Guide
Learn to map external attack surfaces using OSINT tools. Master subdomain discovery, service enumeration, and asset inventory for penetration testing and bug bounty hunting.
OSINT · IntermediateSubdomain Enumeration: Finding Hidden Attack Surface
Master subdomain enumeration techniques using passive and active methods to discover hidden subdomains and expand attack surface mapping.
OSINT · IntermediateEmail Enumeration Techniques: Corporate Email Discovery for OSINT
Master email enumeration techniques using theHarvester, search engines, and certificate transparency logs. Learn corporate email pattern discovery, employee identification, and attack surface mapping.
Related Security Tools
Shodan CLI
The Shodan Command-Line Interface allows you to interact with the Shodan search engine database directly from the terminal to query internet-connected assets and vulnerability data feeds.
Information GatheringNmap
Learn how to use Nmap, the free open-source network scanner: run your first port scan, discover live hosts, detect services and operating systems, and check for vulnerabilities with NSE scripts — a beginner tutorial for Kali Linux.
Information GatheringMaltego
Learn how to use Maltego, the graphical OSINT and link analysis tool: install the free Community Edition, add entities to a graph, run transforms and read the relationships between domains, IP addresses, organizations, people, and other entities.
Information GatheringSubfinder
Learn how to use Subfinder in this beginner tutorial, from installing ProjectDiscovery's passive subdomain tool to running and reading your first authorised scan. Add API keys for wider coverage, save clean results, and chain Subfinder into httpx to validate live web hosts before further testing.