Skip to main content
ASM Cheatsheet

Shodan

Intermediate

Internet-connected device search engine

https://www.shodan.io

Installation

# Python CLI
pip install shodan

# Initialize with API key
shodan init YOUR_API_KEY

Usage

Basic Searches

# Search by organization
shodan search "org:Example Corp"

# Search by hostname
shodan search hostname:example.com

# Search by service
shodan search "apache"
shodan search "nginx"
shodan search "IIS"

# Search by port
shodan search port:22
shodan search port:3389

# Search by country
shodan search country:US

Advanced Queries

# Combine multiple filters
shodan search "org:Example Corp" port:443 country:US

# Find specific vulnerabilities
shodan search vuln:CVE-2021-44228  # Log4j
shodan search vuln:CVE-2017-0144   # EternalBlue

# Search by HTTP headers
shodan search "Server: nginx" "X-Powered-By: PHP"

# Find default credentials
shodan search "default password"
shodan search "admin:admin"

Programmatic Usage

import shodan

api = shodan.Shodan('YOUR_API_KEY')

# Search for hosts
results = api.search('org:"Example Corp"')
for result in results['matches']:
    print(f"{result['ip_str']}:{result['port']} - {result.get('product', 'Unknown')}")

# Get host information
host = api.host('8.8.8.8')
print(f"Organization: {host.get('org', 'Unknown')}")
print(f"Operating System: {host.get('os', 'Unknown')}")