Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import tldextract
import dnslib
import base64
import ConfigParser as CFG
import redis
import numpy as np
import zmq
import pika
import datetime
import math
import string
import json
from dgascore import DGAScore
tldextract.PUBLIC_SUFFIX_LIST_URLS=["file:///data/effective_tld_names01.dat", "file:///data/effective_tld_names02.dat"]
dgascore = DGAScore()
def get_date():
d = datetime.datetime.now()
return "%s-%s-%s" % (d.day, d.month, d.year)
def cluster_id(domain_label):
dom = tldextract.extract(domain_label)
line = "%s.%s." % (dom.domain, dom.suffix)
domain = dom.domain.encode('utf-8')
zone = "nozone"
if len(dom.suffix) > 1:
zone = dom.suffix.encode('utf-8')
try:
zone = domain[domain.rindex('.')+1:]