Skip to content

Instantly share code, notes, and snippets.

@PaulSec
Created November 6, 2017 15:27
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save PaulSec/7cc3fd51cd956c46bf0d85010b638ed3 to your computer and use it in GitHub Desktop.
Save PaulSec/7cc3fd51cd956c46bf0d85010b638ed3 to your computer and use it in GitHub Desktop.
certstream utility to retrieve paypal and few other fraud keywords
import certstream
keywords = ['paypal', 'paypol']
def extract_domains(domains):
res = []
for domain in domains:
for keyword in keywords:
if keyword in domain:
res.append(domain)
return res
def print_callback(message, context):
domains = message['data']['leaf_cert']['all_domains']
res = extract_domains(domains)
if len(res) > 0:
print(res)
def on_open(instance):
# Instance is the CertStreamClient instance that was opened
print("Connection successfully established!")
def on_error(instance, exception):
# Instance is the CertStreamClient instance that barfed
print("Exception in CertStreamClient! -> {}".format(exception))
certstream.listen_for_events(print_callback, on_open=on_open, on_error=on_error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment