diff --git a/cortexutils/analyzer.py b/cortexutils/analyzer.py index e620680..3ed4283 100644 --- a/cortexutils/analyzer.py +++ b/cortexutils/analyzer.py @@ -102,11 +102,16 @@ def report(self, full_report, ensure_ascii=False): summary = self.summary(full_report) except Exception: pass - + operation_list = [] + try: + operation_list = self.operations(full_report) + except Exception: + pass super(Analyzer, self).report({ 'success': True, 'summary': summary, 'artifacts': self.artifacts(full_report), + 'operations': operation_list, 'full': full_report }, ensure_ascii) diff --git a/cortexutils/responder.py b/cortexutils/responder.py index 0c13a2a..84b0fb8 100644 --- a/cortexutils/responder.py +++ b/cortexutils/responder.py @@ -20,25 +20,25 @@ def get_data(self): :return: Data (observable value) given through Cortex""" return self.get_param('data', None, 'Missing data field') - @staticmethod - def build_operation(op_type, **parameters): - """ - :param op_type: an operation type as a string - :param parameters: a dict including the operation's params - :return: dict - """ - operation = { - 'type': op_type - } - operation.update(parameters) - - return operation - - def operations(self, raw): - """Returns the list of operations to be executed after the job completes - - :returns: by default return an empty array""" - return [] + # @staticmethod + # def build_operation(op_type, **parameters): + # """ + # :param op_type: an operation type as a string + # :param parameters: a dict including the operation's params + # :return: dict + # """ + # operation = { + # 'type': op_type + # } + # operation.update(parameters) + + # return operation + + # def operations(self, raw): + # """Returns the list of operations to be executed after the job completes + + # :returns: by default return an empty array""" + # return [] def report(self, full_report, ensure_ascii=False): """Returns a json dict via stdout. diff --git a/cortexutils/worker.py b/cortexutils/worker.py index f62d406..15bf151 100644 --- a/cortexutils/worker.py +++ b/cortexutils/worker.py @@ -127,6 +127,26 @@ def get_data(self): :return: Data (observable value) given through Cortex""" return self.get_param('data', None, 'Missing data field') + @staticmethod + def build_operation(op_type, **parameters): + """ + :param op_type: an operation type as a string + :param parameters: a dict including the operation's params + :return: dict + """ + operation = { + 'type': op_type + } + operation.update(parameters) + + return operation + + def operations(self, raw): + """Returns the list of operations to be executed after the job completes + + :returns: by default return an empty array""" + return [] + def get_param(self, name, default=None, message=None): """Just a wrapper for Analyzer.__get_param. :param name: Name of the parameter to get. JSON-like syntax, e.g. `config.username`