oasis-open / cti-stix-slider

OASIS TC Open Repository: The repository cti-stix-slider supports development of a Python application to convert STIX 2.0 content to STIX 1.x content
https://cti-stix-slider.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
21 stars 15 forks source link

AttributeError: 'Indicator' object has no attribute 'information_source' #35

Closed treyka closed 5 years ago

treyka commented 6 years ago

I'm working with some Abuse.ch OSINT data which is published as valid STIX2. Trying to downgrade it to STIX1 but getting an error I don't grok.

trey@birdland:~/.../osint_feeds/abuse.ch:$ stix2_slider urlhaus.json 
Traceback (most recent call last):
  File "/home/trey/osint_feeds/abuse.ch/venv/bin/stix2_slider", line 11, in <module>
    sys.exit(main())
  File "/home/trey/osint_feeds/abuse.ch/venv/local/lib/python2.7/site-packages/stix2slider/cli.py", line 132, in main
    result = slide_file(slider_args.file_)
  File "/home/trey/osint_feeds/abuse.ch/venv/local/lib/python2.7/site-packages/stix2slider/__init__.py", line 28, in slide_file
    stix_package = convert_bundle(obj)
  File "/home/trey/osint_feeds/abuse.ch/venv/local/lib/python2.7/site-packages/stix2slider/convert_stix.py", line 1078, in convert_bundle
    create_references(o)
  File "/home/trey/osint_feeds/abuse.ch/venv/local/lib/python2.7/site-packages/stix2slider/convert_stix.py", line 875, in create_references
    info_source = get_info_source(ob1x, obj)
  File "/home/trey/osint_feeds/abuse.ch/venv/local/lib/python2.7/site-packages/stix2slider/convert_stix.py", line 847, in get_info_source
    if ob1x.information_source:
AttributeError: 'Indicator' object has no attribute 'information_source'

I've tried both the PyPi 1.0.1 and the master branch off GitHub. Makes no difference.

My STIX2 sample is attached.

rpiazza commented 5 years ago

Hi @treyka, Sorry for this issue getting a little lost. As it turns out Indicators in STIX 1.x don't have information sources. An easy work around is to replace line 847 in convert_stix.py by:

if hasattr(ob1x, "information_source") and ob1x.information_source:

The real fix needs to be more extensive.

clenk commented 5 years ago

Fixed by 8572eab, so I'm closing this, but if you still have issues @treyka please feel free to reopen!

treyka commented 5 years ago

@clenk Thanks, mate! ^_^