Shodan
The Shodan Command Line Interface (CLI) is useful for automated queries and host exploration.
CLI Initialization
Section titled “CLI Initialization”# Initialize with your Shodan API keyshodan init $API_KEYDefault Queries
Section titled “Default Queries”# Query information about a specific IP addressshodan host 8.8.8.8
# Search Shodan using standard search query filtersshodan search "port:22 os:linux"
# Get a count of search resultsshodan count "port:445 country:US"
# Check your current account balance and detailsshodan infoAdvanced Search & Data Export
Section titled “Advanced Search & Data Export”# Download search results to a file (saves JSON format)shodan download output_file "port:3389"
# Parse and read the downloaded data fileshodan parse --fields ip_str,port,org output_file.json.gz
# Check your public-facing IP addressshodan myip