From 10f706cfcbfb4e69c24ae802fc7d61e3c9f20f60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Fri, 22 Dec 2017 15:35:36 +0100 Subject: [PATCH] chg: Type in the warning list is now enforced --- pymispwarninglists/api.py | 10 ++++------ pymispwarninglists/data/misp-warninglists | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pymispwarninglists/api.py b/pymispwarninglists/api.py index a2e3e1c..6ecbd00 100644 --- a/pymispwarninglists/api.py +++ b/pymispwarninglists/api.py @@ -38,8 +38,7 @@ class WarningList(): self.description = self.warninglist['description'] self.version = int(self.warninglist['version']) self.name = self.warninglist['name'] - if self.warninglist.get('type'): - self.type = self.warninglist['type'] + self.type = self.warninglist['type'] if self.warninglist.get('matching_attributes'): self.matching_attributes = self.warninglist['matching_attributes'] @@ -59,9 +58,8 @@ class WarningList(): def to_dict(self): to_return = {'list': [str(e) for e in self.list], 'name': self.name, - 'description': self.description, 'version': self.version} - if hasattr(self, 'type'): - to_return['type'] = self.type + 'description': self.description, 'version': self.version, + 'type': self.type} if hasattr(self, 'matching_attributes'): to_return['matching_attributes'] = self.matching_attributes return to_return @@ -126,7 +124,7 @@ class WarningLists(collections.Mapping): matches = [] for name, wl in self.warninglists.items(): if value in wl: - matches.append(wl) + matches.append(wl) return matches def __len__(self): diff --git a/pymispwarninglists/data/misp-warninglists b/pymispwarninglists/data/misp-warninglists index 0f23d9c..260da4a 160000 --- a/pymispwarninglists/data/misp-warninglists +++ b/pymispwarninglists/data/misp-warninglists @@ -1 +1 @@ -Subproject commit 0f23d9cb18485d190cd495ee02d9bfe872674561 +Subproject commit 260da4af14b434b4eb5b697c9e3b9860878e6550