mirror of https://github.com/MISP/MISP
new: [API] added threat_level_id as a restSearch filter
parent
be946bf09b
commit
eed82bff99
|
@ -72,7 +72,7 @@ class RestResponseComponent extends Component
|
|||
'restSearch' => array(
|
||||
'description' => "Search MISP using a list of filter parameters and return the data in the selected format. The search is available on an event and an attribute level, just select the scope via the URL (/events/restSearch vs /attributes/restSearch). Besides the parameters listed, other, format specific ones can be passed along (for example: requested_attributes and includeContext for the CSV export). This API allows pagination via the page and limit parameters.",
|
||||
'mandatory' => array('returnFormat'),
|
||||
'optional' => array('page', 'limit', 'value', 'type', 'category', 'org', 'tag', 'tags', 'searchall', 'date', 'last', 'eventid', 'withAttachments', 'metadata', 'uuid', 'published', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'sgReferenceOnly', 'eventinfo', 'excludeLocalTags'),
|
||||
'optional' => array('page', 'limit', 'value', 'type', 'category', 'org', 'tag', 'tags', 'searchall', 'date', 'last', 'eventid', 'withAttachments', 'metadata', 'uuid', 'published', 'publish_timestamp', 'timestamp', 'enforceWarninglist', 'sgReferenceOnly', 'eventinfo', 'excludeLocalTags', 'threat_level_id'),
|
||||
'params' => array()
|
||||
)
|
||||
),
|
||||
|
@ -1456,13 +1456,13 @@ class RestResponseComponent extends Component
|
|||
'input' => 'select',
|
||||
'type' => 'integer',
|
||||
'operators' => ['equal', 'not_equal'],
|
||||
'values' => array( 1 => 'Hight', 2 => 'Medium', 3 => 'Low', 4 => 'Undefined')
|
||||
'values' => array( 1 => 'High', 2 => 'Medium', 3 => 'Low', 4 => 'Undefined')
|
||||
),
|
||||
'threatlevel' => array(
|
||||
'input' => 'select',
|
||||
'type' => 'integer',
|
||||
'operators' => ['equal', 'not_equal'],
|
||||
'values' => array( 1 => 'Hight', 2 => 'Medium', 3 => 'Low', 4 => 'Undefined')
|
||||
'values' => array( 1 => 'High', 2 => 'Medium', 3 => 'Low', 4 => 'Undefined')
|
||||
),
|
||||
'time' => array(
|
||||
'input' => 'text',
|
||||
|
|
|
@ -10,13 +10,14 @@ class RestSearchComponent extends Component
|
|||
'published', 'timestamp','enforceWarninglist', 'to_ids', 'deleted', 'includeEventUuid', 'event_timestamp', 'threat_level_id', 'includeEventTags',
|
||||
'includeProposals', 'returnFormat', 'limit', 'page', 'requested_attributes', 'includeContext', 'headerless',
|
||||
'includeWarninglistHits', 'attackGalaxy', 'object_relation', 'includeSightings', 'includeCorrelations', 'includeDecayScore',
|
||||
'decayingModel', 'excludeDecayed', 'modelOverrides', 'includeFullModel', 'score', 'attribute_timestamp', 'first_seen', 'last_seen'
|
||||
'decayingModel', 'excludeDecayed', 'modelOverrides', 'includeFullModel', 'score', 'attribute_timestamp', 'first_seen', 'last_seen',
|
||||
'threat_level_id'
|
||||
),
|
||||
'Event' => array(
|
||||
'returnFormat', 'value', 'type', 'category', 'org', 'tags', 'searchall', 'from', 'to', 'last', 'eventid', 'withAttachments',
|
||||
'metadata', 'uuid', 'publish_timestamp', 'timestamp', 'published', 'enforceWarninglist', 'sgReferenceOnly',
|
||||
'limit', 'page', 'requested_attributes', 'includeContext', 'headerless', 'includeWarninglistHits', 'attackGalaxy', 'to_ids', 'deleted',
|
||||
'excludeLocalTags', 'date', 'includeSightingdb', 'tag', 'object_relation'
|
||||
'excludeLocalTags', 'date', 'includeSightingdb', 'tag', 'object_relation', 'threat_level_id'
|
||||
),
|
||||
'Object' => array(
|
||||
'returnFormat', 'value' , 'type', 'category', 'org', 'tags', 'from', 'to', 'last', 'eventid', 'withAttachments', 'uuid', 'publish_timestamp',
|
||||
|
|
|
@ -4416,7 +4416,8 @@ class Attribute extends AppModel
|
|||
'event_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
|
||||
'publish_timestamp' => array('function' => 'set_filter_timestamp'),
|
||||
'org' => array('function' => 'set_filter_org'),
|
||||
'published' => array('function' => 'set_filter_published')
|
||||
'published' => array('function' => 'set_filter_published'),
|
||||
'threat_level_id' => array('function' => 'set_filter_threat_level_id')
|
||||
),
|
||||
'Object' => array(
|
||||
'object_name' => array('function' => 'set_filter_object_name'),
|
||||
|
|
|
@ -1658,7 +1658,8 @@ class Event extends AppModel
|
|||
'publish_timestamp' => array('function' => 'set_filter_timestamp', 'pop' => true),
|
||||
'org' => array('function' => 'set_filter_org', 'pop' => true),
|
||||
'uuid' => array('function' => 'set_filter_uuid', 'pop' => true),
|
||||
'published' => array('function' => 'set_filter_published', 'pop' => true)
|
||||
'published' => array('function' => 'set_filter_published', 'pop' => true),
|
||||
'threat_level_id' => array('function' => 'set_filter_threat_level_id', 'pop' => true)
|
||||
),
|
||||
'Object' => array(
|
||||
'object_name' => array('function' => 'set_filter_object_name'),
|
||||
|
@ -2715,6 +2716,14 @@ class Event extends AppModel
|
|||
return $conditions;
|
||||
}
|
||||
|
||||
public function set_filter_threat_level_id(&$params, $conditions, $options)
|
||||
{
|
||||
if (isset($params['threat_level_id'])) {
|
||||
$conditions['AND']['Event.threat_level_id'] = $params['threat_level_id'];
|
||||
}
|
||||
return $conditions;
|
||||
}
|
||||
|
||||
public function set_filter_tags(&$params, $conditions, $options)
|
||||
{
|
||||
if (!empty($params['tags'])) {
|
||||
|
|
Loading…
Reference in New Issue