# Path: lib/settings.py
# def get_top_domains(dbname):


import time
import threading
import os
import lib.utils as utils
import glob
import requests
import base64
import json
import sys
import hashlib
import GeoIP
from lib.objects import *
from lib.logger import *
from user_agents import parse
from lib.settings import homenet, lock, top_domains
                log.debug('FG-DEBUG: read_bro_file_log - ' + str(e.__doc__) + " - " + str(e) + " - " + str(sys.exc_info()[2].tb_lineno))

            if len(self.recorded) > 100000:
                del self.recorded[:]

            time.sleep(5)

    def find_file(self, fuid):
        files = glob.glob(self.bro_file_path + "*")
        for i in range(3):
            for f in files:
                if fuid in f:
                    return f
            time.sleep(1)

        return False

    @staticmethod
    def is_top_domain(ip):

        f = open('/opt/zeek/logs/current/dns.log', 'r')
        lines = f.readlines()
        f.close()

        for line in lines:
            if ip in line:
                try:
                    fields = json.loads(line)
                    query = fields["query"]
                    sld = utils.get_sld(query)

# Path: lib/settings.py
# def get_top_domains(dbname):


# Path: lib/logparser.py
import time
import threading
import os
import lib.utils as utils
import glob
import requests
import base64
import json
import sys
import hashlib
import GeoIP
from lib.objects import *
from lib.logger import *
from user_agents import parse
from lib.settings import homenet, lock, top_domains

                log.debug('FG-DEBUG: read_bro_file_log - ' + str(e.__doc__) + " - " + str(e) + " - " + str(sys.exc_info()[2].tb_lineno))

            if len(self.recorded) > 100000:
                del self.recorded[:]

            time.sleep(5)

    def find_file(self, fuid):
        files = glob.glob(self.bro_file_path + "*")
        for i in range(3):
            for f in files:
                if fuid in f:
                    return f
            time.sleep(1)

        return False

    @staticmethod
    def is_top_domain(ip):

        f = open('/opt/zeek/logs/current/dns.log', 'r')
        lines = f.readlines()
        f.close()

        for line in lines:
            if ip in line:
                try:
                    fields = json.loads(line)
                    query = fields["query"]
                    sld = utils.get_sld(query)

                    if sld in top_domains: