Last active
March 28, 2018 20:34
-
-
Save oskar456/1456922325cdee9298c6fcf86d234090 to your computer and use it in GitHub Desktop.
Show Certificate Transparency Log IDs compatible with OpenSSL output
This file contains 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/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