stix2generator.language package

Submodules

stix2generator.language.build_stix module

stix2generator.language.build_stix.main()[source]
stix2generator.language.build_stix.parse_args()[source]

stix2generator.language.builder module

class stix2generator.language.builder.LanguageProcessor(object_generator, stix_version='2.1')[source]

Bases: object

Instances process stix prototyping language, and produce stix objects.

build_graph(graph_spec, return_variable_bindings=False, embed_variable_names=False)[source]

Build STIX objects from the given specification, expressed with the STIX prototyping language.

Parameters
  • graph_spec – The graph specification

  • return_variable_bindings – Whether the caller wants the variable bindings returned

  • embed_variable_names – Whether variable names should be embedded in generated objects bound to a variable, using a custom property

Returns

If return_variable_bindings is False, a list of STIX objects. Otherwise, return a 2-tuple where the first item is the list of generated objects, and the second is a mapping from variable name to list of STIX IDs. This latter value represents the variable bindings.

Raises
  • stix2generator.builder.LanguageError – If there are any errors processing the specification itself

  • stix2generator.make_object.ObjectGenerationError – If there is an error randomly generating a STIX object

  • stix2.exceptions.STIXError – If the objects and/or relationships expressed in the language, aren’t valid STIX

Module contents