Ejemplo n.º 1
0
class CertStreamThread(Thread):
    def __init__(self, q, *args, **kwargs):
        self.q = q
        self.c = CertStreamClient(
            self.process, skip_heartbeats=True, on_open=None, on_error=None)

        super().__init__(*args, **kwargs)

    def run(self):
        global THREAD_EVENT 
        while not THREAD_EVENT.is_set():
            cprint("Waiting for Certstream events - this could take a few minutes to queue up...",
               "yellow", attrs=["bold"])
            self.c.run_forever()
            THREAD_EVENT.wait(10)

    def process(self, message, context):
        if message["message_type"] == "heartbeat":
            return

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

            if ARGS.skip_lets_encrypt and "Let's Encrypt" in message["data"]["chain"][0]["subject"]["aggregated"]:
                return

            for domain in set(all_domains):
                # cut the crap
                if not domain.startswith("*.")\
                        and "cloudflaressl" not in domain\
                        and "xn--" not in domain\
                        and domain.count("-") < 4\
                        and domain.count(".") < 4:
                    for permutation in get_permutations(tldextract.extract(domain)):
                        self.q.put(BUCKET_HOST % permutation)
Ejemplo n.º 2
0
class CertStreamThread(Thread):
    def __init__(self, q, *args, **kwargs):
        self.q = q
        self.c = CertStreamClient(self.process,
                                  skip_heartbeats=True,
                                  on_open=None,
                                  on_error=None)

        super().__init__(*args, **kwargs)

    def run(self):
        while True:
            cprint(
                "Waiting for Certstream events - this could take a few minutes to queue up...",
                "yellow",
                attrs=["bold"])
            self.c.run_forever()
            time.sleep(10)

    def process(self, message, context):
        if message["message_type"] == "heartbeat":
            return

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

            if ARGS.skip_lets_encrypt and "Let's Encrypt" in message["data"][
                    "chain"][0]["subject"]["aggregated"]:
                return

            for domain in set(all_domains):
                # All the domains being extracted
                # Just put the domain in the list so we can process it later
                self.q.put(domain)
Ejemplo n.º 3
0
    def __init__(self, q, *args, **kwargs):
        self.q = q
        self.c = CertStreamClient(self.process,
                                  skip_heartbeats=True,
                                  on_open=None,
                                  on_error=None)

        super().__init__(*args, **kwargs)
Ejemplo n.º 4
0
 def process(self):
     c = CertStreamClient(self.callback,
                          skip_heartbeats=True,
                          on_open=None,
                          on_error=None)
     c.run_forever()
Ejemplo n.º 5
0
 def process(self):
     c = CertStreamClient(self.callback, skip_heartbeats=True, on_open=None, on_error=None)
     c.run_forever()