Added rudimentary duplicate checking

travis
Hannah Ward 2016-11-18 14:42:17 +00:00
parent 5ffd987a93
commit 0647e27385
No known key found for this signature in database
GPG Key ID: 6F3BAD60DE190290
1 changed files with 11 additions and 1 deletions

View File

@ -37,7 +37,17 @@ def post_stix(manager, content_block, collection_ids, service_id):
# Load the package
package = pymisp.tools.stix.load_stix(f.name)
# Check for duplicates
for attrib in package.attributes:
try:
if (0 != len(MISP.search_index(attrib.value)["response"])):
# It's a dupe!
package.attributes.remove(attrib)
except:
# idk, this is just in case pymisp does a weird
pass
# Delete that old temporary file
os.unlink(f.name)