2018-08-09 03:34:10 +08:00
|
|
|
from shodan import Shodan
|
2014-12-17 07:25:12 +08:00
|
|
|
import sys
|
2018-08-09 03:34:10 +08:00
|
|
|
import json
|
2014-12-17 07:25:12 +08:00
|
|
|
|
|
|
|
|
|
|
|
class search_shodan():
|
|
|
|
|
|
|
|
def __init__(self, host):
|
|
|
|
self.host = host
|
|
|
|
self.key = "oCiMsgM6rQWqiTvPxFHYcExlZgg7wvTt"
|
|
|
|
if self.key == "":
|
|
|
|
print "You need an API key in order to use SHODAN database. You can get one here: http://www.shodanhq.com/"
|
|
|
|
sys.exit()
|
2018-08-09 03:34:10 +08:00
|
|
|
self.api = Shodan(self.key)
|
|
|
|
|
2014-12-17 07:25:12 +08:00
|
|
|
def run(self):
|
|
|
|
try:
|
|
|
|
host = self.api.host(self.host)
|
|
|
|
return host['data']
|
2018-08-09 03:34:10 +08:00
|
|
|
except Exception, e:
|
2014-12-17 07:25:12 +08:00
|
|
|
print "SHODAN empty reply or error in the call"
|
2018-08-09 03:34:10 +08:00
|
|
|
print e
|
2014-12-17 07:25:12 +08:00
|
|
|
return "error"
|