new: Allow to disable DNS lookups

Fix #26
pull/31/head
Raphaël Vinot 2018-08-02 11:55:37 +02:00
parent c823e5496c
commit cbf0c07b67
1 changed files with 14 additions and 9 deletions

View File

@ -14,7 +14,11 @@ from pyfaup.faup import Faup
from pymisp import PyMISP, MISPEvent, MISPObject, MISPSighting
from pymisp.tools import EMailObject, make_binary_objects
from defang import refang
import dns.resolver
try:
import dns.resolver
HAS_DNS = True
except ImportError:
HAS_DNS = False
def is_ip(address):
@ -299,6 +303,7 @@ class Mail2MISP():
email_object.add_reference(attribute.uuid, 'contains')
else:
related_ips = []
if HAS_DNS and self.config.enable_dns:
try:
syslog.syslog(hostname)
for rdata in dns.resolver.query(hostname, 'A'):