Skip to content

Instantly share code, notes, and snippets.

@oskar456
Last active March 28, 2018 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oskar456/1456922325cdee9298c6fcf86d234090 to your computer and use it in GitHub Desktop.
Save oskar456/1456922325cdee9298c6fcf86d234090 to your computer and use it in GitHub Desktop.
Show Certificate Transparency Log IDs compatible with OpenSSL output
#!/usr/bin/env python3
import requests
import hashlib
import base64
log_list = "https://www.gstatic.com/ct/log_list/all_logs_list.json"
logs = requests.get(log_list).json()
for log in logs['logs']:
logid = hashlib.sha256(base64.b64decode(log['key'])).hexdigest().upper()
logid = "".join([f"{c}:\n\t" if n == 31 else
f"{c}:" if n % 2 == 1 else
c for n, c in enumerate(logid)])
print(f"""
Description: {log['description']}
URL: {log['url']}
Log ID:\t{logid}""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment