fix: Just in case taxii DOESN'T give us bytes

Fixes #26
pull/38/head
Hannah Ward 2017-11-03 11:47:27 +00:00
parent 3854d829e1
commit 2262d82cc7
No known key found for this signature in database
GPG Key ID: 6F3BAD60DE190290
1 changed files with 5 additions and 1 deletions

View File

@ -55,7 +55,11 @@ def post_stix(manager, content_block, collection_ids, service_id):
# Load the package
log.info("Posting STIX...")
package = pymisp.tools.stix.load_stix(StringIO(content_block.content.decode()))
block = content_block.content
if isinstance(block, bytes):
block = block.decode()
package = pymisp.tools.stix.load_stix(StringIO(block))
log.info("STIX loaded succesfully.")
values = [x.value for x in package.attributes]
log.info("Extracted %s", values)