mirror of https://github.com/MISP/MISP
wip: [enrichment] Passing initial object references as well
- Also testing if the initial object found is not emptypull/4584/head
parent
3368121940
commit
7e55c28c92
|
@ -5143,6 +5143,7 @@ class EventsController extends AppController
|
||||||
'recursive' => -1,
|
'recursive' => -1,
|
||||||
'fields' => array('Object.id', 'Object.uuid', 'Object.name')
|
'fields' => array('Object.id', 'Object.uuid', 'Object.name')
|
||||||
));
|
));
|
||||||
|
if (!empty($initial_object)) {
|
||||||
$initial_attributes = $this->Event->Attribute->find('all', array(
|
$initial_attributes = $this->Event->Attribute->find('all', array(
|
||||||
'conditions' => array('Attribute.object_id' => $object_id,
|
'conditions' => array('Attribute.object_id' => $object_id,
|
||||||
'Attribute.deleted' => 0),
|
'Attribute.deleted' => 0),
|
||||||
|
@ -5156,8 +5157,22 @@ class EventsController extends AppController
|
||||||
array_push($initial_object['Attribute'], $initial_attribute['Attribute']);
|
array_push($initial_object['Attribute'], $initial_attribute['Attribute']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$initial_references = $this->Event->Object->ObjectReference->find('all', array(
|
||||||
|
'conditions' => array('ObjectReference.object_id' => $object_id,
|
||||||
|
'ObjectReference.event_id' => $event_id,
|
||||||
|
'ObjectReference.deleted' => 0),
|
||||||
|
'recursive' => -1,
|
||||||
|
'fields' => array('ObjectReference.referenced_uuid', 'ObjectReference.relationship_type')
|
||||||
|
));
|
||||||
|
if (!empty($initial_references)) {
|
||||||
|
$initial_object['ObjectReference'] = array();
|
||||||
|
foreach ($initial_references as $initial_reference) {
|
||||||
|
array_push($initial_object['ObjectReference'], $initial_reference['ObjectReference']);
|
||||||
|
}
|
||||||
|
}
|
||||||
$event['initialObject'] = $initial_object;
|
$event['initialObject'] = $initial_object;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$this->set('event', $event);
|
$this->set('event', $event);
|
||||||
if (!empty($result['results'])) {
|
if (!empty($result['results'])) {
|
||||||
$this->__handleSimplifiedFormat($attribute, $module, $options, $result, $type, $event = true, $render_name = 'resolved_misp_format');
|
$this->__handleSimplifiedFormat($attribute, $module, $options, $result, $type, $event = true, $render_name = 'resolved_misp_format');
|
||||||
|
|
Loading…
Reference in New Issue