Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
The python-maec library provides an API for developing and consuming Malware Attribute Enumeration and Characterization (MAEC) content. Developers can leverage the API to create applications that create, consume, translate, or otherwise work with MAEC content.
Each version of python-maec is designed to work with a single version of the MAEC Language. The table below shows the latest version the library for each version of MAEC.
MAEC Version | python-maec Version |
---|---|
4.1 | 4.1.0.9 (PyPI) (GitHub) |
4.0 | 4.0.1.0 (PyPI) (GitHub) |
3.0 | 3.0.0b1 (PyPI) (GitHub) |
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Note
The python-maec library is intended for developers who want to add MAEC support to existing programs or create new programs that handle MAEC content. Experience with Python development is assumed.
Other users should look at existing tools that support MAEC.
Understanding XML, XML Schema, and the MAEC language is also incredibly helpful when using python-maec in an application.
First, you should follow the Installation procedures.
Once you have installed python-maec, you can begin writing Python applications that consume or create STIX content!
Note
The python-maec library provides bindings and APIs, both of which can be used to parse and write MAEC XML files. For in-depth description of the APIs, bindings, and the differences between the two, please refer to APIs or bindings?
from maec.package.package import Package # Import the MAEC Package API
from maec.package.malware_subject import MalwareSubject # Import the MAEC Malware Subject API
package = STIXPackage() # Create an instance of Package
malware_subject = MalwareSubject() # Create an instance of MalwareSubject
package.add_malware_subject(malware_subject) # Add the Malware Subject to the Package
print(stix_package.to_xml()) # Print the XML for this MAEC Package
import maec # Import the python-maec API
fn = 'stix_content.xml' # The MAEC content filename
maec_objects = maec.parse_xml_instance(fn) # Parse using the from_xml() method
api_object = maec_objects['api'] # Get the API object from the parsed objects
The python-maec repository contains several example scripts that help illustrate the capabilities of the APIs. These scripts are simple command line utilities that can be executed by passing the name of the script to a Python interpreter.
$ python package_generation_example.py
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
The installation of python-maec can be accomplished through a few different workflows.
$ pip install maec
You might also want to consider using a virtualenv. Please refer to the pip installation instructions for details regarding the installation of pip.
The python-maec library relies on some non-standard Python libraries for the processing of MAEC content. Revisions of python-maec may depend on particular versions of dependencies to function correctly. These versions are detailed within the distutils setup.py installation script.
The following libraries are required to use python-maec:
Each of these can be installed with pip or by manually downloading packages from PyPI. On Windows, you will probably have the most luck using pre-compiled binaries for lxml. On Ubuntu (12.04 or 14.04), you should make sure the following packages are installed before attempting to compile lxml from source:
Warning
Users have encountered errors with versions of libxml2 (a dependency of lxml) prior to version 2.9.1. The default version of libxml2 provided on Ubuntu 12.04 is currently 2.7.8. Users are encouraged to upgrade libxml2 manually if they have any issues. Ubuntu 14.04 provides libxml2 version 2.9.1.
If you are unable to use pip, you can also install python-maec with setuptools. If you don’t already have setuptools installed, please install it before continuing.
$ tar -zxf MAEC-4.1.0.9.tar.gz $ ls MAEC-4.1.0.9 MAEC-4.1.0.9.tar.gz
OR
$ unzip MAEC-4.1.0.9.zip $ ls MAEC-4.1.0.9 MAEC-4.1.0.9.zip
$ cd MAEC-4.1.0.9 $ python setup.py install
$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import MAEC
>>>
If you don’t see an ImportError, the installation was successful.
If you’re new to installing Python packages, you can learn more at the Python Packaging User Guide, specifically the Installing Python Packages section.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
This page provides a quick overview needed to understand the inner workings of the python-maec library. If you prefer a more hands-on approach, browse the Examples.
Each type within MAEC is represented by a class which derives from maec.Entity. In general, there is one Python class per MAEC type, though in some cases classes which would have identical functionality have been reused rather than writing duplicating classes. One example of this is that many enumerated values are implemented using the cybox.common.properties.String, since values aren’t checked to make sure they are valid enumeration values.
Note
Not all MAEC types have yet been implemented.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
This page includes some basic examples of creating and parsing MAEC content.
There are a couple things we do in these examples for purposes of demonstration that shouldn’t be done in production code:
The most commonly used MAEC output format is the MAEC Package, which can contain one or more Malware Subjects. Malware Subjects (discussed in more detail below) encompass all of the data for a single malware instance, including that from different types of analysis.
from maec.package.package import Package
from maec.package.malware_subject import MalwareSubject
from maec.utils import IDGenerator, set_id_method
set_id_method(IDGenerator.METHOD_INT)
p = Package()
ms = MalwareSubject()
p.add_malware_subject(ms)
print p.to_xml(include_namespaces=False)
Which outputs:
<maecPackage:MAEC_Package id="example:package-1" schema_version="2.1">
<maecPackage:Malware_Subjects>
<maecPackage:Malware_Subject id="example:malware_subject-2">
</maecPackage:Malware_Subject>
</maecPackage:Malware_Subjects>
</maecPackage:MAEC_Package>
The easiest way to create a Malware Subject is to construct one and then set various properties on it. The Malware_Instance_Object_Attributes field on a Malware Subject MUST be set in order to identify the particular malware instance that it is characterizing.
from maec.package.malware_subject import MalwareSubject
from maec.utils import IDGenerator, set_id_method
from cybox.core import Object
from cybox.objects.file_object import File
set_id_method(IDGenerator.METHOD_INT)
ms = MalwareSubject()
ms.malware_instance_object_attributes = Object()
ms.malware_instance_object_attributes.properties = File()
ms.malware_instance_object_attributes.properties.file_name = "malware.exe"
ms.malware_instance_object_attributes.properties.file_path = "C:\Windows\Temp\malware.exe"
print ms.to_xml(include_namespaces=False)
Which outputs:
<maecPackage:MalwareSubjectType id="example:malware_subject-1">
<maecPackage:Malware_Instance_Object_Attributes id="example:Object-1">
<cybox:Properties xsi:type="FileObj:FileObjectType">
<FileObj:File_Name>malware.exe</FileObj:File_Name>
<FileObj:File_Path>C:\Windows\Temp\malware.exe</FileObj:File_Path>
</cybox:Properties>
</maecPackage:Malware_Instance_Object_Attributes>
</maecPackage:MalwareSubjectType>
In MAEC, the Bundle represents a container for capturing the results from a particular malware analysis that was performed on a malware instance. While a Bundle is most commonly included as part of a Malware Subject, it can also be used a standalone output format when only malware analysis results for a malware instance wish to be shared. We’ll cover both cases here.
Standalone Bundles function very similarly to Malware Subjects. Therefore, the easiest way to create a standalone Bundle is to construct one and then set various properties on it. The Malware_Instance_Object_Attributes field on a standalone Bundle MUST be set in order to identify the particular malware instance that it is characterizing.
from maec.bundle.bundle import Bundle
from maec.utils import IDGenerator, set_id_method
from cybox.core import Object
from cybox.objects.file_object import File
set_id_method(IDGenerator.METHOD_INT)
b = Bundle()
b.malware_instance_object_attributes = Object()
b.malware_instance_object_attributes.properties = File()
b.malware_instance_object_attributes.properties.file_name = "malware.exe"
b.malware_instance_object_attributes.properties.file_path = "C:\Windows\Temp\malware.exe"
print b.to_xml(include_namespaces=False)
Which outputs:
<maecBundle:MAEC_Bundle defined_subject="false" id="example:bundle-1" schema_version="4.1">
<maecBundle:Malware_Instance_Object_Attributes id="example:Object-1">
<cybox:Properties xsi:type="FileObj:FileObjectType">
<FileObj:File_Name>malware.exe</FileObj:File_Name>
<FileObj:File_Path>C:\Windows\Temp\malware.exe</FileObj:File_Path>
</cybox:Properties>
</maecBundle:Malware_Instance_Object_Attributes>
</maecBundle:MAEC_Bundle>
Bundles in a Malware Subject are defined nearly identically to those of the standalone variety, with the sole exception that they do not require their Malware_Instance_Object_Attributes field to be set, since this would already be defined in their parent Malware Subject.
set_id_method(IDGenerator.METHOD_INT)
ms = MalwareSubject()
ms.malware_instance_object_attributes = Object()
ms.malware_instance_object_attributes.properties = File()
ms.malware_instance_object_attributes.properties.file_name = "malware.exe"
ms.malware_instance_object_attributes.properties.file_path = "C:\Windows\Temp\malware.exe"
b = Bundle()
ms.add_findings_bundle(b)
print ms.to_xml(include_namespaces=False)
Which outputs:
<maecPackage:MalwareSubjectType id="example:malware_subject-1">
<maecPackage:Malware_Instance_Object_Attributes id="example:Object-1">
<cybox:Properties xsi:type="FileObj:FileObjectType">
<FileObj:File_Name>malware.exe</FileObj:File_Name>
<FileObj:File_Path>C:\Windows\Temp\malware.exe</FileObj:File_Path>
</cybox:Properties>
</maecPackage:Malware_Instance_Object_Attributes>
</maecPackage:MalwareSubjectType>
MAEC uses its MalwareAction to capture the low-level dynamic entities, such as API calls or their abstractions, performed by malware. A MalwareAction is stored in a Bundle (either standalone or embedded in a Malware Subject, as discussed above). As with the other MAEC entities, the easiest way to use the MalwareAction is to instantiate it and then set various properties on it as needed.
set_id_method(IDGenerator.METHOD_INT)
b = Bundle()
a = MalwareAction()
ao = AssociatedObject()
ao.properties = File()
ao.properties.file_name = "badware.exe"
ao.properties.size_in_bytes = "123456"
ao.association_type = AssociationType()
ao.association_type.value = 'output'
ao.association_type.xsi_type = 'maecVocabs:ActionObjectAssociationTypeVocab-1.0'
a.name = 'create file'
a.name.xsi_type = 'maecVocabs:FileActionNameVocab-1.0'
a.associated_objects = AssociatedObjects()
a.associated_objects.append(ao)
b.add_action(a)
print b.to_xml(include_namespaces = False)
<maecBundle:MAEC_Bundle defined_subject="false" id="example:bundle-1" schema_version="4.1">
<maecBundle:Actions>
<maecBundle:Action id="example:action-2">
<cybox:Name xsi:type="maecVocabs:FileActionNameVocab-1.0">create file</cybox:Name>
<cybox:Associated_Objects>
<cybox:Associated_Object id="example:Object-1">
<cybox:Properties xsi:type="FileObj:FileObjectType">
<FileObj:File_Name>badware.exe</FileObj:File_Name>
<FileObj:Size_In_Bytes>123456</FileObj:Size_In_Bytes>
</cybox:Properties>
<cybox:Association_Type xsi:type="maecVocabs:ActionObjectAssociationTypeVocab-1.0">output</cybox:Association_Type>
</cybox:Associated_Object>
</cybox:Associated_Objects>
</maecBundle:Action>
</maecBundle:Actions>
</maecBundle:MAEC_Bundle>
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
This page describes both the APIs and the bindings provided by the python-maec library.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
# Import the required APIs
from maec.bundle.bundle import Bundle
from maec.bundle.malware_action import MalwareAction
from maec.utils import IDGenerator, set_id_method
from cybox.core import Object, AssociatedObjects, AssociatedObject, AssociationType
from cybox.objects.file_object import File
# Instantiate the MAEC/CybOX Entities
set_id_method(IDGenerator.METHOD_INT)
b = Bundle()
a = MalwareAction()
ao = AssociatedObject()
# Build the Associated Object for use in the Action
ao.properties = File()
ao.properties.file_name = "badware.exe"
ao.properties.size_in_bytes = "123456"
ao.association_type = AssociationType()
ao.association_type.value = 'output'
ao.association_type.xsi_type = 'maecVocabs:ActionObjectAssociationTypeVocab-1.0'
# Build the Action and add the Associated Object to it
a.name = 'create file'
a.name.xsi_type = 'maecVocabs:FileActionNameVocab-1.0'
a.associated_objects = AssociatedObjects()
a.associated_objects.append(ao)
# Add the Action to the Bundle
b.add_action(a)
# Output the Bundle to stdout
print b.to_xml(include_namespaces = False)
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
import sys
# Import the required bindings
import maec.bindings.maec_bundle as bundle_binding
import cybox.bindings.cybox_core as cybox_core_binding
import cybox.bindings.cybox_common as cybox_common_binding
import cybox.bindings.file_object as file_binding
# Instantiate the MAEC/CybOX Entities
b = bundle_binding.BundleType(id="bundle-1")
a = bundle_binding.MalwareActionType(id="action-1")
ao = cybox_core_binding.AssociatedObjectType(id="object-1")
# Build the Associated Object for use in the Action
f = file_binding.FileObjectType()
f_name = cybox_common_binding.StringObjectPropertyType(valueOf_="badware.exe")
f.set_File_Name(f_name)
f_size = cybox_common_binding.UnsignedLongObjectPropertyType(valueOf_="123456")
f.set_Size_In_Bytes(f_size)
f.set_xsi_type = "FileObj:FileObjectType"
ao.set_Properties(f)
ao_type = cybox_common_binding.ControlledVocabularyStringType(valueOf_="output")
ao_type.set_xsi_type("maecVocabs:ActionObjectAssociationTypeVocab-1.0")
ao.set_Association_Type(ao_type)
# Build the Action and add the Associated Object to it
a_name = cybox_common_binding.ControlledVocabularyStringType(valueOf_="create file")
a_name.set_xsi_type("maecVocabs:FileActionNameVocab-1.0")
a.set_Name(a_name)
as_objects = cybox_core_binding.AssociatedObjectsType()
as_objects.add_Associated_Object(ao)
a.set_Associated_Objects(as_objects)
# Add the Action to the Bundle
action_list = bundle_binding.ActionListType()
action_list.add_Action(a)
b.set_Actions(action_list)
# Output the Bundle to stdout
b.export(sys.stdout, 0)
The python-maec library provides APIs and utilities that aid in the creation, consumption, and processing of Structured Threat Information eXpression (MAEC) content. The APIs that drive much of the functionality of python-maec sit on top of a binding layer that acts as a direct connection between Python and the MAEC XML. Because both the APIs and the bindings allow for the creation and development of MAEC content, developers that are new to python-maec may not understand the differences between the two. This document aims to identify the purpose and uses of the APIs and bindings.
The python-maec library leverages machine generated XML-to-Python bindings for the creation and processing of MAEC content. These bindings are created using the generateDS utility and can be found under maec.bindings within the package hierarchy.
The MAEC bindings allow for a direct, complete mapping between Python classes and MAEC XML Schema data structures. That being said, it is possible (though not advised) to use only the MAEC bindings to create MAEC documents. However, because the code is generated from XML Schema without contextual knowledge of relationships or broader organizational/developmental schemes, it is often a cumbersome and laborious task to create even the simplest of MAEC documents.
Developers within the python-maec team felt that the binding code did not lend itself to rapid development or natural navigation of data, and so it was decided that a higher-level API should be created.
The python-maec APIs are classes and utilities that leverage the MAEC bindings for the creation and processing of MAEC content. The APIs are designed to behave more naturally when working with MAEC content, allowing developers to conceptualize and interact with MAEC documents as pure Python objects and not XML Schema objects.
The APIs provide validation of inputs, multiple input and output formats, more Pythonic access of data structure internals and interaction with classes, and better interpretation of a developers intent through datatype coercion and implicit instantiation.
Note
The python-maec APIs are under constant development. Our goal is to provide full API coverage of the MAEC data structures, but not all structures are exposed via the APIs yet. Please refer to the API Documentation for API coverage details.
The two code examples show the difference in creating and printing a simple MAEC document consisting of only a MAEC Bundle with a single Malware Action using the python-maec and python-cybox bindings. Both examples will produce the same MAEC XML!
API Example
# Import the required APIs
from maec.bundle.bundle import Bundle
from maec.bundle.malware_action import MalwareAction
from maec.utils import IDGenerator, set_id_method
from cybox.core import Object, AssociatedObjects, AssociatedObject, AssociationType
from cybox.objects.file_object import File
# Instantiate the MAEC/CybOX Entities
set_id_method(IDGenerator.METHOD_INT)
b = Bundle()
a = MalwareAction()
ao = AssociatedObject()
# Build the Associated Object for use in the Action
ao.properties = File()
ao.properties.file_name = "badware.exe"
ao.properties.size_in_bytes = "123456"
ao.association_type = AssociationType()
ao.association_type.value = 'output'
ao.association_type.xsi_type = 'maecVocabs:ActionObjectAssociationTypeVocab-1.0'
# Build the Action and add the Associated Object to it
a.name = 'create file'
a.name.xsi_type = 'maecVocabs:FileActionNameVocab-1.0'
a.associated_objects = AssociatedObjects()
a.associated_objects.append(ao)
# Add the Action to the Bundle
b.add_action(a)
# Output the Bundle to stdout
print b.to_xml(include_namespaces = False)
Binding Example
import sys
# Import the required bindings
import maec.bindings.maec_bundle as bundle_binding
import cybox.bindings.cybox_core as cybox_core_binding
import cybox.bindings.cybox_common as cybox_common_binding
import cybox.bindings.file_object as file_binding
# Instantiate the MAEC/CybOX Entities
b = bundle_binding.BundleType(id="bundle-1")
a = bundle_binding.MalwareActionType(id="action-1")
ao = cybox_core_binding.AssociatedObjectType(id="object-1")
# Build the Associated Object for use in the Action
f = file_binding.FileObjectType()
f_name = cybox_common_binding.StringObjectPropertyType(valueOf_="badware.exe")
f.set_File_Name(f_name)
f_size = cybox_common_binding.UnsignedLongObjectPropertyType(valueOf_="123456")
f.set_Size_In_Bytes(f_size)
f.set_xsi_type = "FileObj:FileObjectType"
ao.set_Properties(f)
ao_type = cybox_common_binding.ControlledVocabularyStringType(valueOf_="output")
ao_type.set_xsi_type("maecVocabs:ActionObjectAssociationTypeVocab-1.0")
ao.set_Association_Type(ao_type)
# Build the Action and add the Associated Object to it
a_name = cybox_common_binding.ControlledVocabularyStringType(valueOf_="create file")
a_name.set_xsi_type("maecVocabs:FileActionNameVocab-1.0")
a.set_Name(a_name)
as_objects = cybox_core_binding.AssociatedObjectsType()
as_objects.add_Associated_Object(ao)
a.set_Associated_Objects(as_objects)
# Add the Action to the Bundle
action_list = bundle_binding.ActionListType()
action_list.add_Action(a)
b.set_Actions(action_list)
# Output the Bundle to stdout
b.export(sys.stdout, 0)
If there is a problem with the APIs or bindings, or if there is functionality missing from the APIs that forces the use of the bindings, let us know in the python-maec issue tracker
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
If you notice a bug, have a suggestion for a new feature, or find that that something just isn’t behaving the way you’d expect it to, please submit an issue to our issue tracker.
If you’d like to contribute code to our repository, you can do so by issuing a pull request and we will work with you to try and integrate that code into our repository. Users who want to contribute code to the python-maec repository should be familiar with git and the GitHub pull request process.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
The python-maec APIs are the recommended tools for reading, writing, and manipulating MAEC XML documents.
Note
The python-maec APIs are currently under development. As such, API coverage of MAEC data constructs is incomplete; please bear with us as we work toward complete coverage. This documentation also serves to outline current API coverage.
MAEC – Modules located in the base maec package
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
MAEC Bundle – Modules located in the maec.bundle package
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: cybox.common.tools.ToolInformation, maec.Entity
Bases: cybox.EntityList
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: maec.Entity
Bases: cybox.core.action_reference.ActionReference
Bases: maec.Entity
Bases: maec.Entity
Bases: cybox.EntityList
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: cybox.EntityList
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Add an Action to an existing named Action Collection in the Collections entity. If it does not exist, add it to the top-level Actions entity.
Add an AV Classification to the top-level AV_Classifications entity in the Bundle.
Add a Behavior to an existing named Behavior Collection in the Collections entity. If it does not exist, add it to the top-level Behaviors entity.
Add a Candidate Indicator to an existing named Candidate Indicator Collection in the Collections entity. If it does not exist, add it to the top-level Candidate Indicators entity.
Add a Capability to the top-level Capabilities entity in the Bundle.
Add a new named Action Collection to the top-level Collections entity in the Bundle.
Add a new named Behavior Collection to the Collections entity in the Bundle.
Add a new named Candidate Indicator Collection to the Collections entity in the Bundle.
Add a new named Object Collection to the Collections entity in the Bundle.
Add an Object to an existing named Object Collection in the Collections entity. If it does not exist, add it to the top-level Object entity.
Compare the Bundle to a list of other Bundles, returning a BundleComparator object.
Deduplicate all Objects in the Bundle. Add duplicate Objects to new “Deduplicated Objects” Object Collection, and replace duplicate entries with references to corresponding Object.
Dereference any Objects in the Bundle by replacing them with the entities they reference.
Get all Objects corresponding to one or more types of Actions, specified via a list of Action names.
Return a list of all Actions in the Bundle.
Return a list of all of the Actions in the Bundle that operate on a particular input Object.
Return a list of all Objects in the Bundle that are referenced more than once.
Return a list of all Objects in the Bundle that are not references (i.e. all of the actual Objects in the Bundle).
Return a list of all Objects in the Bundle.
Find and return the Entity (Action, Object, etc.) with the specified ID.
Build and return the Object history for the Bundle.
Normalize all Objects in the Bundle, using the CybOX normalize module.
Set the top-level Malware Instance Object Attributes entity in the Bundle.
Set the Process Tree, in the top-level <Process_Tree> element.
Bases: cybox.EntityList
Bases: cybox.EntityList
Bases: cybox.EntityList
Bases: maec.Entity
Bases: maec.bundle.bundle.BaseCollection
Add an input Action to the Collection.
Bases: maec.bundle.bundle.BaseCollection
Add an input Behavior to the Collection.
Bases: maec.bundle.bundle.BaseCollection
Add an input Object to the Collection.
Bases: maec.bundle.bundle.BaseCollection
Add an input Candidate Indicator to the Collection.
Bases: cybox.EntityList
Return a specific named Collection from the list, based on its name.
Checks for the existence of a specific named Collection in the list, based on the its name.
Bases: cybox.EntityList
Return a specific named Collection from the list, based on its name.
Checks for the existence of a specific named Collection in the list, based on the its name.
Bases: cybox.EntityList
Return a specific named Collection from the list, based on its name.
Checks for the existence of a specific named Collection in the list, based on the its name.
Bases: cybox.EntityList
Return a specific named Collection from the list, based on its name.
Checks for the existence of a specific named Collection in the list, based on the its name.
Bases: maec.Entity
Add a new named Action Collection to the Collections instance.
Add a new named Behavior Collection to the Collections instance.
Add a new named Candidate Indicator Collection to the Collections instance.
Add a new named Object Collection to the Collections instance.
Returns true if any Collections instance inside of the Collection has len > 0.
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: cybox.EntityList
Bases: maec.Entity
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Add a Strategic Objective to the Capability.
Add a Tactical Objective to the Capability.
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: cybox.core.action.Action
Bases: maec.Entity
Bases: maec.Entity
Bases: cybox.EntityList
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: object
Build the Object History for a Bundle
Bases: object
Return a list of the Actions that operated on the Object, via their names, along with the Association_Type used in the Action.
Return a list of the Actions that operated on the Object, via their names
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: cybox.EntityList
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Set the Root Process node of the Process Tree entity.
Bases: cybox.objects.process_object.Process
Add an initiated Action to the Process Tree node, based on its ID.
Add an injected process to the Process Tree node, either directly or to a particular process embedded in the node based on its ID.
Add a spawned process to the Process Tree node, either directly or to a particular process embedded in the node based on its ID.
Find a Process embedded somewhere in the Process Tree node tree, based on its ID.
Set the ID of the Process Tree node.
Set the ID of the parent action of the Process Tree node.
MAEC Package – Modules located in the maec.package package
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: cybox.EntityList
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: cybox.EntityList
Bases: maec.Entity
Bases: cybox.EntityList
Bases: cybox.objects.system_object.System
Bases: cybox.EntityList
Bases: cybox.objects.system_object.System
Bases: maec.Entity
Bases: cybox.EntityList
Bases: cybox.EntityList
Bases: cybox.common.structured_text.StructuredText
Whether this can be represented as a string rather than a dictionary
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: cybox.EntityList
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
DeDuplicate all Findings Bundles in the Malware Subject. For now, only handles Objects
Dereference all Findings Bundles in the Malware Subject. For now, only handles Objects
Normalize all Findings Bundles in the Malware Subject. For now, only handles Objects
Bases: cybox.EntityList
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: maec.Entity
Bases: cybox.EntityList
Bases: maec.Entity
Bases: cybox.EntityList
Bases: cybox.EntityList
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
Bases: cybox.EntityList
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: maec.Entity
DeDuplicate all Malware_Subjects in the Package. For now, only handles Objects in Findings Bundles
Returns a tuple of (api_object, binding_object). Parameters: xml_file - either a filename or a stream object
MAEC Utils – Modules located in the maec.utils package
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: object
Add the unique Objects to the collection and perform the properties replacement.
Cleanup and remove and Objects that may be referencing the re-used Objects. Otherwise, this can create Object->Object->Object etc. references which don’t make sense.
Deduplicate the input Bundle.
Find a matching object, if it exists.
Get the values specified for an Object’s properties as a set.
Returns the value contained in a TypedField or its nested members, if applicable.
Replace all of the duplicate Objects with references to the unique object placed in the “Re-used Objects” Collection.
Add a new Object collection to the Bundle for storing the unique Objects. Add the Objects to the collection.
Map the non-unique Objects to their unique (first observed) counterparts.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Merge a list of input MAEC documents and write them to an output file
Merge a list of input Malware Subjects
Merge a list of input MAEC Packages and return a merged Package instance.
Update any existing Malware Subject relationships to account for merged Malware Subjects
Merge a list of input binned (related) Malware Subjects
Map the IDs of a list of existing Malware Subjects to the new merged Malware Subject
Merge two or more Malware Subject Findings Bundles
Deduplicate a simple list of MAEC/CybOX vocabulary entries
Merge a list of MAEC/CybOX entities
Bin a list of Malware Subjects by hash Default = MD5
Merge multiple dictionaries into one
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: object
Creates a python-maec Bundle or Package object from the supplied xml_file.
Arguments: xml_file – A filename/path or a file-like object reprenting a MAEC instance (i.e. Package or Bundle) document check_version – Inspect the version before parsing.
Creates a MAEC binding object from the supplied xml file.
Arguments: xml_file – A filename/path or a file-like object reprenting a MAEC instance document check_version – Inspect the version before parsing.
MAEC Analytics – Modules located in the maec.analytics package
Warning
This documentation is still a work in progress. If you have any issues or questions, please ask on the maec-discussion mailing list or file a bug in our issue tracker.
Bases: object
Calculates distance between two or more MAEC entities. Currently supports only Packages or Malware Subjects.
Added a log’d (log-ized??) number to a list
Bin a numeric value into a bucket, based on a parent list of values. N = number of buckets to use (default = 10).
Build a vector from an input list of strings and superset list of strings.
Calculate the distances between the input Malware Subjects.
Construct the dynamic result (matching) vector for a corresponding feature vector
Construct the static result (matching) vector for a corresponding feature vector
Calculate vector supersets from the feature vectors
Calculate the Euclidean distance between two input vectors
Generate a single, flattened vector from an input list of vectors or values.
Generate a feature vector for the binned Malware Subjects
Scale a numeric value, based on a parent list of values. Return the scaled/normalized form.
Scale a list of numeric values, based on a parent list of numeric value lists. Return the scaled/normalized form.
Normalize two input vectors so that they have similar composition.
Perform the actual distance calculation. Store the results in the distances dictionary.
Populate and return the Malware Subject -> Hashes mapping from an input list of Malware Subjects.
Pre-process the MAEC entities
Print the distances between the Malware Subjects in delimited matrix format to a File-like object.
Try to use the MD5s of the Malware Subjects as the default label. Uses commas as the default delimiter, for CSV-like output.
Bases: object
Generate a feature vector for a Malware Subject based on its static features
Create a vector from a single Object
Create a vector of static features for an input Malware Subject
Extract the static features from the Malware Subject
Calculates the unique set of static features for the Malware Subject
Bases: object
Generate a feature vector for a Malware Subject based on its dynamic features
Create a vector from a single Action
Create a vector of unique action/object pairs for an input Malware Subject
Extract the dynamic features from the Malware Subject
Calculates the unique set of dynamic features for the Malware Subject
Prune the dynamic features based on ignored Object properties/Actions