From 5bff6651674a661e09ef3542100b59e69f912906 Mon Sep 17 00:00:00 2001 From: Ilya Glotov Date: Tue, 9 Jul 2019 00:27:38 +0300 Subject: [PATCH 1/2] Fix slow search assignment --- pymispwarninglists/api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pymispwarninglists/api.py b/pymispwarninglists/api.py index 47b45e5..632215f 100644 --- a/pymispwarninglists/api.py +++ b/pymispwarninglists/api.py @@ -51,9 +51,9 @@ class WarningList(): if self.slow_search and self.type == 'cidr': self._network_objects = self._network_index() - # If network objects is empty, reverting to default anyway - if not self._network_objects: - self.slow_search = False + # If network objects is empty, reverting to default anyway + if not self._network_objects: + self.slow_search = False def __repr__(self): return '<{self.__class__.__name__}(type="{self.name}", version="{self.version}", description="{self.description}")'.format(self=self) From f730ea0db7bf3987efb08f23a13b43a78d2acce3 Mon Sep 17 00:00:00 2001 From: Ilya Glotov Date: Tue, 9 Jul 2019 01:13:39 +0300 Subject: [PATCH 2/2] Add test for a subdomain slow search --- tests/tests.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/tests.py b/tests/tests.py index 23122c6..a8e727c 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -44,3 +44,5 @@ class TestPyMISPWarningLists(unittest.TestCase): self.assertEqual(results[0].name, 'List of RFC 3849 CIDR blocks') results = self.warninglists.search('1e100.net') self.assertEqual(results[0].name, 'List of known google domains') + results = self.warninglists.search('something.files.1drv.com') + self.assertEqual(results[0].name, 'List of known microsoft domains')