This is a simple Bash script to perform a mass check of IP addresses using Shodan. The script reads a list of IP addresses from a file, queries Shodan for each IP, and saves the results to a text file.
Before running the script, make sure you have the following:
-
Shodan CLI: You need to have the Shodan command-line interface installed. You can install it using pip:
pip install shodan
-
Shodan API Key: You need a Shodan API key to use the Shodan CLI. If you don't have one, you can get it by signing up on Shodan.
-
API Key Configuration: Initialize your Shodan CLI with your API key:
shodan init <YOUR_API_KEY> ## Script Description
The script shodan_check.sh performs the following tasks:
- Reads a list of IP addresses from
ips.txt. - For each IP address, it queries Shodan using the
shodan hostcommand. - Appends the results to
shodan_results.txt, including a separator for clarity.
ips.txt: A text file containing a list of IP addresses, one per line.shodan_check.sh: The Bash script that performs the mass check.shodan_results.txt: The output file where results are saved.
-
Prepare the IP List: Create a file named
ips.txtin the same directory as the script. Add each IP address on a new line. -
Run the Script: Execute the script by running the following command in your terminal:
./shodan_check.sh
-
View the Results: After the script finishes running, check the
shodan_results.txtfile for the output. This file will contain the Shodan results for each IP address queried.
- Ensure that you have sufficient API quota on Shodan, as querying a large number of IPs may consume your available API requests.
- The script will append new results to
shodan_results.txt. If you want a fresh start, consider deleting or renaming the existingshodan_results.txtfile before running the script.