-
-
Save iamtutu/f1989d98774235f37718694f9a86fd41 to your computer and use it in GitHub Desktop.
A simple script to search Shodan and output the results as JSON-encoded banners; each line corresponds to a single banner.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
A simple script to search Shodan and output the results as JSON-encoded banners; | |
each line corresponds to a single banner. | |
Warning: This will use up query credits because it pages through the results! | |
Usage: python simple-export.py <search query> | |
""" | |
# Install via "easy_install shodan" | |
import shodan | |
# Install via "easy_install simplejson", it's more resilient than the default json package | |
import simplejson | |
# For accessing the command-line arguments | |
import sys | |
api = shodan.Shodan('YOUR API KEY') | |
for banner in api.search_cursor(sys.argv[1:]): | |
print simplejson.dumps(banner) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment