fix: [lib_refine] add dns configuration

This commit is contained in:
Terrtia 2018-11-21 08:49:58 +01:00
parent b31618eb6a
commit cb41c54135
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 15 additions and 1 deletions

View file

@ -206,6 +206,9 @@ dns = 8.8.8.8
[Mail]
dns = 8.8.8.8
[Web]
dns = 149.13.33.69
# Indexer configuration
[Indexer]
type = whoosh

View file

@ -1,6 +1,8 @@
#!/usr/bin/python3
import re
import os
import configparser
import dns.resolver
from pubsublogger import publisher
@ -101,11 +103,20 @@ def checking_MX_record(r_serv, adress_set, addr_dns):
def checking_A_record(r_serv, domains_set):
configfile = os.path.join(os.environ['AIL_BIN'], 'packages/config.cfg')
if not os.path.exists(configfile):
raise Exception('Unable to find the configuration file. \
Did you set environment variables? \
Or activate the virtualenv.')
cfg = configparser.ConfigParser()
cfg.read(configfile)
dns_server = cfg.get("Web", "dns")
score = 0
num = len(domains_set)
WalidA = set([])
resolver = dns.resolver.Resolver()
resolver.nameservers = ['149.13.33.69']
resolver.nameservers = [dns_server]
resolver.timeout = 5
resolver.lifetime = 2