Giter VIP home page Giter VIP logo

shodan-python's Introduction

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

shodan-python's People

Contributors

achillean avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.