mirror of https://github.com/MISP/MISP
new: [API] Correctly handle objects in flat exports and exposed text export to event level search
parent
a03b1c9d44
commit
2e7dfc9273
|
@ -3025,7 +3025,8 @@ class EventsController extends AppController
|
|||
'xml' => array('xml', 'XmlExport'),
|
||||
'suricata' => array('txt', 'NidsSuricataExport'),
|
||||
'snort' => array('txt', 'NidsSnortExport'),
|
||||
'rpz' => array('rpz', 'RPZExport')
|
||||
'rpz' => array('rpz', 'RPZExport'),
|
||||
'text' => array('text', 'TextExport')
|
||||
);
|
||||
$exception = false;
|
||||
$filters = $this->_harvestParameters($filterData, $exception);
|
||||
|
@ -3051,6 +3052,9 @@ class EventsController extends AppController
|
|||
}
|
||||
App::uses($validFormats[$returnFormat][1], 'Export');
|
||||
$exportTool = new $validFormats[$returnFormat][1]();
|
||||
if (!empty($exportTool->additional_params)) {
|
||||
$filters = array_merge($filters, $exportTool->additional_params);
|
||||
}
|
||||
$exportToolParams = array(
|
||||
'user' => $this->Auth->user(),
|
||||
'params' => array(),
|
||||
|
|
|
@ -15,7 +15,8 @@ class NidsExport
|
|||
'Event' => array(
|
||||
'fields' => array('threat_level_id')
|
||||
)
|
||||
)
|
||||
),
|
||||
'flatten' => 1
|
||||
);
|
||||
|
||||
public function handler($data, $options = array())
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
class OpeniocExport
|
||||
{
|
||||
public $additional_params = array(
|
||||
'flatten' => 1
|
||||
);
|
||||
|
||||
public function buildAll($user, $data, $scope = 'event')
|
||||
{
|
||||
|
|
|
@ -2,11 +2,22 @@
|
|||
|
||||
class TextExport
|
||||
{
|
||||
public $additional_params = array(
|
||||
'flatten' => 1
|
||||
);
|
||||
|
||||
public function handler($data, $options = array())
|
||||
{
|
||||
if ($options['scope'] === 'Attribute') {
|
||||
return $data['Attribute']['value'];
|
||||
}
|
||||
if ($options['scope'] === 'Event') {
|
||||
$result = array();
|
||||
foreach ($data['Attribute'] as $attribute) {
|
||||
$result[] = $attribute['value'];
|
||||
}
|
||||
return implode($this->separator(), $result);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue