oasis-open / cti-stix-elevator

OASIS Cyber Threat Intelligence (CTI) TC Open Repository: Convert STIX 1.2 XML to STIX 2.x JSON
https://stix2-elevator.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
49 stars 23 forks source link

An error when lifting snort-test-mechanism.xml #234

Closed li-xin-yi closed 4 years ago

li-xin-yi commented 4 years ago

I downloaded snort-test-mechanism.xml and try to convert it to .json:

from stix2elevator import elevate_file
from stix2elevator.options import initialize_options

initialize_options()
results = elevate_file('./snort-test-mechanism.xml')

It failed as:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-15-eb3af1d6ac01> in <module>
----> 1 results = elevate_file('./snort-test-mechanism.xml')

~/anaconda3/envs/verdict/lib/python3.7/site-packages/stix2elevator/__init__.py in elevate_file(fn)
     83         env = Environment(get_option_value("package_created_by_id"),
     84                           timestamp)
---> 85         json_string = json.dumps(convert_package(stix_package, env),
     86                                  ensure_ascii=False,
     87                                  indent=4,

~/anaconda3/envs/verdict/lib/python3.7/site-packages/stix2elevator/convert_stix.py in convert_package(stix_package, env)
   2021     # ttps
   2022     if stix_package.ttps:
-> 2023         for ttp in stix_package.ttps:
   2024             convert_ttp(ttp, env)
   2025 

TypeError: 'TTPs' object is not iterable

I am using Python 3.7.7 and

$ pip list | grep stix2
stix2                             1.4.0              
stix2-elevator                    2.1.1              
stix2-patterns                    1.3.0              
stix2-validator                   2.0.1
rpiazza commented 4 years ago

Hi @li-xin-yi

This is a known issue and has been fixed. A new release of the elevator is imminent, but you can always download the master branch in the meantime.