fix: Avoid failure if dns key is not in the config file.

pull/31/head
Raphaël Vinot 2018-08-02 12:02:18 +02:00
parent cbf0c07b67
commit 02b1c8ed96
2 changed files with 3 additions and 0 deletions

View File

@ -36,6 +36,8 @@ class Mail2MISP():
if not self.offline:
self.misp = PyMISP(misp_url, misp_key, verifycert, debug=config.debug)
self.config = config
if not hasattr(self.config, 'enable_dns'):
setattr(self.config, 'enable_dns', True)
self.debug = self.config.debug
self.config_from_email_body = {}
# Init Faup

View File

@ -60,6 +60,7 @@ class TestMailToMISP(unittest.TestCase):
self.mail2misp.process_email_body()
self.mail2misp.process_body_iocs()
self.assertTrue('attachment' in [a.type for a in self.mail2misp.misp_event.attributes])
self.assertTrue(self.mail2misp.misp_event.publish)
if __name__ == '__main__':
unittest.main()