Skip to content
Python library for SHODAN
Find file
Pull request Compare This branch is 110 commits behind achillean:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Visit the official Shodan API documentation at:


To install the library from the cheeseshop, you can use easy_install:

easy_install shodan

Or simply download this repository and run:

python install


Before you can use the API, you need to have an API key.

Get your API key here

Setup the SHODAN WebAPI:

from shodan import WebAPI

api = WebAPI(MY_API_KEY)

Print a list of cisco-ios devices:

result ="cisco-ios")
for host in result['matches']:
    print host['ip']

Get all the information SHODAN has on the IP

host ='')
print host

Query ExploitDB ( for exploits relating to PHP:

exploits ='PHP')
print 'Found %s exploits' % exploits['total']
for exploit in exploits['matches']:
    print exploit

To download the actual exploit code, just follow it up with:

code =['id'])
print 'Name: %s' % code['filename']
print 'Type: %s' % code['content-type']
print 'Contents:\n%s' % code['data']

To properly handle potential errors, you should wrap all requests in a try/except block:

except Exception, e:
    print 'Error: %s' % e

Visit the official Shodan API documentation at:


Something went wrong with that request. Please try again.