mirror of https://github.com/MISP/MISP
new: screenshot preview in the event view
parent
64300fdf6b
commit
10593914f8
|
@ -2638,6 +2638,9 @@ class Event extends AppModel {
|
|||
else $attribute['hasChildren'] = 0;
|
||||
if ($filterType === 'proposal' && $attribute['hasChildren'] == 0) continue;
|
||||
if ($filterType === 'correlation' && !in_array($attribute['id'], $correlatedAttributes)) continue;
|
||||
if ($attribute['type'] == 'attachment' && preg_match('/.*\.(jpg|png|jpeg|gif)$/i', $attribute['value'])) {
|
||||
$attribute['image'] = $this->Attribute->base64EncodeAttachment($attribute);
|
||||
}
|
||||
$eventArray[] = $attribute;
|
||||
}
|
||||
unset($event['Attribute']);
|
||||
|
@ -2646,6 +2649,9 @@ class Event extends AppModel {
|
|||
if ($filterType === 'correlation' && !in_array($shadowAttribute['id'], $correlatedShadowAttributes)) continue;
|
||||
if ($filterType && !in_array($filterType, array('proposal', 'correlation', 'warning'))) if (!in_array($attribute['type'], $this->Attribute->typeGroupings[$filterType])) continue;
|
||||
$shadowAttribute['objectType'] = 2;
|
||||
if ($shadowAttribute['type'] == 'attachment' && preg_match('/.*\.(jpg|png|jpeg|gif)$/i', $shadowAttribute['value'])) {
|
||||
$shadowAttribute['image'] = $this->ShadowAttribute->base64EncodeAttachment($attribute);
|
||||
}
|
||||
$eventArray[] = $shadowAttribute;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,17 +257,25 @@
|
|||
<?php
|
||||
$sigDisplay = $object['value'];
|
||||
if ('attachment' == $object['type'] || 'malware-sample' == $object['type'] ) {
|
||||
$t = ($object['objectType'] == 0 ? 'attributes' : 'shadow_attributes');
|
||||
$filenameHash = explode('|', nl2br(h($object['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' => $t, 'action' => 'download', $object['id']));
|
||||
if ($object['type'] == 'attachment' && isset($object['image'])) {
|
||||
$extension = explode('.', $object['value']);
|
||||
$extension = end($extension);
|
||||
$uri = 'data:image/' . strtolower(h($extension)) . ';base64,' . h($object['image']);
|
||||
$img = '<img src="' . $uri . '" style="width:200px;" title="' . h($object['value']) . '" />';
|
||||
echo '<a href="' . $baseurl . '/' . ($object['objectType'] == 0 ? 'attributes' : 'shadow_attributes') . '/download/' . h($object['id']) . '">' . $img . '</a>';
|
||||
} else {
|
||||
echo $this->Html->link($filenameHash[0], array('controller' => $t, 'action' => 'download', $object['id']));
|
||||
$t = ($object['objectType'] == 0 ? 'attributes' : 'shadow_attributes');
|
||||
$filenameHash = explode('|', nl2br(h($object['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' => $t, 'action' => 'download', $object['id']));
|
||||
} else {
|
||||
echo $this->Html->link($filenameHash[0], array('controller' => $t, 'action' => 'download', $object['id']));
|
||||
}
|
||||
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
|
||||
}
|
||||
if (isset($filenameHash[1])) echo ' | ' . $filenameHash[1];
|
||||
} else if (strpos($object['type'], '|') !== false) {
|
||||
$filenameHash = explode('|', $object['value']);
|
||||
echo h($filenameHash[0]);
|
||||
|
|
Loading…
Reference in New Issue