Created
June 12, 2014 23:43
-
-
Save achillean/f953cb917a7eb2a9f81d to your computer and use it in GitHub Desktop.
Basic code template for accessing the Shodan Streaming API using Python
This file contains 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 | |
# | |
# shodan-stream.py | |
# Read a firehose/ stream of 1% of the data that Shodan collects in real-time. | |
# | |
# WARNING: This script only works with people that have a subscription API plan! | |
# And by default the Streaming API only returns 1% of the data that Shodan gathers. | |
# If you wish to have more access please contact us at [email protected] for pricing | |
# information. | |
# | |
# Author: achillean | |
import shodan | |
import sys | |
# Configuration | |
API_KEY = 'YOUR API KEY' | |
try: | |
# Setup the api | |
api = shodan.Shodan(API_KEY) | |
for banner in api.stream.banners(): | |
print banner | |
except Exception, e: | |
print 'Error: %s' % e | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment