Last active
December 25, 2015 10:29
-
-
Save 0xPr0xy/6962384 to your computer and use it in GitHub Desktop.
shodan surveillance cam search and monitoring html generation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| from __future__ import with_statement | |
| import time | |
| from shodan import WebAPI | |
| import re,socket | |
| import sys | |
| import gevent | |
| from gevent import socket | |
| from gevent.pool import Pool | |
| from gevent import monkey | |
| import datetime | |
| monkey.patch_all() | |
| key = 'YOUR_API_KEY' | |
| filter = 'netcam' | |
| api = WebAPI(key) | |
| res = api.search(filter) | |
| list = [] | |
| outfile = open('camlog_new.html','w') | |
| outfile_l = open('camlog_new_links'+str(time.mktime(datetime.datetime.now().timetuple()))+'.html','w') | |
| try: | |
| for host in res['matches']: | |
| list.append(host['ip']) | |
| print 'Adding number %s to check %s' % (len(list), host['ip']) | |
| except Exception, e: | |
| print e | |
| def checkCam(ip): | |
| try: | |
| print 'Checking %s...' % ip | |
| sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
| sock.settimeout(5) | |
| sock.connect((ip,80)) | |
| sock.send('GET /anony/mjpg.cgi HTTP/1.0\r\n\r\n') | |
| res = sock.recv(100) | |
| if(res.find('200 OK') > 0): | |
| print 'Found http://%s/anony/mjpg.cgi' % ip | |
| f2 = 'http://%s/anony/mjpg.cgi\n' % ip | |
| f = '<img src="http://%s/anony/mjpg.cgi" style="width:600px;">\n' % ip | |
| outfile.write(f) | |
| outfile.write("<br/><a href='http://www.infosniper.net/index.php?ip_address="+ip+"&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7'>Show Location</a><br/>") | |
| outfile.flush() | |
| file.close() | |
| return True | |
| return False | |
| except: | |
| return False | |
| pool = Pool(150) | |
| for ip in list: | |
| pool.spawn(checkCam, '%s' % ip) | |
| pool.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment