mirror of https://github.com/MISP/MISP
new: [galaxyMatrix] Added possibility to pick a galaxy to view it's
statistic.pull/4308/head
parent
bacb4ecab5
commit
04798bf7e4
|
@ -1553,7 +1553,7 @@ class UsersController extends AppController
|
|||
public function statistics($page = 'data')
|
||||
{
|
||||
$this->set('page', $page);
|
||||
$pages = array('data' => 'Usage data', 'orgs' => 'Organisations', 'users' => 'User and Organisation statistics', 'tags' => 'Tags', 'attributehistogram' => 'Attribute histogram', 'sightings' => 'Sightings toplists', 'attackMatrix' => 'ATT&CK Matrix');
|
||||
$pages = array('data' => 'Usage data', 'orgs' => 'Organisations', 'users' => 'User and Organisation statistics', 'tags' => 'Tags', 'attributehistogram' => 'Attribute histogram', 'sightings' => 'Sightings toplists', 'galaxyMatrix' => 'Galaxy Matrix');
|
||||
if (!$this->_isSiteAdmin() && !empty(Configure::read('Security.hide_organisation_index_from_users'))) {
|
||||
unset($pages['orgs']);
|
||||
}
|
||||
|
@ -1578,8 +1578,8 @@ class UsersController extends AppController
|
|||
}
|
||||
} elseif ($page == 'sightings') {
|
||||
$result = $this->__statisticsSightings($this->params['named']);
|
||||
} elseif ($page == 'attackMatrix') {
|
||||
$result = $this->__statisticsAttackMatrix($this->params['named']);
|
||||
} elseif ($page == 'galaxyMatrix') {
|
||||
$result = $this->__statisticsGalaxyMatrix($this->params['named']);
|
||||
}
|
||||
if ($this->_isRest()) {
|
||||
return $result;
|
||||
|
@ -1881,12 +1881,16 @@ class UsersController extends AppController
|
|||
}
|
||||
}
|
||||
|
||||
private function __statisticsAttackMatrix($params = array())
|
||||
private function __statisticsGalaxyMatrix($params = array())
|
||||
{
|
||||
$this->loadModel('Event');
|
||||
$this->loadModel('Galaxy');
|
||||
|
||||
$galaxy_id = $this->Galaxy->getMitreAttackGalaxyId();
|
||||
$mitre_galaxy_id = $this->Galaxy->getMitreAttackGalaxyId();
|
||||
if (isset($params['galaxy_id'])) {
|
||||
$galaxy_id = $params['galaxy_id'];
|
||||
} else {
|
||||
$galaxy_id = $mitre_galaxy_id;
|
||||
}
|
||||
$matrixData = $this->Galaxy->getMatrix($galaxy_id);
|
||||
|
||||
$tabs = $matrixData['tabs'];
|
||||
|
@ -1903,7 +1907,7 @@ 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) {
|
||||
if ($matrixData['galaxy']['id'] == $mitre_galaxy_id) {
|
||||
$mergedScore = array();
|
||||
foreach ($scoresData as $tag => $v) {
|
||||
$predicateValue = explode(':', $tag, 2)[1];
|
||||
|
@ -1963,10 +1967,17 @@ class UsersController extends AppController
|
|||
$this->set('interpolation', $colours['interpolation']);
|
||||
}
|
||||
$this->set('pickingMode', false);
|
||||
$this->set('defaultTabName', "mitre-attack");
|
||||
if ($matrixData['galaxy']['id'] == $mitre_galaxy_id) {
|
||||
$this->set('defaultTabName', "mitre-attack");
|
||||
}
|
||||
$this->set('removeTrailling', 2);
|
||||
|
||||
$this->render('statistics_attackmatrix');
|
||||
$this->set('galaxyName', $matrixData['galaxy']['name']);
|
||||
$this->set('galaxyId', $matrixData['galaxy']['id']);
|
||||
$matrixGalaxies = $this->Galaxy->getAllowedMatrixGalaxies();
|
||||
$this->set('matrixGalaxies', $matrixGalaxies);
|
||||
|
||||
$this->render('statistics_galaxymatrix');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -383,6 +383,20 @@ class Galaxy extends AppModel
|
|||
return empty($galaxy) ? 0 : $galaxy['Galaxy']['id'];
|
||||
}
|
||||
|
||||
public function getAllowedMatrixGalaxies()
|
||||
{
|
||||
$conditions = array(
|
||||
'NOT' => array(
|
||||
'kill_chain_order' => ''
|
||||
)
|
||||
);
|
||||
$galaxies = $this->find('all', array(
|
||||
'recursive' => -1,
|
||||
'conditions' => $conditions,
|
||||
));
|
||||
return $galaxies;
|
||||
}
|
||||
|
||||
public function getMatrix($galaxy_id)
|
||||
{
|
||||
$conditions = array('Galaxy.id' => $galaxy_id);
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
<div class = "index">
|
||||
<h2><?php echo __('Statistics');?></h2>
|
||||
<?php
|
||||
echo $this->element('Users/statisticsMenu');
|
||||
?>
|
||||
<p style="margin-bottom: 40px;"><?php echo __('A heatmap showing the usage of ATT&CK Tactic.');?></p>
|
||||
|
||||
<div id="attackmatrix_div" style="position: relative; border: solid 1px;" class="statistics_attack_matrix">
|
||||
<?php
|
||||
echo $this->element('view_galaxy_matrix');
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'globalActions', 'menuItem' => 'statistics'));
|
||||
?>
|
Loading…
Reference in New Issue