mirror of https://github.com/MISP/MISP
chg: [UI] Use standard way how to show attribute values for resolved results
parent
6fb78f8b77
commit
799f8bfb45
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
$sigDisplay = $object['value'];
|
||||
|
||||
$truncateLongText = function ($text, $maxLength = 500, $maxLines = 10) {
|
||||
$truncated = false;
|
||||
if (mb_strlen($text) > $maxLength) {
|
||||
|
@ -20,6 +18,10 @@ $truncateLongText = function ($text, $maxLength = 500, $maxLines = 10) {
|
|||
return null;
|
||||
};
|
||||
|
||||
if (!isset($linkClass)) {
|
||||
$linkClass = null;
|
||||
}
|
||||
|
||||
switch ($object['type']) {
|
||||
case 'attachment':
|
||||
case 'malware-sample':
|
||||
|
@ -43,9 +45,13 @@ switch ($object['type']) {
|
|||
$filename = $filenameHash[0];
|
||||
}
|
||||
|
||||
$controller = isset($object['objectType']) && $object['objectType'] === 'proposal' ? 'shadow_attributes' : 'attributes';
|
||||
$url = array('controller' => $controller, 'action' => 'download', $object['id']);
|
||||
echo $this->Html->link($filename, $url, array('class' => $linkClass));
|
||||
if (isset($object['objectType'])) {
|
||||
$controller = $object['objectType'] === 'proposal' ? 'shadow_attributes' : 'attributes';
|
||||
$url = array('controller' => $controller, 'action' => 'download', $object['id']);
|
||||
echo $this->Html->link($filename, $url, array('class' => $linkClass));
|
||||
} else {
|
||||
echo $filename;
|
||||
}
|
||||
if (isset($filenameHash[1])) {
|
||||
echo '<br>' . $filenameHash[1];
|
||||
}
|
||||
|
@ -54,17 +60,27 @@ switch ($object['type']) {
|
|||
|
||||
case 'vulnerability':
|
||||
$cveUrl = Configure::read('MISP.cveurl') ?: 'https://cve.circl.lu/cve/';
|
||||
echo $this->Html->link($sigDisplay, $cveUrl . $sigDisplay, ['target' => '_blank', 'class' => $linkClass, 'rel' => 'noreferrer noopener']);
|
||||
echo $this->Html->link($object['value'], $cveUrl . $object['value'], [
|
||||
'target' => '_blank',
|
||||
'class' => $linkClass,
|
||||
'rel' => 'noreferrer noopener',
|
||||
'title' => __('Show more information about this vulnerability in external tool'),
|
||||
]);
|
||||
break;
|
||||
|
||||
case 'weakness':
|
||||
$cweUrl = Configure::read('MISP.cweurl') ?: 'https://cve.circl.lu/cwe/';
|
||||
$link = $cweUrl . explode("-", $sigDisplay)[1];
|
||||
echo $this->Html->link($sigDisplay, $link, ['target' => '_blank', 'class' => $linkClass, 'rel' => 'noreferrer noopener']);
|
||||
$link = $cweUrl . explode("-", $object['value'])[1];
|
||||
echo $this->Html->link($object['value'], $link, [
|
||||
'target' => '_blank',
|
||||
'class' => $linkClass,
|
||||
'rel' => 'noreferrer noopener',
|
||||
'title' => __('Show more information about this weakness in external tool'),
|
||||
]);
|
||||
break;
|
||||
|
||||
case 'link':
|
||||
echo $this->Html->link($sigDisplay, $sigDisplay, ['class' => $linkClass, 'rel' => 'noreferrer noopener']);
|
||||
echo $this->Html->link($object['value'], $object['value'], ['class' => $linkClass, 'rel' => 'noreferrer noopener']);
|
||||
break;
|
||||
|
||||
case 'cortex':
|
||||
|
@ -76,20 +92,20 @@ switch ($object['type']) {
|
|||
$url = array('controller' => 'events', 'action' => 'view', $object['value']);
|
||||
echo $this->Html->link($object['value'], $url, array('class' => $linkClass));
|
||||
} else {
|
||||
$sigDisplay = str_replace("\r", '', $sigDisplay);
|
||||
$truncated = $truncateLongText($sigDisplay);
|
||||
$value = str_replace("\r", '', $object['value']);
|
||||
$truncated = $truncateLongText($value);
|
||||
if ($truncated) {
|
||||
echo '<span data-full="' . h($sigDisplay) .'" data-full-type="text">' .
|
||||
str_replace(" ", ' ', h($truncated));
|
||||
echo '<span data-full="' . h($object['value']) .'" data-full-type="text">' .
|
||||
str_replace(" ", ' ', h(rtrim($truncated)));
|
||||
echo ' <b>…</b><br><a href="#">' . __('Show all') . '</a></span>';
|
||||
} else {
|
||||
echo str_replace(" ", ' ', h($sigDisplay));
|
||||
echo str_replace(" ", ' ', h($value));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'hex':
|
||||
echo '<span class="hex-value" title="' . __('Hexadecimal representation') . '">' . h($sigDisplay) . '</span> ';
|
||||
echo '<span class="hex-value" title="' . __('Hexadecimal representation') . '">' . h($object['value']) . '</span> ';
|
||||
echo '<span role="button" tabindex="0" aria-label="' . __('Switch to binary representation') . '" class="fas fa-redo hex-value-convert useCursorPointer" title="' . __('Switch to binary representation') . '"></span>';
|
||||
break;
|
||||
|
||||
|
@ -106,8 +122,8 @@ switch ($object['type']) {
|
|||
|
||||
/** @noinspection PhpMissingBreakStatementInspection */
|
||||
case 'domain':
|
||||
if (strpos($sigDisplay, 'xn--') !== false && function_exists('idn_to_utf8')) {
|
||||
echo '<span title="' . h(idn_to_utf8($sigDisplay)) . '">' . h($sigDisplay) . '</span>';
|
||||
if (strpos($object['value'], 'xn--') !== false && function_exists('idn_to_utf8')) {
|
||||
echo '<span title="' . h(idn_to_utf8($object['value'])) . '">' . h($object['value']) . '</span>';
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -119,15 +135,15 @@ switch ($object['type']) {
|
|||
}
|
||||
echo implode('<br>', $valuePieces);
|
||||
} else {
|
||||
$sigDisplay = str_replace("\r", '', $sigDisplay);
|
||||
$truncated = $truncateLongText($sigDisplay);
|
||||
$value = str_replace("\r", '', $object['value']);
|
||||
$truncated = $truncateLongText($value);
|
||||
if ($truncated) {
|
||||
$rawTypes = ['email-header', 'yara', 'pgp-private-key', 'pgp-public-key', 'url'];
|
||||
$dataFullType = in_array($object['type'], $rawTypes) ? 'raw' : 'text';
|
||||
echo '<span data-full="' . h($sigDisplay) .'" data-full-type="' . $dataFullType .'">' . h($truncated) .
|
||||
echo '<span data-full="' . h($value) .'" data-full-type="' . $dataFullType .'">' . h(rtrim($truncated)) .
|
||||
' <b>…</b><br><a href="#">' . __('Show all') . '</a></span>';
|
||||
} else {
|
||||
echo h($sigDisplay);
|
||||
echo h($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="index">
|
||||
<div class="index" style="margin-bottom: 2em">
|
||||
<h2><?php echo h($title); ?></h2>
|
||||
<?php
|
||||
$event_id = $event['Event']['id'];
|
||||
|
@ -31,13 +31,15 @@
|
|||
if (empty($objects_array)) {
|
||||
echo '<p>Results from the enrichment module for this attribute are empty.</p>';
|
||||
} else {
|
||||
$scope = join(' and ', $objects_array);
|
||||
$scope = implode(' and ', $objects_array);
|
||||
echo '<p>Below you can see the ' . $scope . ' that are to be created from the results of the enrichment module.</p>';
|
||||
$table_data = array(array('key' => __('Event ID'), 'value' => $event_id));
|
||||
$event_metadata = $event['Event'];
|
||||
if (!empty($event_metadata['uuid'])) {
|
||||
$table_data[] = array('key' => __('Event UUID'),
|
||||
'value' => $event_metadata['uuid']);
|
||||
$table_data[] = array(
|
||||
'key' => __('Event UUID'),
|
||||
'html' => '<span class="quickSelect">'. h($event_metadata['uuid']) . '</span>',
|
||||
);
|
||||
}
|
||||
if (!empty($event_metadata['orgc_id']) && !empty($event_metadata['orgc_name'])) {
|
||||
$table_data[] = array('key' => __('Event creator org'), 'html' => sprintf(
|
||||
|
@ -82,7 +84,7 @@
|
|||
$typesWithData = array('attachment', 'malware-sample');
|
||||
if (!empty($event['Object'])) {
|
||||
?>
|
||||
<table class='table table-striped table-condensed'>
|
||||
<table class="table table-striped table-condensed">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?php echo __('Import');?></th>
|
||||
|
@ -100,8 +102,8 @@
|
|||
$header_present = true;
|
||||
foreach ($event['Object'] as $o => $object) {
|
||||
?>
|
||||
<tbody class='MISPObject'>
|
||||
<tr class='tableHighlightBorderTop borderBlue blueRow' tabindex='0'>
|
||||
<tbody class="MISPObject">
|
||||
<tr class="tableHighlightBorderTop borderBlue blueRow" tabindex="0">
|
||||
<td class="short" style="width:40px;text-align:center;">
|
||||
<input type="checkbox" class="ImportMISPObject" checked />
|
||||
</td>
|
||||
|
@ -202,10 +204,10 @@
|
|||
<td class="short" style="width:40px;text-align:center;"><input type="checkbox" class="ImportMISPObjectAttribute" checked /></td>
|
||||
<td class="ObjectCategory"><?php echo (isset($attribute['category']) ? h($attribute['category']) : ''); ?></td>
|
||||
<td class="short">
|
||||
<span class="ObjectRelation bold"><?php echo h($attribute['object_relation']); ?></span>:
|
||||
<span class="ObjectRelation bold"><?php echo h($attribute['object_relation']); ?></span>
|
||||
<span class="AttributeType"><?php echo h($attribute['type']); ?></span>
|
||||
</td>
|
||||
<td class="AttributeValue limitedWidth"><?php echo h($attribute['value']); ?></td>
|
||||
<td class="AttributeValue limitedWidth"><?= $this->element('Events/View/value_field', ['object' => $attribute]); ?></td>
|
||||
<?php
|
||||
if (in_array($attribute['type'], $typesWithData)) {
|
||||
if (!empty($attribute['data'])) {
|
||||
|
@ -268,7 +270,7 @@
|
|||
echo '</tr>';
|
||||
}
|
||||
}
|
||||
echo '<tr><td colspan="9" /></tr>';
|
||||
echo '<tr><td colspan="9"></td></tr>';
|
||||
?>
|
||||
</tbody>
|
||||
<?php
|
||||
|
@ -315,7 +317,7 @@
|
|||
}
|
||||
}
|
||||
?>
|
||||
<td class="AttributeValue limitedWidth"><?php echo h($attribute['value']); ?></td>
|
||||
<td class="AttributeValue limitedWidth"><?= $this->element('Events/View/value_field', ['object' => $attribute]); ?></td>
|
||||
<?php
|
||||
if (in_array($attribute['type'], $typesWithData)) {
|
||||
if (!empty($attribute['data'])) {
|
||||
|
@ -381,32 +383,23 @@
|
|||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<span>
|
||||
<button class="btn btn-primary" style="float:left;" onClick="moduleResultsSubmit('<?php echo h($event_id); ?>');"><?php echo __('Submit'); ?></button>
|
||||
<a href="<?php echo $baseurl . '/events/view/' . h($event['Event']['id']); ?>" style="margin-left:10px;" class="btn btn-inverse"><?php echo __('Cancel');?></a>
|
||||
</span>
|
||||
|
||||
<button class="btn btn-primary" style="float:left;" onClick="moduleResultsSubmit('<?php echo h($event_id); ?>');"><?php echo __('Submit'); ?></button>
|
||||
<a href="<?php echo $baseurl . '/events/view/' . h($event['Event']['id']); ?>" style="margin-left:10px;" class="btn btn-inverse"><?php echo __('Cancel');?></a>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$('.AttributeDistribution').change(function() {
|
||||
$(function() {
|
||||
$('.AttributeDistribution, .ObjectDistribution').change(function() {
|
||||
if ($(this).val() == 4) {
|
||||
$(this).next().show();
|
||||
} else {
|
||||
$(this).next().hide();
|
||||
}
|
||||
});
|
||||
$('.ObjectDistribution').change(function() {
|
||||
if ($(this).val() == 4) {
|
||||
$(this).next().show();
|
||||
} else {
|
||||
$(this).next().hide();
|
||||
}
|
||||
});
|
||||
}).change();
|
||||
});
|
||||
</script>
|
||||
<?php
|
||||
if (!isset($menuItem)) {
|
||||
$menuItem = 'freetextResults';
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event', 'menuItem' => $menuItem));
|
||||
?>
|
||||
if (!isset($menuItem)) {
|
||||
$menuItem = 'freetextResults';
|
||||
}
|
||||
echo $this->element('/genericElements/SideMenu/side_menu', array('menuList' => 'event', 'menuItem' => $menuItem));
|
||||
|
|
Loading…
Reference in New Issue