Shodan
📖 Basic Usage Scenarios and Queries:
Shodan is a great source to begin looking for hosts that the parent organization owns. Shodan aggregates this information by banner grabbing and collecting information being leaked by insecure devices. The discovered information is then categorized and stored in a large database that users can search by type of device, brand name, operating system, location, and more. It is important to note that to use Shodan, you must have an account.
⛹️♂️ Basic Usage
For this example, we will leverage Shodan’s search engine. Our first search is a generic organization search to see what we can find on the organization using the following command:
org:"Organization_Name"
This usually only returns a hand full of results, but it is still important to mention. To take it a step further, we will leverage Shodan’s SSL certificate searching function. To minimize the potential for stale records, we will have Shodan only return IP’s that respond with a 200 status code using the following command:
ssl:"Organization_Name" 200
To show the amount of noise you get when searching without the 200 status code included, I queried Shodan against the organization “burmat.co”. Without specifying the required 200 status code, the query returned 152 results. With the required 200 status code, it returned only 7 results.
🔬 Shodan Queries
Fill in queries!
Search Query Indexes
Lists that probably have more queries than this page or your notes. Take a look through if you want some ideas. That’s primarily what this page is for! Use these arguments to build your own as-needed.
Favicon Hashes
Below is a link toe a list of favicon hashes. You can use these in a query like this: http.favicon.hash:81586312 to find specific hosts (this example is Jenkins).
Queries:
http.html:"xoxb-"
- Search for Slack tokenshttp.favicon.hash:81586312
- Search for Jenkins by favicon hashhttp.title:"Grafana"
- Publicly exposed Grafanavuln:ms17-010
- Eternal Blue hostsvuln:CVE-2014-0160
- Search for CVEssh port:22,3333
- Search for SSH on specific ports onlyproftpd port:21
- Search for proftpd on port 21 onlyssh -port:22
- Search for SSH on any port BUT 22 (non-standard ports)os:"Windows 10 Home 19041"
- Checking for vulnerable operating systemcountry:"IN" os:"windows 7"
- Search by OS and country
Exposed C2 hosts
🛠 Shodan Command Line Tools Installation
You can get your API key after signing into your account via browser and clicking on account in the top right corner.
pip3 install shodan
shodan init <Your API Key>
🍼 Basic Command Line Usage
https://github.com/lothos612/shodan
shodan <ipaddr>
shodan domain <domain.com>
shodan search ssl:"<domain.com>"
shodan search net:"63.64.65.66/24"
➰ Looping Hosts with Shodan CLI
Good way to quickly pull host data, port data, and CVE data.
while read ip; do shodan host "$ip" >> shodan_results.txt; sleep 1; done < discovered_ips.txt
Last updated