zmnkh

shodan web api

Jun 25th, 2018
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import thread
  2. import requests
  3. from shodan import WebAPI
  4.  
  5. SHODAN_API_KEY = "YTpJupxORiRWAWTNKYJ6H7IOeaxGAcRG"
  6.  
  7. api = WebAPI(SHODAN_API_KEY)
  8.  
  9. def scan(ip):
  10. if ip:
  11. print ip + " \n"
  12.  
  13. try:
  14. # Search Shodan
  15. results = api.search('linksys')
  16.  
  17. # Show the results
  18. print 'Results found: %s' % results['total']
  19. for result in results['matches']:
  20. # print 'Scanning IP: %s' % result['ip']
  21. thread.start_new_thread( scan, (result['ip'], ) )
  22.  
  23. except Exception, e:
  24. print 'Error: %s' % e
  25. while 1:
  26. pass
Add Comment
Please, Sign In to add comment