certstream-python icon indicating copy to clipboard operation
certstream-python copied to clipboard

Example script prints duplicate domains

Open cr4zyfish opened this issue 3 years ago • 1 comments

when I run the example script, some domains are printed more that one time. some domains are printed again after a few minutes. what is the reason and how to prevent this?

import logging
import sys
import datetime
import certstream

def print_callback(message, context):
    logging.debug("Message -> {}".format(message))

    if message['message_type'] == "heartbeat":
        return

    if message['message_type'] == "certificate_update":
        all_domains = message['data']['leaf_cert']['all_domains']

        if len(all_domains) == 0:
            domain = "NULL"
        else:
            domain = all_domains[0]

        sys.stdout.write(u"[{}] {} (SAN: {})\n".format(datetime.datetime.now().strftime('%m/%d/%y %H:%M:%S'), domain, ", ".join(message['data']['leaf_cert']['all_domains'][1:])))
        sys.stdout.flush()

logging.basicConfig(format='[%(levelname)s:%(name)s] %(asctime)s - %(message)s', level=logging.INFO)

certstream.listen_for_events(print_callback, url='wss://certstream.calidog.io/')

cr4zyfish avatar Sep 15 '21 21:09 cr4zyfish

Most certificates are submitted to at least 2 different CT logs.

mimi89999 avatar Sep 29 '21 18:09 mimi89999