stixex v0.1.3 StixEx.Bundle View Source

A Bundle is a collection of arbitrary STIX Objects and Marking Definitions grouped together in a single container. A Bundle does not have any semantic meaning and Objects are not considered related by virtue of being in the same Bundle.

Link to this section Summary

Functions

Add an object to a stix bundle

Add multiple objects to a bundle

Load a stix bundle from string

Create a new bundle

Create a new bundle with specified parameters

Dump a STIX bundle to a specified format

Link to this section Functions

Link to this function

add_object(bundle, object) View Source

Add an object to a stix bundle

iex> {:ok, my_object} = StixEx.Object.Observable.IPv4Addr.new(%{value: "8.8.8.8"})
iex> {:ok, my_bundle} = StixEx.Bundle.new()
iex> StixEx.Bundle.add_object(my_bundle, my_object)
Link to this function

add_objects(bundle, list) View Source

Add multiple objects to a bundle

Link to this function

changeset(struct, params) View Source

Link to this function

from_file(filename, opts \\ [format: :autodetect]) View Source

Load a stix bundle from file

iex> StixEx.from_file("my_bundle.json")
{:ok, %StixEx.Bundle{
  # stuff here
}}

options:

  • :format - currently supported :json, :autodetect
Link to this function

from_string(data, opts \\ [format: :json]) View Source

Load a stix bundle from string

iex> StixEx.from_string("{...}")
{:ok, %StixEx.Bundle{}}

iex> StixEx.from_string("{...}", format: :json)
{:ok, %StixEx.Bundle{}}

currently supported formats: :json

Create a new bundle

iex> StixEx.Bundle.new()
{:ok, %StixEx.Bundle{}}

Create a new bundle with specified parameters

iex> StixEx.Bundle.new(%{objects: []})
{:ok, %StixEx.Bundle{}}
Link to this function

to_file(bundle, filename, opts \\ [serialiser: StixEx.Serialiser.JSON]) View Source

Dump a STIX bundle to disk

iex> StixEx.Bundle.to_file(%StixEx.Bundle{}, "my_bundle.json")
:ok
Link to this function

to_string(bundle, opts \\ [serialiser: StixEx.Serialiser.JSON]) View Source

Dump a STIX bundle to a specified format

iex> StixEx.Bundle.to_string(%StixEx.Bundle{})
{:ok, "{some_json}"}

Opts:

  • :serialiser Any module implemeting StixEx.Serialiser behaviour. Defaults to StixEx.Serialiser.JSON.