mirror of https://github.com/MISP/MISP
chg: [restSearch:attack] Only expose attack return format to the `event`
scopepull/4635/head
parent
acef3a0168
commit
11a4bdb959
|
@ -1913,7 +1913,7 @@ class UsersController extends AppController
|
|||
$this->set('organisations', $organisations);
|
||||
$picked_organisation = 0;
|
||||
if (isset($params['organisation']) && $params['organisation'] != 0) {
|
||||
$org = $this->Organisation->find('first', array(
|
||||
$org = $this->User->Organisation->find('first', array(
|
||||
'recursive' => -1,
|
||||
'conditions' => array('id' => $params['organisation']),
|
||||
));
|
||||
|
@ -1934,6 +1934,7 @@ class UsersController extends AppController
|
|||
|| isset($params['dateTo'])
|
||||
|| isset($params['organisation']) && $params['organisation'] != 0
|
||||
) { // use restSearch
|
||||
$ignore_score = true;
|
||||
$filters = array();
|
||||
if (isset($params['dateFrom'])) {
|
||||
$filters['from'] = $params['dateFrom'];
|
||||
|
@ -1948,14 +1949,14 @@ class UsersController extends AppController
|
|||
}
|
||||
$elementCounter = 0;
|
||||
$renderView = '';
|
||||
$final = $this->Event->Attribute->restSearch($this->Auth->user(), 'attack', $filters, false, false, $elementCounter, $renderView);
|
||||
$final = $this->Event->restSearch($this->Auth->user(), 'attack', $filters, false, false, $elementCounter, $renderView);
|
||||
|
||||
$final = json_decode($final, true);
|
||||
if (!empty($final)) {
|
||||
$rest_response_empty = false;
|
||||
$ignore_score = true;
|
||||
}
|
||||
foreach ($final as $key => $data) {
|
||||
$this->set($key, $data);
|
||||
foreach ($final as $key => $data) {
|
||||
$this->set($key, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ class AttackExport
|
|||
private $__matrixTags = false;
|
||||
private $__killChainOrders = false;
|
||||
private $__instanceUUID = false;
|
||||
private $__scope = 'Event';
|
||||
|
||||
public function handler($data, $options = array())
|
||||
{
|
||||
|
@ -51,17 +50,12 @@ class AttackExport
|
|||
$this->__killChainOrders = $this->__matrixData['killChain'];
|
||||
$this->__instanceUUID = $this->__matrixData['instance-uuid'];
|
||||
}
|
||||
$this->__scope = empty($options['scope']) ? 'Event' : $options['scope'];
|
||||
$clusterData = array();
|
||||
if ($this->__scope === 'Event') {
|
||||
$clusterData = $this->__aggregate($data, $clusterData);
|
||||
if (!empty($data['Attribute'])) {
|
||||
foreach ($data['Attribute'] as $attribute) {
|
||||
$clusterData = $this->__aggregate($attribute, $clusterData);
|
||||
}
|
||||
|
||||
$clusterData = $this->__aggregate($data, array());
|
||||
if (!empty($data['Attribute'])) {
|
||||
foreach ($data['Attribute'] as $attribute) {
|
||||
$clusterData = $this->__aggregate($attribute, $clusterData);
|
||||
}
|
||||
} else {
|
||||
$clusterData = $this->__aggregate($data, $clusterData);
|
||||
}
|
||||
|
||||
foreach ($clusterData as $key => $value) {
|
||||
|
@ -109,7 +103,7 @@ class AttackExport
|
|||
$gradientTool = new ColourGradientTool();
|
||||
$colours = $gradientTool->createGradientFromValues($this->__clusterCounts);
|
||||
$result = array(
|
||||
'target_type' => strtolower($this->__scope),
|
||||
'target_type' => 'event',
|
||||
'columnOrders' => $this->__killChainOrders,
|
||||
'tabs' => $this->__tabs,
|
||||
'scores' => $this->__clusterCounts,
|
||||
|
|
|
@ -392,8 +392,7 @@ class Attribute extends AppModel
|
|||
'yara-json' => array('json', 'YaraExport', 'json'),
|
||||
'rpz' => array('rpz', 'RPZExport', 'rpz'),
|
||||
'csv' => array('csv', 'CsvExport', 'csv'),
|
||||
'cache' => array('txt', 'CacheExport', 'cache'),
|
||||
'attack' => array('html', 'AttackExport', 'html')
|
||||
'cache' => array('txt', 'CacheExport', 'cache')
|
||||
);
|
||||
|
||||
// FIXME we need a better way to list the defaultCategories knowing that new attribute types will continue to appear in the future. We should generate this dynamically or use a function using the default_category of the $typeDefinitions
|
||||
|
|
Loading…
Reference in New Issue