MISP/app/View/Events/view.ctp

391 lines
17 KiB
Plaintext
Raw Normal View History

<?php
$mayModify = (($isAclModify && $event['Event']['user_id'] == $me['id']) || ($isAclModifyOrg && $event['Event']['orgc'] == $me['org']));
$mayPublish = ($isAclPublish && $event['Event']['orgc'] == $me['org']);
?>
<div class="actions">
<ul>
<?php
if ($isSiteAdmin || $mayModify) {
?>
<li><?php echo $this->Html->link(__('Add Attribute', true), array('controller' => 'attributes', 'action' => 'add', $event['Event']['id']));?> </li>
<li><?php echo $this->Html->link(__('Add Attachment', true), array('controller' => 'attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li>
<li><?php echo $this->Html->link(__('Edit Event', true), array('action' => 'edit', $event['Event']['id'])); ?> </li>
<li><?php echo $this->Form->postLink(__('Delete Event'), array('action' => 'delete', $event['Event']['id']), null, __('Are you sure you want to delete # %s?', $event['Event']['id'])); ?></li>
<li>&nbsp;</li>
<?php
} else {
?>
<li><?php echo $this->Html->link(__('Propose Attribute', true), array('controller' => 'shadow_attributes', 'action' => 'add', $event['Event']['id']));?> </li>
<li><?php echo $this->Html->link(__('Propose Attachment', true), array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li>
<li>&nbsp;</li>
<?php
}
?>
</ul>
<?php
if ($isSiteAdmin || $mayModify): ?>
<ul><li><?php echo $this->Html->link('Add Attribute', array('controller' => 'attributes', 'action' => 'add', $event['Event']['id']));?>
<?php echo $this->Html->link('Add Attachment', array('controller' => 'attributes', 'action' => 'add_attachment', $event['Event']['id']));?>
<?php echo $this->Html->link('Populate event from IOC', array('controller' => 'events', 'action' => 'addIOC', $event['Event']['id']));?> </li></li></ul><br />
<?php else: ?>
<ul><li><?php echo $this->Html->link('Propose Attribute', array('controller' => 'shadow_attributes', 'action' => 'add', $event['Event']['id']));?></li>
<li><?php echo $this->Html->link(__('Propose Attachment', true), array('controller' => 'shadow_attributes', 'action' => 'add_attachment', $event['Event']['id']));?> </li></ul>
<?php
endif; ?>
<?php if ( 0 == $event['Event']['published'] && ($isAdmin || $mayPublish)):
2012-12-18 20:25:12 +01:00
// only show button if alert has not been sent // LATER show the ALERT button in red-ish
?>
<ul><li><?php
if ($isSiteAdmin || $mayPublish) {
2012-12-18 20:25:12 +01:00
echo $this->Form->postLink('Publish Event', array('action' => 'alert', $event['Event']['id']), null, 'Are you sure this event is complete and everyone should be informed?');
echo $this->Form->postLink('Publish (no email)', array('action' => 'publish', $event['Event']['id']), null, 'Publish but do NOT send alert email? Only for minor changes!');
}
?> </li></ul>
<?php elseif (0 == $event['Event']['published']): ?>
2012-12-18 20:25:12 +01:00
<ul><li>Not published</li></ul>
<?php else: ?>
2012-12-18 20:25:12 +01:00
<!-- ul><li>Alert already sent</li></ul -->
<?php
endif; ?>
<br />
<ul><li><?php echo $this->Html->link(__('Contact reporter', true), array('action' => 'contact', $event['Event']['id'])); ?> </li></ul><br />
<ul><li><?php echo $this->Html->link(__('Download as XML', true), array('action' => 'xml', 'download', $event['Event']['id'])); ?>
<?php echo $this->Html->link(__('Download as IOC', true), array('action' => 'downloadOpenIOCEvent', $event['Event']['id'])); ?> </li></ul>
2011-11-26 10:45:31 +01:00
</div>
<div class="events view">
<?php if ('true' == Configure::read('CyDefSIG.showorg') || $isAdmin): ?><?php echo $this->element('img', array('id' => $event['Event']['orgc']));?><?php
2012-12-18 20:25:12 +01:00
endif; ?>
<h2>Event</h2>
<dl>
<dt>ID</dt>
<dd>
<?php echo h($event['Event']['id']); ?>
2012-01-05 11:03:51 +01:00
&nbsp;
</dd>
<dt>Uuid</dt>
<dd>
<?php echo h($event['Event']['uuid']); ?>
&nbsp;
</dd>
2012-03-06 07:45:02 +01:00
<?php if ('true' == Configure::read('CyDefSIG.showorg') || $isAdmin): ?>
<dt>Org</dt>
<dd>
<?php echo h($event['Event']['orgc']); ?>
&nbsp;
</dd>
<?php
endif; ?>
<?php if ($isSiteAdmin): ?>
<dt>Owner org</dt>
<dd>
<?php echo h($event['Event']['org']); ?>
2011-11-26 10:45:31 +01:00
&nbsp;
</dd>
2012-12-18 20:25:12 +01:00
<?php
endif; ?>
<?php if ($isSiteAdmin || ($isAdmin && $me['org'] == $event['Event']['org'])): ?>
2012-07-19 14:53:12 +02:00
<dt>Email</dt>
<dd>
<?php echo h($event['User']['email']); ?>
&nbsp;
</dd>
2012-12-18 20:25:12 +01:00
<?php
endif; ?>
<dt>Date</dt>
<dd>
<?php echo h($event['Event']['date']); ?>
2011-11-26 10:45:31 +01:00
&nbsp;
</dd>
<dt<?php echo ' title="' . $eventDescriptions['risk']['desc'] . '"';?>>Risk</dt>
<dd>
2013-04-22 15:22:20 +02:00
<?php echo h($event['Event']['risk']); ?>
2011-11-26 10:45:31 +01:00
&nbsp;
</dd>
<dt<?php echo ' title="' . $eventDescriptions['analysis']['desc'] . '"';?>>Analysis</dt>
<dd>
2013-04-22 15:22:20 +02:00
<?php echo h($analysisLevels[$event['Event']['analysis']]); ?>
&nbsp;
</dd>
<dt>Distribution</dt>
<dd>
2013-04-22 15:22:20 +02:00
<?php echo h($event['Event']['distribution'] . ', ' . strtolower(substr(($distributionDescriptions[$event['Event']['distribution']]['formdesc']), 0, 1)) . substr($distributionDescriptions[$event['Event']['distribution']]['formdesc'], 1) . '.'); ?>
&nbsp;
</dd>
2012-03-20 13:40:58 +01:00
<!-- dt>UUID</dt>
<dd>
2013-04-22 15:22:20 +02:00
<?php echo h($event['Event']['uuid']); ?>
2012-03-20 13:40:58 +01:00
&nbsp;
</dd -->
<dt>Info</dt>
<dd>
2013-04-22 15:22:20 +02:00
<?php echo nl2br(h($event['Event']['info'])); ?>
2011-11-26 10:45:31 +01:00
&nbsp;
</dd>
</dl><br />
2012-12-18 20:25:12 +01:00
<?php
if (!empty($relatedEvents)):?>
<div class="related">
<h3>Related Events</h3>
<ul>
2012-12-18 20:25:12 +01:00
<?php
foreach ($relatedEvents as $relatedEvent): ?>
<li><?php
$linkText = $relatedEvent['Event']['date'] . ' (' . $relatedEvent['Event']['id'] . ')';
echo "<div \" title = \"".h($relatedEvent['Event']['info'])."\">";
if ($relatedEvent['Event']['org'] == $me['org']) {
echo $this->Html->link($linkText, array('controller' => 'events', 'action' => 'view', $relatedEvent['Event']['id']), array('class' => 'SameOrgLink'));
} else {
echo $this->Html->link($linkText, array('controller' => 'events', 'action' => 'view', $relatedEvent['Event']['id']));
}
2013-04-22 15:22:20 +02:00
?></div></li>
2012-12-18 20:25:12 +01:00
<?php
endforeach; ?>
</ul>
</div><br />
2012-12-18 20:25:12 +01:00
<?php
endif; ?>
<div class="related">
<h3>Attributes</h3>
2012-12-18 20:25:12 +01:00
<?php
if (!empty($event['Attribute'])):?>
2013-05-30 16:40:47 +02:00
<table cellpadding="0" cellspacing="0" class="table table-striped table-condensed">
<tr>
<th>Category</th>
<th>Type</th>
<th>Value</th>
<th>Related Events</th>
<th <?php echo "title='" . $attrDescriptions['signature']['desc'] . "'";?>>IDS Signature</th>
<th <?php echo "title='" . $attrDescriptions['private']['desc'] . "'";?>>Distribution</th>
<th class="actions">Actions</th>
</tr><?php
2012-12-18 20:25:12 +01:00
foreach ($categories as $category):
$first = 1;
foreach ($event['Attribute'] as $attribute):
$extra = "";
if ($attribute['category'] != $category) continue;
if (count($attribute['ShadowAttribute'])) $extra .= 'highlightGreen highlightTop';
?>
<tr>
<td class= "short <?php echo $extra; if ($extra != "") echo ' highlightLeft'; ?>" title="<?php if('' != $attribute['category']) echo $categoryDefinitions[$attribute['category']]['desc'];?>"><?php
if ($first) {
if ('' == $attribute['category']) echo '(no category)';
echo h($attribute['category']);
} else {
echo '&nbsp;';
}?></td>
<td class= "short <?php echo $extra; ?>" title="<?php
echo $typeDefinitions[$attribute['type']]['desc'];?>"><?php
echo h($attribute['type']);?></td>
<td class= "short <?php echo $extra; ?>"><?php
$sigDisplay = $attribute['value'];
if ('attachment' == $attribute['type'] || 'malware-sample' == $attribute['type'] ) {
$filenameHash = explode('|', $attribute['value']);
if (strrpos($filenameHash[0], '\\')) {
$filepath = substr($filenameHash[0], 0, strrpos($filenameHash[0], '\\'));
$filename = substr($filenameHash[0], strrpos($filenameHash[0], '\\'));
echo h($filepath);
echo $this->Html->link($filename, array('controller' => 'attributes', 'action' => 'download', $attribute['id']));
} else {
echo $this->Html->link($filenameHash[0], array('controller' => 'attributes', 'action' => 'download', $attribute['id']));
}
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
} elseif (strpos($attribute['type'], '|') !== false) {
$filenameHash = explode('|', $attribute['value']);
echo h($filenameHash[0]);
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
} elseif ('vulnerability' == $attribute['type']) {
echo $this->Html->link(h($sigDisplay), 'http://www.google.com/search?q=' . h($sigDisplay), array('target' => '_blank'));
} elseif ('link' == $attribute['type']) {
echo $this->Html->link(h($sigDisplay), h($sigDisplay));
} else {
echo nl2br(h($sigDisplay));
}
?></td>
<td class= "short <?php echo $extra; ?>">
<?php
$first = 0;
if (isset($relatedAttributes[$attribute['id']]) && (null != $relatedAttributes[$attribute['id']])) {
foreach ($relatedAttributes[$attribute['id']] as $relatedAttribute) {
echo '<span title="'.h($relatedAttribute['info']).'">';
if ($relatedAttribute['org'] == $me['org']) {
echo $this->Html->link($relatedAttribute['id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['id']), array ('class' => 'SameOrgLink'));
} else {
echo $this->Html->link($relatedAttribute['id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['id']));
2013-04-22 15:04:27 +02:00
}
echo "</span>";
echo ' ';
2012-12-18 20:25:12 +01:00
}
}
?>&nbsp;
</td>
<td class= "short <?php echo $extra; ?>"><?php echo $attribute['to_ids'] ? 'Yes' : 'No';?></td>
<td class= "short <?php echo $extra; ?>"><?php echo $attribute['distribution'] != 'All communities' ? $attribute['distribution'] : 'All';?></td>
<td class = "actions <?php echo $extra; if ($extra != '') echo ' highlightRight'; ?>">
<?php
if ($isSiteAdmin || $mayModify) {
echo $this->Html->link('', array('controller' => 'attributes', 'action' => 'edit', $attribute['id']), array('class' => 'icon-edit', 'title' => 'Edit'));
echo $this->Form->postLink('', array('controller' => 'attributes', 'action' => 'delete', $attribute['id']), array('class' => 'icon-trash', 'title' => 'Delete'), __('Are you sure you want to delete this attribute? Keep in mind that this will also delete this attribute on remote MISP instances.'));
} else {
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'edit', $attribute['id']), array('class' => 'icon-edit', 'title' => 'Propose Edit'));
}
?>
</td>
</tr>
2012-12-18 20:25:12 +01:00
<?php
// Create an entry for each shadow attribute right below the attribute that it proposes to edit
// $extra is used for extra style code added to cells that have a highlighting border around them.
$extra = null;
foreach ($attribute['ShadowAttribute'] as $shadowAttribute):
if ($shadowAttribute === end($attribute['ShadowAttribute'])) $extra = 'highlightBottom';
?>
<tr>
<td class="highlightLeft highlightRed <?php echo $extra; ?>" title="<?php if('' != $shadowAttribute['category']) echo $categoryDefinitions[$shadowAttribute['category']]['desc'];?>">
<?php
if ($shadowAttribute['category'] != $attribute['category']) echo h($shadowAttribute['category']);
?>
</td>
<td class="short highlightRed <?php echo $extra; ?>" title="
<?php
echo $typeDefinitions[$shadowAttribute['type']]['desc'];
?>
">
<?php
if ($shadowAttribute['type'] != $attribute['type']) echo h($shadowAttribute['type']);
?>
</td>
<td class = "<?php echo $extra; ?> highlightRed">
<?php
if ($shadowAttribute['value'] != $attribute['value']) {
$sigDisplay = $shadowAttribute['value'];
if ('attachment' == $shadowAttribute['type'] || 'malware-sample' == $shadowAttribute['type'] ) {
$filenameHash = explode('|', $shadowAttribute['value']);
if (strrpos($filenameHash[0], '\\')) {
$filepath = substr($filenameHash[0], 0, strrpos($filenameHash[0], '\\'));
$filename = substr($filenameHash[0], strrpos($filenameHash[0], '\\'));
echo $filepath;
echo $this->Html->link($filename, array('controller' => 'attributes', 'action' => 'download', $shadowAttribute['id']));
} else {
echo $this->Html->link($filenameHash[0], array('controller' => 'attributes', 'action' => 'download', $shadowAttribute['id']));
}
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
} elseif (strpos($shadowAttribute['type'], '|') !== false) {
$filenameHash = explode('|', $shadowAttribute['value']);
echo h($filenameHash[0]);
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
} elseif ('vulnerability' == $shadowAttribute['type']) {
echo $this->Html->link(h($sigDisplay), 'http://www.google.com/search?q=' . h($sigDisplay), array('target' => '_blank'));
} elseif ('link' == $shadowAttribute['type']) {
echo $this->Html->link(h($sigDisplay), h($sigDisplay));
} else {
echo h($sigDisplay);
}
}
?>
</td>
<td class="short <?php echo $extra; ?> highlightRed">
</td>
<td class="short <?php echo $extra; ?> highlightRed">
<?php
if ($shadowAttribute['to_ids'] != $attribute['to_ids']) echo $shadowAttribute['to_ids'] ? 'Yes' : 'No';
?></td>
<td class="short <?php echo $extra; ?> highlightRed"></td>
<td class="actions highlightRight <?php echo $extra; ?> highlightRed">
<?php
if (($event['Event']['org'] == $me['org'] && $mayPublish) || $isSiteAdmin) {
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'accept', $shadowAttribute['id']), array('class' => 'icon-ok', 'title' => 'Accept'));
}
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'discard', $shadowAttribute['id']), array('class' => 'icon-trash', 'title' => 'Discard'));
?>
</td>
</tr>
<?php
endforeach;
endforeach;
endforeach;
2011-11-26 10:45:31 +01:00
// As a last step, attributes that have been proposed by users of other organisations to be added to an event are listed at the end
$first = true;
if (isset($remaining)):
foreach ($remaining as $remain):
$extra = 'highlightRed';
if ($first) {
$extra .= ' highlightTop';
$first = false;
}
if ($remain === end($remaining)) $extra .= ' highlightBottom';
?>
<tr>
<td class="highlightLeft <?php echo $extra; ?>" title="<?php if('' != $remain['ShadowAttribute']['category']) echo $categoryDefinitions[$remain['ShadowAttribute']['category']]['desc'];?>">
<?php
echo h($remain['ShadowAttribute']['category']);
?>
</td>
<td class="short <?php echo $extra; ?>" title="
<?php
echo $typeDefinitions[$remain['ShadowAttribute']['type']]['desc'];
?>
">
<?php
echo h($remain['ShadowAttribute']['type']);
?>
</td>
<td class = "short <?php echo $extra; ?>">
<?php
$sigDisplay = nl2br(h($remain['ShadowAttribute']['value']));
if ('attachment' == $remain['ShadowAttribute']['type'] || 'malware-sample' == $remain['ShadowAttribute']['type'] ) {
$filenameHash = explode('|', $remain['ShadowAttribute']['value']);
if (strrpos($filenameHash[0], '\\')) {
$filepath = substr($filenameHash[0], 0, strrpos($filenameHash[0], '\\'));
$filename = substr($filenameHash[0], strrpos($filenameHash[0], '\\'));
echo $filepath;
echo $this->Html->link($filename, array('controller' => 'shadow_attributes', 'action' => 'download', $remain['ShadowAttribute']['id']));
} else {
echo $this->Html->link($filenameHash[0], array('controller' => 'shadow_attributes', 'action' => 'download', $remain['ShadowAttribute']['id']));
}
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
} elseif (strpos($remain['ShadowAttribute']['type'], '|') !== false) {
$filenameHash = explode('|', $remain['ShadowAttribute']['value']);
echo h($filenameHash[0]);
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
} elseif ('vulnerability' == $remain['ShadowAttribute']['type']) {
echo $this->Html->link(h($sigDisplay), 'http://www.google.com/search?q=' . h($sigDisplay), array('target' => '_blank'));
} elseif ('link' == $remain['ShadowAttribute']['type']) {
echo $this->Html->link(h($sigDisplay), h($sigDisplay));
} else {
echo h($sigDisplay);
}
?>
</td>
<td class="short <?php echo $extra; ?>">
</td>
<td class="short <?php echo $extra; ?>">
<?php
echo $remain['ShadowAttribute']['to_ids'] ? 'Yes' : 'No';
?></td>
<td class="short <?php echo $extra; ?>"></td>
<td class="actions highlightRight <?php echo $extra; ?>">
<?php
if (($event['Event']['org'] == $me['org'] && $mayPublish) || $isSiteAdmin) {
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'accept', $remain['ShadowAttribute']['id']), array('class' => 'icon-ok', 'title' => 'Accept'));
}
echo $this->Html->link('', array('controller' => 'shadow_attributes', 'action' => 'discard',$remain['ShadowAttribute']['id']), array('class' => 'icon-trash', 'title' => 'Discard'));
?>
</td>
</tr>
<?php
endforeach;
endif;
?>
</table>
<?php
endif; ?>
</div>