# 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
                f.seek(self.last_pos)
            lines = f.readlines()
            if len(lines) > 0:
                self.new_lines = lines
                self.last_pos = f.tell()
                self.last_file_size = os.path.getsize(self.bro_dns_log_path)
                f.close()
                return True
            else:
                f.close()
                return False
        except Exception as e:
            log.debug('FG-DEBUG: read_bro_dns_log - ' + str(e.__doc__) + " - " + str(e))
            return False


class ReadDHCPLeases(threading.Thread):
    def __init__(self, threadID):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.ctime = None

    def run(self):

        while 1:
            self.ctime = int(time.time())
            try:
                f = open('/var/log/dnsmasq.leases', 'r')
                lines = f.readlines()
                if len(lines) > 0:

# 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

                f.seek(self.last_pos)
            lines = f.readlines()
            if len(lines) > 0:
                self.new_lines = lines
                self.last_pos = f.tell()
                self.last_file_size = os.path.getsize(self.bro_dns_log_path)
                f.close()
                return True
            else:
                f.close()
                return False
        except Exception as e:
            log.debug('FG-DEBUG: read_bro_dns_log - ' + str(e.__doc__) + " - " + str(e))
            return False


class ReadDHCPLeases(threading.Thread):
    def __init__(self, threadID):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self.ctime = None

    def run(self):

        while 1:
            self.ctime = int(time.time())
            try:
                f = open('/var/log/dnsmasq.leases', 'r')
                lines = f.readlines()
                if len(lines) > 0:

                    with lock: