Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

qqshow/shodan-python

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Visit the official Shodan API documentation at:

http://docs.shodanhq.com

Installation

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

easy_install shodan

Or simply download this repository and run:

python setup.py install

Usage

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 = api.search("cisco-ios")
for host in result['matches']:
	print host['ip']

Get all the information SHODAN has on the IP 217.140.75.46:

host = api.host('217.140.75.46')
print host

Query ExploitDB (http://www.exploit-db.com) for exploits relating to PHP:

exploits = api.exploitdb.search('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 = api.exploitdb.download(exploit['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:

try:
	api.search("cisco-ios")
except Exception, e:
	print 'Error: %s' % e

Visit the official Shodan API documentation at:

http://docs.shodanhq.com

Articles

About

Python library for SHODAN

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
Morty Proxy This is a proxified and sanitized view of the page, visit original site.