Professional Documents
Culture Documents
Processing 2
Processing 2
Processing Modules
==================
Cuckoo's processing modules are Python scripts that let you define custom
ways to analyze the raw results generated by the sandbox and append
some information to a global container that will be later used by the
signatures and the reporting modules.
You can create as many modules as you want, as long as they follow a
predefined structure that we will present in this chapter.
Global Container
================
[foobar]
enabled = on
Every module will then be initialized and executed and the data returned
will be appended in a data structure that we'll call **global container**.
Getting started
===============
.. code-block:: python
:linenos:
class MyModule(Processing):
def run(self):
self.key = "key"
data = do_something()
return data
You can also specify an ``order`` value, which allows you to run the available
processing modules in
an ordered sequence. By default all modules are set with an ``order`` value of
``1`` and are executed
in alphabetical order.
If you want to change this value your module would look like:
.. code-block:: python
:linenos:
class MyModule(Processing):
order = 2
def run(self):
self.key = "key"
data = do_something()
return data
You can also manually disable a processing module by setting the ``enabled``
attribute to ``False``:
.. code-block:: python
:linenos:
class MyModule(Processing):
enabled = False
def run(self):
self.key = "key"
data = do_something()
return data
The processing modules are provided with some attributes that can be used to access
the raw results
for the given analysis:
With these attributes you should be able to easily access all the raw results
stored by Cuckoo and
perform your analytic operations on them.
.. code-block:: python
:linenos:
class MyModule(Processing):
def run(self):
self.key = "key"
try:
data = do_something()
except SomethingFailed:
raise CuckooProcessingError("Failed")
return data