Skip to content

Instantly share code, notes, and snippets.

@achillean
Created January 7, 2015 19:22
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achillean/3a48795cb75df6d1c903 to your computer and use it in GitHub Desktop.
Save achillean/3a48795cb75df6d1c903 to your computer and use it in GitHub Desktop.
How to read events from the Threatnet stream. Note: make sure you have the latest version of the Shodan Python library installed (>=1.2.3).
import shodan.threatnet
# Configuration
API_KEY = "Please enter your API key here"
# Create the object that interfaces with the Threatnet API
tnet = shodan.threatnet.Threatnet(API_KEY)
# Get a stream of events and print them to stdout
for event in tnet.stream.events():
print event
# For full information on what information events contain please visit:
# https://developer.shodan.io/api/event-specification
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment