Git Product home page Git Product logo

openioc-to-stix's Introduction

openioc-to-stix

Generates STIX Indicator Output from an OpenIOC v1.0 XML File.

Source

https://github.com/STIXProject/openioc-to-stix

Download

https://pypi.org/project/openioc-to-stix/

Build Status Code Health Version Badge

Overview

The openioc-to-stix script generates STIX Indicators from an OpenIOC v1.0 XML file.

  • Compatible with OpenIOC v1.0
  • Generates STIX v1.2 and CybOX v2.1 content.

Please refer to the following websites for more information about the Structured Threat Information Expression (STIX), Cyber Observable eXpression (CybOX), and OpenIOC efforts.

Requirements

  • Python 2.6, 2.7, 3.4, 3.5, 3.6
  • mixbox >= v1.0.1
  • python-stix >= v1.2.0.2
  • python-cybox >= 2.1.0.13

NOTE Version 1.0.1 of openioc-to-stix requires python-stix < 1.2.0.0, python-cybox 2.1.0.12, and does not require mixbox.

Installation

Extract included files into your directory of choice. Please refer to the requirements.txt file for dependencies.

Install dependencies with pip:

$ pip install -r requirements.txt

You can also install openioc-to-stix into your site-packages and PATH by using `pip`:

$ cd /path/to/cloned/openioc-to-stix/repo/
$ pip install .

Usage

There are two main command line parameters for this script:

-i: the path to the input OpenIOC XML file
-o: the path to the output STIX XML file

To use the script, run the following command:

$ python openioc-to-stix.py -i <OpenIOC XML file> -o <STIX XML file>

Unsupported indicator items or those that error out during translation will be translated into an empty Observable with a description of the error in order to retain structural consistency between the input OpenIOC document and output STIX document.

Package Contents

  • README: This file.
  • openioc-to-stix.py: OpenIOC XML to STIX XML Python script.
  • openioc-to-cybox.py: OpenIOC XML to CybOX XML Python converter script which this script wraps.
  • openioc2stix/: Top-level API package.
  • LICENSE.txt: Terms of use for this script.
  • examples/*.xml: Sample input and output XML files.

TERMS

BY USING OPENIOC-TO-STIX YOU SIGNIFY YOUR ACCEPTANCE OF THE TERMS AND CONDITIONS OF USE. IF YOU DO NOT AGREE TO THESE TERMS, DO NOT USE OPENIOC-TO-STIX.

For more information, please refer to the LICENSE.txt file

openioc-to-stix's People

Contributors

bojak4616 avatar clenk avatar emmanvg avatar gtback avatar ikiril01 avatar rroberge avatar treyka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openioc-to-stix's Issues

NameSpace Issue

Hello,

The script as is does not work (both openioc-to-stix and openioc-to-cybox), they return the following error:
Traceback (most recent call last):
File "openioc-to-stix.py", line 106, in
main()
File "openioc-to-stix.py", line 85, in main
stix.utils.set_id_namespace(ns)
AttributeError: 'module' object has no attribute 'set_id_namespace'

If you fix the namespace error, you then get the following error:

TypeError: Indicators must be a <class 'stix.core.Indicators'>, not a <type 'list'>

Parser does not handle DNS items correctly

While attempting to parse https://raw.githubusercontent.com/fireeye/iocs/master/FIN4/fb0699e2-23a6-40f9-bf96-4514d629eec3.ioc

I receive a traceback stack of

Traceback (most recent call last):
  File "openioc_to_stix.py", line 55, in main
    observables_cls = Observables.from_obj(observables_obj)
  File "/usr/local/lib/python2.7/dist-packages/cybox/core/observable.py", line 326, in from_obj
    obs.add(Observable.from_obj(o))
  File "/usr/local/lib/python2.7/dist-packages/cybox/core/observable.py", line 214, in from_obj
    obs.observable_composition = ObservableComposition.from_obj(observable_obj.Observable_Composition)
  File "/usr/local/lib/python2.7/dist-packages/cybox/core/observable.py", line 411, in from_obj
    obs_comp.add(Observable.from_obj(o))
  File "/usr/local/lib/python2.7/dist-packages/cybox/core/observable.py", line 212, in from_obj
    obs.object_ = Object.from_obj(observable_obj.Object)
  File "/usr/local/lib/python2.7/dist-packages/cybox/core/object.py", line 130, in from_obj
    obj.properties = ObjectProperties.from_obj(object_obj.Properties)
  File "/usr/local/lib/python2.7/dist-packages/cybox/common/object_properties.py", line 158, in from_obj
    defobj = klass.from_obj(defobj_obj)
  File "/usr/local/lib/python2.7/dist-packages/cybox/common/object_properties.py", line 145, in from_obj
    return super(ObjectProperties, cls()).from_obj(defobj_obj)
  File "/usr/local/lib/python2.7/dist-packages/cybox/__init__.py", line 189, in from_obj
    val = getattr(cls_obj, field.name)
AttributeError: 'DNSRecordObjectType' object has no attribute 'DNS_Cache_Entry'

regards
Alec

Update to use python-cybox APIs

Currently the OpenIOC -> CybOX translation code uses the python-cybox bindings rather than its APIs. We should update this to natively use the APIs, which should also fix some issues with IDs not being automatically generated, etc.

Fix Range Handling in IndicatorItems

OpenIOC to STIX/OpenIOC to CybOX doesn't seem to translation of range-based indicators properly, like in the following example:

          <IndicatorItem id="4a52cb2b-9c78-4ac0-8b97-cc054a54a3f0" condition="is">
            <Context document="FileItem" search="FileItem/SizeInBytes" type="mir" />
            <Content type="int">145900 TO 146000</Content>
          </IndicatorItem>

We should look into this and fix it.

[From STIXProject/Tools#21]

Email Attachment type throws an exception

Related to line 247 in objectify.py,
email.add_related(attachment) should include the relationship type. Worked around this by changing that like to email.add_related(attachment, "Related_To")

Add support for OpenIOC v1.1

Currently, this utility only handles OpenIOC v1.0 documents. We should add support for the newer version, OpenIOC v1.1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.