new: Add dupe checking

pull/14/head
Hannah Ward 2017-06-14 13:52:29 +01:00
parent 783a1e9936
commit cef25438ea
No known key found for this signature in database
GPG Key ID: 6F3BAD60DE190290
1 changed files with 9 additions and 0 deletions

View File

@ -52,6 +52,15 @@ def post_stix(manager, content_block, collection_ids, service_id):
# Load the package
package = pymisp.tools.stix.load_stix(content_block.content)
values = [x.value for x in package.attributes]
for attrib in values:
print("CHECKING {}".format(attrib))
search = MISP.search("attributes", values=attrib)
if search["response"] != []:
# This means we have it!
print("REMOVING...")
package.attributes.pop([x.value for x in package.attributes].index(attrib))
# Push the event to MISP
# TODO: There's probably a proper method to do this rather than json_full
# But I don't wanna read docs