Downloading Search Results
In this article we will be taking a look at the most common reason to use the CLI: grabbing search results without visiting the website. There are 2 commands to help you do this:
download. Both of them use search queries to grab results but in general we recommend to use
search. And they both use up query credits.
For a list of available search filters please checkout our Filter Reference page.
shodan parseinstead of
shodan searchto more effectively use your query credits.
Usage: shodan search [OPTIONS] <search query> Search the Shodan database Options: --color / --no-color --fields TEXT List of properties to show in the search results. --limit INTEGER The number of search results that should be returned. Maximum: 1000 --separator TEXT The separator between the properties of the search results. -h, --help Show this message and exit.
search command is intended to quickly grab a few results to make sure your search query is correct. It doesn't let you page over results and it doesn't store any data locally. As a result, you will generally want to use the
Remember that all of the below examples only show information about the 1st page of results. To download all of the results you need to use the
Search for nginx servers
shodan search nginx
Show a list of IPs and ports
shodan search --fields ip_str,port nginx
Show a comma-separated list of IPs and ports
shodan search --fields ip_str,port --separator , nginx
Usage: shodan download [OPTIONS] <filename> <search query> Download search results and save them in a compressed JSON file. Options: --limit INTEGER The number of results you want to download. -1 to download all the data possible. -h, --help Show this message and exit.
download command will perform the search and store the results in a local data file which you can then feed into other tools (including
shodan parse). It pages through the search results until the
--limit number of results has been reached.
Important: The first argument to
shodan download is the file name - not the search query.
Download the most recent 200 results for nginx
shodan download --limit 200 myresults.json.gz nginx
Download the most recent 500 results for services in San Diego
shodan download --limit 500 myresults.json.gz 'city:"San Diego"'
Download all the websites that are using Vue.js
shodan download --limit -1 myresults.json.gz http.component:vue.js