fix: Make it work with array vals

pull/14/head
Hannah Ward 2017-06-16 12:28:10 +01:00
parent d68d0bab35
commit 61db1d2224
No known key found for this signature in database
GPG Key ID: 6F3BAD60DE190290
1 changed files with 2 additions and 1 deletions

View File

@ -55,7 +55,7 @@ def post_stix(manager, content_block, collection_ids, service_id):
values = [x.value for x in package.attributes] values = [x.value for x in package.attributes]
for attrib in values: for attrib in values:
print("CHECKING {}".format(attrib)) print("CHECKING {}".format(attrib))
search = MISP.search("attributes", values=attrib) search = MISP.search("attributes", values=str(attrib))
if search["response"] != []: if search["response"] != []:
# This means we have it! # This means we have it!
package.attributes.pop([x.value for x in package.attributes].index(attrib)) package.attributes.pop([x.value for x in package.attributes].index(attrib))
@ -64,6 +64,7 @@ def post_stix(manager, content_block, collection_ids, service_id):
# TODO: There's probably a proper method to do this rather than json_full # TODO: There's probably a proper method to do this rather than json_full
# But I don't wanna read docs # But I don't wanna read docs
if (len(package.attributes) > 0): if (len(package.attributes) > 0):
print(package.attributes[0].value)
MISP.add_event(package._json_full()) MISP.add_event(package._json_full())
# Make TAXII call our push function whenever it gets new data # Make TAXII call our push function whenever it gets new data