mirror of https://github.com/MISP/MISP
Merge branch '2.4' of github.com:MISP/MISP into eventFiltering
commit
a77e08548e
|
@ -4840,6 +4840,48 @@ class EventsController extends AppController
|
|||
}
|
||||
|
||||
$scores = $scoresData;
|
||||
// FIXME: temporary fix: add the score of deprecated mitre galaxies to the new one (for the stats)
|
||||
if ($matrixData['galaxy']['id'] == $mitreAttackGalaxyId) {
|
||||
$mergedScore = array();
|
||||
foreach ($scoresData as $tag => $v) {
|
||||
$predicateValue = explode(':', $tag, 2)[1];
|
||||
$predicateValue = explode('=', $predicateValue, 2);
|
||||
$predicate = $predicateValue[0];
|
||||
$clusterValue = $predicateValue[1];
|
||||
$mappedTag = '';
|
||||
$mappingWithoutExternalId = array();
|
||||
if ($predicate == 'mitre-attack-pattern') {
|
||||
$mappedTag = $tag;
|
||||
$name = explode(" ", $tag);
|
||||
$name = join(" ", array_slice($name, 0, -2)); // remove " - external_id"
|
||||
$mappingWithoutExternalId[$name] = $tag;
|
||||
} else {
|
||||
$name = explode(" ", $clusterValue);
|
||||
$name = join(" ", array_slice($name, 0, -2)); // remove " - external_id"
|
||||
if (isset($mappingWithoutExternalId[$name])) {
|
||||
$mappedTag = $mappingWithoutExternalId[$name];
|
||||
} else {
|
||||
$adjustedTagName = $this->Galaxy->GalaxyCluster->find('list', array(
|
||||
'group' => array('GalaxyCluster.id', 'GalaxyCluster.tag_name'),
|
||||
'conditions' => array('GalaxyCluster.tag_name LIKE' => 'misp-galaxy:mitre-attack-pattern=' . $name . '% T%'),
|
||||
'fields' => array('GalaxyCluster.tag_name')
|
||||
));
|
||||
$adjustedTagName = array_values($adjustedTagName)[0];
|
||||
$mappingWithoutExternalId[$name] = $adjustedTagName;
|
||||
$mappedTag = $mappingWithoutExternalId[$name];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($mergedScore[$mappedTag])) {
|
||||
$mergedScore[$mappedTag] += $v;
|
||||
} else {
|
||||
$mergedScore[$mappedTag] = $v;
|
||||
}
|
||||
}
|
||||
$scores = $mergedScore;
|
||||
$maxScore = max(array_values($mergedScore));
|
||||
}
|
||||
// end FIXME
|
||||
|
||||
if ($this->_isRest()) {
|
||||
$json = array('matrix' => $tabs, 'scores' => $scores, 'instance-uuid' => $instanceUUID);
|
||||
|
|
|
@ -1876,6 +1876,48 @@ class UsersController extends AppController
|
|||
}
|
||||
$maxScore = max($scoresDataAttr['maxScore'], $scoresDataEvent['maxScore']);
|
||||
$scores = $scoresData;
|
||||
// FIXME: temporary fix: add the score of deprecated mitre galaxies to the new one (for the stats)
|
||||
if ($matrixData['galaxy']['id'] == $galaxy_id) {
|
||||
$mergedScore = array();
|
||||
foreach ($scoresData as $tag => $v) {
|
||||
$predicateValue = explode(':', $tag, 2)[1];
|
||||
$predicateValue = explode('=', $predicateValue, 2);
|
||||
$predicate = $predicateValue[0];
|
||||
$clusterValue = $predicateValue[1];
|
||||
$mappedTag = '';
|
||||
$mappingWithoutExternalId = array();
|
||||
if ($predicate == 'mitre-attack-pattern') {
|
||||
$mappedTag = $tag;
|
||||
$name = explode(" ", $tag);
|
||||
$name = join(" ", array_slice($name, 0, -2)); // remove " - external_id"
|
||||
$mappingWithoutExternalId[$name] = $tag;
|
||||
} else {
|
||||
$name = explode(" ", $clusterValue);
|
||||
$name = join(" ", array_slice($name, 0, -2)); // remove " - external_id"
|
||||
if (isset($mappingWithoutExternalId[$name])) {
|
||||
$mappedTag = $mappingWithoutExternalId[$name];
|
||||
} else {
|
||||
$adjustedTagName = $this->Galaxy->GalaxyCluster->find('list', array(
|
||||
'group' => array('GalaxyCluster.id', 'GalaxyCluster.tag_name'),
|
||||
'conditions' => array('GalaxyCluster.tag_name LIKE' => 'misp-galaxy:mitre-attack-pattern=' . $name . '% T%'),
|
||||
'fields' => array('GalaxyCluster.tag_name')
|
||||
));
|
||||
$adjustedTagName = array_values($adjustedTagName)[0];
|
||||
$mappingWithoutExternalId[$name] = $adjustedTagName;
|
||||
$mappedTag = $mappingWithoutExternalId[$name];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($mergedScore[$mappedTag])) {
|
||||
$mergedScore[$mappedTag] += $v;
|
||||
} else {
|
||||
$mergedScore[$mappedTag] = $v;
|
||||
}
|
||||
}
|
||||
$scores = $mergedScore;
|
||||
$maxScore = max(array_values($mergedScore));
|
||||
}
|
||||
// end FIXME
|
||||
|
||||
if ($this->_isRest()) {
|
||||
$json = array('matrix' => $tabs, 'scores' => $scores, 'instance-uuid' => $instanceUUID);
|
||||
|
|
|
@ -434,7 +434,7 @@ class Galaxy extends AppModel
|
|||
$cluster['external_id'] = $element['value'];
|
||||
}
|
||||
if ($toBeAdded) {
|
||||
array_push($matrixData['matrixTags'], $cluster['tag_name']);
|
||||
$matrixData['matrixTags'][$cluster['tag_name']] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -452,6 +452,24 @@ class Galaxy extends AppModel
|
|||
}
|
||||
}
|
||||
|
||||
// #FIXME temporary fix: retreive tag name of deprecated mitre galaxies (for the stats)
|
||||
if ($galaxy['Galaxy']['id'] == $this->getMitreAttackGalaxyId()) {
|
||||
$names = array('Enterprise Attack - Attack Pattern', 'Pre Attack - Attack Pattern', 'Mobile Attack - Attack Pattern');
|
||||
$tag_names = array();
|
||||
$gals = $this->find('all', array(
|
||||
'recursive' => -1,
|
||||
'contain' => array('GalaxyCluster.tag_name'),
|
||||
'conditions' => array('Galaxy.name' => $names)
|
||||
));
|
||||
foreach ($gals as $gal => $temp) {
|
||||
foreach ($temp['GalaxyCluster'] as $value) {
|
||||
$matrixData['matrixTags'][$value['tag_name']] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
// end FIXME
|
||||
|
||||
$matrixData['matrixTags'] = array_keys($matrixData['matrixTags']);
|
||||
return $matrixData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
'url' => '/pages/display/doc/categories_and_types'
|
||||
),
|
||||
array(
|
||||
'text' => __('Terms & Conditions'),
|
||||
'text' => __('Terms & Conditions'),
|
||||
'url' => '/users/terms'
|
||||
),
|
||||
array(
|
||||
|
@ -360,17 +360,17 @@
|
|||
array(
|
||||
'url' => h(Configure::read('Plugin.CustomAuth_custom_logout')),
|
||||
'text' => __('Log out'),
|
||||
'requirement' => !$externalAuthUser && !Configure::read('Plugin.CustomAuth_disable_logout')
|
||||
'requirement' => (!$externalAuthUser && empty(Configure::read('Plugin.CustomAuth_disable_logout')))
|
||||
),
|
||||
array(
|
||||
'url' => '/users/logout',
|
||||
'text' => __('Log out'),
|
||||
'requirement' => (Configure::read('Plugin.CustomAuth_custom_logout'))
|
||||
'text' => __('Log out2'),
|
||||
'requirement' => (!empty(Configure::read('Plugin.CustomAuth_custom_logout')))
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
<div id="topBar" class="navbar navbar-inverse <?php echo $debugMode;?>">
|
||||
<div id="topBar" class="navbar navbar-inverse <?php echo $debugMode;?>" style="z-index: 20;">
|
||||
<div class="navbar-inner">
|
||||
<ul class="nav">
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue