This Python script automates querying domains listed in a root.txt file using the Shodan API and WHOIS lookups. The script fetches organization details from Shodan and validates them against WHOIS data for better accuracy. The results are saved in shodan_org_results.txt.
-
WHOIS Integration: Retrieves the organization name associated with a domain.
-
Shodan Query: Uses Shodan's API to search for SSL certificate details related to the domains.
-
Fuzzy Matching: Matches Shodan organization results with the domain or WHOIS data using similarity scoring.
-
Error Handling: Handles API errors and WHOIS lookup failures gracefully.
-
Customizable Threshold: Allows fine-tuning of the similarity threshold for better matching.
-
Python 3.x
-
Shodan API Key (Membership API required for full functionality)
Install the required libraries:
pip install shodan python-whois
-
Clone the repository or download the script.
-
Create a
root.txtfile in the same directory as the script. Add one domain per line. Example:varonis.com shopify.com shopee.com asin.bj -
Replace
your_shodan_api_keyin the script with your actual Shodan API key. -
Run the script:
python3 p.py
The script processes each domain and saves the results in shodan_org_results.txt with the following format:
varonis.com:
- Varonis Systems, LTD
- Varonis Systems, Inc
shopify.com:
- Shopify Inc.
-
Input:
-
root.txtcontains:varonis.com shopify.com
-
-
Execution:
python3 p.py -
Output:
-
shodan_org_results.txt:varonis.com: - Varonis Systems, LTD - Varonis Systems, Inc shopify.com: - Shopify Inc.
-
If you encounter 403 Forbidden errors from Shodan:
-
Verify your API key.
-
Check your Shodan API usage and ensure you have a valid membership API.
-
Retry from a different network or IP if your current IP is restricted.
If WHOIS lookups fail for certain domains:
-
Ensure the domain is valid and resolvable.
-
Private WHOIS records may not return organization details.
Contributions, bug reports, and feature requests are welcome! Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Happy Bug Hunting! 🐞