Created
May 8, 2016 20:37
-
-
Save dadrian/7995e0faa23e89d5ccba85f90afcb2d8 to your computer and use it in GitHub Desktop.
Download all trusted NSS intermediates from Censys as PEM's (ignores roots)
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
from censys.certificates import CensysCertificates | |
import base64 | |
query = "current_valid_nss: true AND parsed.extensions.basic_constraints.is_ca: true AND NOT current_in_nss: true" | |
fields = ["raw"] | |
def split(input, size): | |
for start in range(0, len(input), size): | |
yield input[start:start+size] | |
for idx, cert in enumerate(CensysCertificates().search(query, fields)): | |
try: | |
encoded = cert.get("raw")[0] | |
total = len(encoded) | |
print '-----BEGIN CERTIFICATE-----' | |
for line in split(encoded, 64): | |
print line | |
print '-----END CERTIFICATE-----' | |
except Exception as e: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment