new: First RC of MISP galaxies 1.0

pull/1728/head
Iglocska 2016-12-06 15:52:20 +01:00
parent d891e0e652
commit 8f220378ce
4 changed files with 36 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<?php
class JSONConverterTool {
public function event2JSON($event, $isSiteAdmin=false) {
$toRearrange = array('Org', 'Orgc', 'SharingGroup', 'Attribute', 'ShadowAttribute', 'RelatedAttribute', 'RelatedEvent');
$toRearrange = array('Org', 'Orgc', 'SharingGroup', 'Attribute', 'ShadowAttribute', 'RelatedAttribute', 'RelatedEvent', 'Galaxy');
foreach ($toRearrange as $object) {
if (isset($event[$object])) {
$event['Event'][$object] = $event[$object];

View File

@ -166,7 +166,7 @@ class GalaxyCluster extends AppModel{
if (substr($eventTag['Tag']['name'], 0, strlen('misp-galaxy:')) === 'misp-galaxy:') {
$cluster = $this->getCluster($eventTag['Tag']['name']);
if ($cluster) {
$events[$k]['GalaxyCluster'] = $cluster['GalaxyCluster'];
$events[$k]['GalaxyCluster'][] = $cluster['GalaxyCluster'];
if ($replace) {
unset($events[$k]['EventTag'][$k2]);
}

View File

@ -23,6 +23,7 @@
endif;
?>
<th><?php echo $this->Paginator->sort('id');?></th>
<th>Clusters</th>
<?php if (Configure::read('MISP.tagging')): ?>
<th class="filter">Tags</th>
<?php endif; ?>
@ -90,6 +91,36 @@
<td style="width:30px;">
<a href="<?php echo $baseurl."/events/view/".$event['Event']['id'] ?>"><?php echo $event['Event']['id'];?></a>
</td>
<td class="shortish">
<?php
$clusterList = array();
$galaxyList = array();
$galaxy_id = 0;
if (isset($event['GalaxyCluster'])):
foreach ($event['GalaxyCluster'] as $cluster):
$galaxy_id = $cluster['Galaxy']['id'];
if (!isset($galaxyList[$cluster['Galaxy']['id']])) {
$galaxyList[$cluster['Galaxy']['id']] = $cluster['Galaxy']['name'];
}
$clusterList[$cluster['Galaxy']['id']][] = array('value' => $cluster['value'], 'id' => $cluster['id']);
endforeach;
endif;
foreach ($clusterList as $galaxy_id => $clusters):
?>
<span class="blue bold"><a href="<?php echo $baseurl; ?>/galaxies/view/<?php echo h($galaxy_id); ?>"><?php echo h($galaxyList[$galaxy_id]); ?></a>:</span>
<?php
foreach ($clusters as $cluster):
?>
<br />
<span class="blue">
&nbsp;&nbsp;&nbsp;&nbsp;
<a href="<?php echo $baseurl; ?>/galaxy_clusters/view/<?php echo h($cluster['id']); ?>"><?php echo h($cluster['value']); ?></a>
</span>
<?php
endforeach;
endforeach;
?>&nbsp;
</td>
<?php if (Configure::read('MISP.tagging')): ?>
<td style = "max-width: 200px;width:10px;">
<?php foreach ($event['EventTag'] as $tag):

View File

@ -5,6 +5,9 @@ foreach ($events as $key => $event) {
unset($events[$key]['Event']);
$events[$key]['Org'] = $event['Org'];
$events[$key]['Orgc'] = $event['Orgc'];
if (isset($event['GalaxyCluster'])) {
$events[$key]['GalaxyCluster'] = $event['GalaxyCluster'];
}
if (isset($event['EventTag'])) $events[$key]['EventTag'] = $event['EventTag'];
$events[$key]['SharingGroup'] = $event['SharingGroup'];