Advertisement
thefinn93

Untitled

Oct 3rd, 2011
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #! /usr/bin/env python
  2. import json
  3. import urllib2
  4. import socket
  5.  
  6. tkn = "API Token"   # Get it from https://www.cloudflare.com/my-account.html
  7. u = "Email"     # Fill in the email you use to sign in to cloudlfare
  8. z="Zone/domain"     # Fill in the domain you want to use
  9.  
  10. baseurl = "https://www.cloudflare.com/api_json.html?u=" + u + "&tkn=" + tkn + "&z=" + z
  11.  
  12. response = json.load(urllib2.urlopen(baseurl + "&a=zone_ips&hours=48"))
  13.  
  14. hits = response['response']['ips']
  15.  
  16. for hit in hits:
  17.     host = hit['ip']
  18.     try:
  19.         host = socket.gethostbyaddr(hit['ip'])[0]
  20.         if host == ".":
  21.             host = hit['ip']
  22.     except:
  23.         continue
  24.     print host + " - " + str(hit['hits']
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement