Skip to content

Instantly share code, notes, and snippets.

@Fitblip
Last active June 9, 2017 03:02
Show Gist options
  • Save Fitblip/048033a0c594c634c0153ce7df470655 to your computer and use it in GitHub Desktop.
Save Fitblip/048033a0c594c634c0153ce7df470655 to your computer and use it in GitHub Desktop.
import requests
import json
import locale
locale.setlocale(locale.LC_ALL, 'en_US')
ctl_log = requests.get('https://www.gstatic.com/ct/log_list/log_list.json').json()
total_certs = 0
human_format = lambda x: locale.format('%d', x, grouping=True)
for log in ctl_log['logs']:
log_url = log['url']
try:
log_info = requests.get('https://{}/ct/v1/get-sth'.format(log_url), timeout=3).json()
total_certs += int(log_info['tree_size'])
except:
continue
print("{} has {} certificates".format(log_url, human_format(log_info['tree_size'])))
print("Total certs -> {}".format(human_format(total_certs)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment