From 8cd31dd76c68a474ab3282ddfc7643669fded85c Mon Sep 17 00:00:00 2001 From: iglocska Date: Wed, 2 Aug 2017 23:01:12 +0200 Subject: [PATCH] new: Further work on the object UI - refactoring - added objects fields to object rows - nested rows within the object - massive cleanup --- app/Controller/ObjectsController.php | 1 - app/Model/Event.php | 222 ++++++--- app/Model/Warninglist.php | 17 + .../Elements/Events/View/row_attribute.ctp | 256 +++++++++++ app/View/Elements/Events/View/row_object.ctp | 60 +++ .../Elements/Events/View/row_proposal.ctp | 316 +++++++++++++ .../Events/View/row_proposal_delete.ctp | 60 +++ .../Elements/Events/View/sighting_field.ctp | 35 ++ app/View/Elements/Events/View/value_field.ctp | 49 ++ app/View/Elements/ajaxTags.ctp | 2 +- app/View/Elements/eventattribute.ctp | 434 +----------------- app/webroot/css/main.css | 138 +++++- 12 files changed, 1113 insertions(+), 477 deletions(-) create mode 100644 app/View/Elements/Events/View/row_attribute.ctp create mode 100644 app/View/Elements/Events/View/row_object.ctp create mode 100644 app/View/Elements/Events/View/row_proposal.ctp create mode 100644 app/View/Elements/Events/View/row_proposal_delete.ctp create mode 100644 app/View/Elements/Events/View/sighting_field.ctp create mode 100644 app/View/Elements/Events/View/value_field.ctp diff --git a/app/Controller/ObjectsController.php b/app/Controller/ObjectsController.php index 7d8c102c6..30fd38b87 100644 --- a/app/Controller/ObjectsController.php +++ b/app/Controller/ObjectsController.php @@ -209,7 +209,6 @@ class ObjectsController extends AppController { } } - $this->set('enabledRows', $enabledRows); $distributionData = $this->MispObject->Event->Attribute->fetchDistributionData($this->Auth->user()); $this->set('distributionData', $distributionData); diff --git a/app/Model/Event.php b/app/Model/Event.php index 7dfd1e4bc..b37f1b551 100755 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -53,6 +53,8 @@ class Event extends AppModel { 0 => 'Your organisation only', 1 => 'This community only', 2 => 'Connected communities', 3 => 'All communities', 4 => 'Sharing group' ); + private $__fTool = false; + public $shortDist = array(0 => 'Organisation', 1 => 'Community', 2 => 'Connected', 3 => 'All', 4 => ' sharing Group'); public $export_types = array( @@ -3114,8 +3116,128 @@ class Event extends AppModel { return time() - ($delta * $multiplier); } + private function __prepareAttributeForView( + $attribute, + $correlatedAttributes, + $correlatedShadowAttributes, + $filterType = false, + $eventWarnings, + $warningLists + ) { + $attribute['objectType'] = 'attribute'; + $include = true; + if ($filterType && !in_array($filterType, array('proposal', 'correlation', 'warning'))) { + if (!in_array($attribute['type'], $this->Attribute->typeGroupings[$filterType])) { + $include = false; + } + } + if ($filterType === 'proposal' && empty($attribute['ShadowAttribute'])) { + $include = false; + } + if ($filterType === 'correlation' && !in_array($attribute['id'], $correlatedAttributes)) { + $include = false; + } + if (!empty($attribute['ShadowAttribute'])) { + $temp = array(); + foreach ($attribute['ShadowAttribute'] as $k => $proposal) { + $result = $this->__prepareProposalForView( + $proposal, + $correlatedShadowAttributes, + false, + $eventWarnings, + $warningLists + ); + $temp[] = $result['data']; + } + $attribute['ShadowAttribute'] = $temp; + } + $attribute = $this->__prepareGenericForView($attribute, $eventWarnings, $warningLists); + return array('include' => $include, 'data' => $attribute); + } + + private function __prepareProposalForView( + $proposal, + $correlatedShadowAttributes, + $filterType = false, + $eventWarnings, + $warningLists + ) { + if ($proposal['proposal_to_delete']) { + $proposal['objectType'] = 'proposal_delete'; + } else { + $proposal['objectType'] = 'proposal'; + } + + $include = true; + if ($filterType === 'correlation' && !in_array($proposal['id'], $correlatedShadowAttributes)) { + $include = false; + } + if ($filterType && !in_array($filterType, array('proposal', 'correlation', 'warning'))) { + if (!in_array($attribute['type'], $this->Attribute->typeGroupings[$filterType])) { + $include = false; + } + } + $proposal = $this->__prepareGenericForView($proposal, $eventWarnings, $warningLists); + return array('include' => $include, 'data' => $proposal); + } + + private function __prepareObjectForView( + $object, + $correlatedAttributes, + $correlatedShadowAttributes, + $filterType = false, + $eventWarnings, + $warningLists + ) { + $object['category'] = $object['meta-category']; + $proposal['objectType'] = 'object'; + // filters depend on child objects + $include = empty($filterType) || $filterType == 'object'; + if (!empty($object['Attribute'])) { + $temp = array(); + foreach ($object['Attribute'] as $k => $proposal) { + $result = $this->__prepareAttributeForView( + $proposal, + $correlatedAttributes, + $correlatedShadowAttributes, + $filterType, + $eventWarnings, + $warningLists + ); + $include = $include || $object['include']; + $temp[] = $result['data']; + } + $object['Attribute'] = $temp; + } + return array('include' => $include, 'data' => $object); + } + + private function __prepareGenericForView( + $object, + $eventWarnings, + $warningLists + ) { + if (!$this->__fTool) { + $this->__fTool = new FinancialTool(); + } + if ($object['type'] == 'attachment' && preg_match('/.*\.(jpg|png|jpeg|gif)$/i', $object['value'])) { + $object['image'] = $this->Attribute->base64EncodeAttachment($object); + } + if (isset($object['distribution']) && $object['distribution'] != 4) unset($object['SharingGroup']); + if ($object['objectType'] !== 'object') { + if ($object['category'] === 'Financial fraud') { + if (!$this->__fTool->validateRouter($object['type'], $object['value'])) { + $object['validationIssue'] = true; + } + } + } + $this->Warninglist->checkForWarning($object, $eventWarnings, $warningLists); + return $object; + } + public function rearrangeEventForView(&$event, $passedArgs = array(), $all = false) { - $fTool = new FinancialTool(); + $this->Warninglist = ClassRegistry::init('Warninglist'); + $warningLists = $this->Warninglist->fetchForEventView(); foreach ($event['Event'] as $k => $v) { if (is_array($v)) { $event[$k] = $v; @@ -3131,79 +3253,55 @@ class Event extends AppModel { } } $eventArray = array(); + $eventWarnings = array(); $correlatedAttributes = isset($event['RelatedAttribute']) ? array_keys($event['RelatedAttribute']) : array(); $correlatedShadowAttributes = isset($event['RelatedShadowAttribute']) ? array_keys($event['RelatedShadowAttribute']) : array(); - $totalElements = count($event['Attribute']); foreach ($event['Attribute'] as $attribute) { - $totalElements += isset($attribute['ShadowAttribute']) ? count($attribute['ShadowAttribute']) : 0; - if ($filterType && !in_array($filterType, array('proposal', 'correlation', 'warning'))) if (!in_array($attribute['type'], $this->Attribute->typeGroupings[$filterType])) continue; - if (isset($attribute['distribution']) && $attribute['distribution'] != 4) unset($attribute['SharingGroup']); - $attribute['objectType'] = 0; - if (!empty($attribute['ShadowAttribute'])) { - $attribute['hasChildren'] = 1; - } 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; + $result = $this->__prepareAttributeForView( + $attribute, + $correlatedAttributes, + $correlatedShadowAttributes, + $filterType, + $eventWarnings, + $warningLists + ); + $event['objects'][] = $result['data']; } unset($event['Attribute']); - if (isset($event['ShadowAttribute'])) { - $totalElements += count($event['ShadowAttribute']); - foreach ($event['ShadowAttribute'] as $shadowAttribute) { - 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; + if (!empty($event['ShadowAttribute'])) { + foreach ($event['ShadowAttribute'] as $proposal) { + $result = $this->__prepareProposalForView( + $proposal, + $correlatedShadowAttributes, + $filterType, + $eventWarnings, + $warningLists + ); + $event['objects'][] = $result['data']; } + unset($event['ShadowAttribute']); + } + if (!empty($event['Object'])) { + foreach ($event['Object'] as $object) { + $object['objectType'] = 'object'; + $result = $this->__prepareObjectForView( + $object, + $correlatedAttributes, + $correlatedShadowAttributes, + false, + $eventWarnings, + $warningLists + ); + $event['objects'][] = $result['data']; + } + unset($event['Object']); } unset($event['ShadowAttribute']); App::uses('CustomPaginationTool', 'Tools'); $customPagination = new CustomPaginationTool(); if ($all) $passedArgs['page'] = 0; - $eventArrayWithProposals = array(); - foreach ($eventArray as $k => &$object) { - if ($object['category'] === 'Financial fraud') { - if (!$fTool->validateRouter($object['type'], $object['value'])) { - $object['validationIssue'] = true; - } - } - if ($object['objectType'] == 0) { - if (isset($object['ShadowAttribute'])) { - $shadowAttributeTemp = $object['ShadowAttribute']; - unset($object['ShadowAttribute']); - $eventArrayWithProposals[] = $object; - foreach ($shadowAttributeTemp as $kk => $shadowAttribute) { - $shadowAttribute['objectType'] = 1; - if ($kk == 0) $shadowAttribute['firstChild'] = true; - if (($kk + 1) == count($shadowAttributeTemp)) $shadowAttribute['lastChild'] = true; - $eventArrayWithProposals[] = $shadowAttribute; - } - } else { - $eventArrayWithProposals[] = $object; - } - } else { - $eventArrayWithProposals[] = $object; - } - unset($eventArray[$k]); - } - $event['objects'] = $eventArrayWithProposals; - $this->Warninglist = ClassRegistry::init('Warninglist'); - $warningLists = $this->Warninglist->fetchForEventView(); - if (!empty($warningLists)) $event = $this->Warninglist->setWarnings($event, $warningLists); - if ($filterType && $filterType == 'warning') { - foreach ($event['objects'] as $k => &$object) if (empty($object['warnings'])) unset($event['objects'][$k]); - $event['objects'] = array_values($event['objects']); - } $params = $customPagination->applyRulesOnArray($event['objects'], $passedArgs, 'events', 'category'); - $params['total_elements'] = $totalElements; + $params['total_elements'] = count($event['objects']); return $params; } diff --git a/app/Model/Warninglist.php b/app/Model/Warninglist.php index 691ece79d..4ea65e62c 100644 --- a/app/Model/Warninglist.php +++ b/app/Model/Warninglist.php @@ -232,6 +232,23 @@ class Warninglist extends AppModel{ return $warninglists; } + public function checkForWarning($object, &$eventWarnings, $warningLists) { + if ($object['to_ids']) { + foreach ($warningLists as $list) { + if (in_array('ALL', $list['types']) || in_array($object['type'], $list['types'])) { + $result = $this->__checkValue($list['values'], $object['value'], $object['type'], $list['Warninglist']['type']); + if (!empty($result)) { + $object['warnings'][$result][] = $list['Warninglist']['name']; + if (!in_array($list['Warninglist']['name'], $eventWarnings)) { + $eventWarnings[$list['Warninglist']['id']] = $list['Warninglist']['name']; + } + } + } + } + } + return $object; + } + public function setWarnings(&$event, &$warninglists) { if (empty($event['objects'])) return $event; $eventWarnings = array(); diff --git a/app/View/Elements/Events/View/row_attribute.ctp b/app/View/Elements/Events/View/row_attribute.ctp new file mode 100644 index 000000000..b0f3fcf0d --- /dev/null +++ b/app/View/Elements/Events/View/row_attribute.ctp @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + + + +   + + +
+
+ +
+ + +
+
+ +
+ + +
+ +
> + > + element('/Events/View/value_field', array('object' => $object)); + ?> + + 0, 2 => 1); + $valueParts = explode('|', $object['value']); + foreach ($components as $component => $valuePart) { + if (isset($object['warnings'][$component]) && isset($valueParts[$valuePart])) { + foreach ($object['warnings'][$component] as $warning) $temp .= '' . h($valueParts[$valuePart]) . ': ' . h($warning) . '
'; + } + } + echo '  '; + } + ?> +
+ + +
+ element('ajaxAttributeTags', array('attributeId' => $object['id'], 'attributeTags' => $object['AttributeTag'], 'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id']) )); ?> +
+ + +
+
+   +
+ + + + > + + + + + + + + + +
+
+ +
+ + + +
+
class="inline-field-solid" ondblclick="activateField('Attribute', '', 'distribution', );"> + + + +
+ + element('/Events/View/sighting_field', array( + 'object' => $object, + 'tr_class' => $tr_class, + 'page' => $page + )); + endif; + ?> + + + + + +   + + + + + + +   + +   + + C + + + + + + + $proposal) { + echo $this->element('/Events/View/row_' . $proposal['objectType'], array( + 'object' => $proposal, + 'mayModify' => $mayModify, + 'mayChangeCorrelation' => $mayChangeCorrelation, + 'page' => $page, + 'fieldCount' => $fieldCount, + 'child' => $propKey == $lastElement ? 'last' : true, + 'objectContainer' => $child + )); + } + } +?> diff --git a/app/View/Elements/Events/View/row_object.ctp b/app/View/Elements/Events/View/row_object.ctp new file mode 100644 index 000000000..44d45846e --- /dev/null +++ b/app/View/Elements/Events/View/row_object.ctp @@ -0,0 +1,60 @@ + + + + + + + + + + Name:
+ Meta-category:
+ Description:
+ Tempate: + + + +
+
class="inline-field-solid" ondblclick="activateField('', '', 'distribution', );"> + + +   +
+ +   +   + + + + $attribute) { + echo $this->element('/Events/View/row_' . $attribute['objectType'], array( + 'object' => $attribute, + 'mayModify' => $mayModify, + 'mayChangeCorrelation' => $mayChangeCorrelation, + 'page' => $page, + 'fieldCount' => $fieldCount, + 'child' => $attrKey == $lastElement ? 'last' : true + )); + } + } +?> diff --git a/app/View/Elements/Events/View/row_proposal.ctp b/app/View/Elements/Events/View/row_proposal.ctp new file mode 100644 index 000000000..9ebb557bd --- /dev/null +++ b/app/View/Elements/Events/View/row_proposal.ctp @@ -0,0 +1,316 @@ + + + + + + + + + + + + + + +
+ +
+ + + Html->image('orgs/' . h($object['Org']['name']) . '.png', array('alt' => h($object['Org']['name']), 'title' => h($object['Org']['name']), 'style' => 'width:24px; height:24px')); + else echo h($object['Org']['name']); + } + } else { ?> +   + + + +
+
+ +
+ + +
+
+ +
+ + +
+ +
> + > + '; + } else { + $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 '' . h($filename) . ''; + } else { + echo '' . h($filenameHash[0]) . ''; + } + if (isset($filenameHash[1])) echo '
' . $filenameHash[1]; + } + } else if (strpos($object['type'], '|') !== false) { + $filenameHash = explode('|', $object['value']); + echo h($filenameHash[0]); + if (isset($filenameHash[1])) { + $separator = '
'; + if (in_array($object['type'], array('ip-dst|port', 'ip-src|port'))) { + $separator = ':'; + } + echo $separator . h($filenameHash[1]); + } + } else if ('vulnerability' == $object['type']) { + if (! is_null(Configure::read('MISP.cveurl'))) { + $cveUrl = Configure::read('MISP.cveurl'); + } else { + $cveUrl = "http://www.google.com/search?q="; + } + echo $this->Html->link($sigDisplay, $cveUrl . $sigDisplay, array('target' => '_blank', 'class' => $linkClass)); + } else if ('link' == $object['type']) { + echo $this->Html->link($sigDisplay, $sigDisplay, array('class' => $linkClass)); + } else if ('cortex' == $object['type']) { + echo '
Cortex object
'; + } else if ('text' == $object['type']) { + if ($object['category'] == 'External analysis' && preg_match('/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i', $object['value'])) { + echo '' . h($object['value']) . ''; + } else { + $sigDisplay = str_replace("\r", '', h($sigDisplay)); + $sigDisplay = str_replace(" ", ' ', $sigDisplay); + echo nl2br($sigDisplay); + } + } else if ('hex' == $object['type']) { + $sigDisplay = str_replace("\r", '', $sigDisplay); + echo '' . nl2br(h($sigDisplay)) . ' '; + } else { + $sigDisplay = str_replace("\r", '', $sigDisplay); + echo nl2br(h($sigDisplay)); + } + if (isset($object['validationIssue'])) echo '  '; + ?> +
+ 0, 2 => 1); + $valueParts = explode('|', $object['value']); + foreach ($components as $component => $valuePart) { + if (isset($object['warnings'][$component]) && isset($valueParts[$valuePart])) { + foreach ($object['warnings'][$component] as $warning) $temp .= '' . h($valueParts[$valuePart]) . ': ' . h($warning) . '
'; + } + } + echo '  '; + } + ?> +
+ + + +
+   +
+ +   + + + +
+
+   +
+ +   + + + + + + + +
+
+ +
+ +   + + + + Form->create('Sighting', array('id' => 'Sighting_' . $object['id'], 'url' => '/sightings/add/' . $object['id'], 'style' => 'display:none;')); + echo $this->Form->input('type', array('label' => false, 'id' => 'Sighting_' . $object['id'] . '_type')); + echo $this->Form->end(); + ?> + + +   +   +   + + + + + ' . h($s) . '/' . h($f) . '/' . h($e) . ')'; ?> + + + + + element('sparkline', array('id' => $object['id'], 'csv' => $temp)); + } + ?> + + + + Form->create('Shadow_Attribute', array('id' => 'ShadowAttribute_' . $object['id'] . '_accept', 'url' => '/shadow_attributes/accept/' . $object['id'], 'style' => 'display:none;')); + echo $this->Form->end(); + ?> + + + + + + diff --git a/app/View/Elements/Events/View/row_proposal_delete.ctp b/app/View/Elements/Events/View/row_proposal_delete.ctp new file mode 100644 index 000000000..694fe84a6 --- /dev/null +++ b/app/View/Elements/Events/View/row_proposal_delete.ctp @@ -0,0 +1,60 @@ + + + + + + + + + + + + DELETE + + Form->create('Shadow_Attribute', array('id' => 'ShadowAttribute_' . $object['id'] . '_accept', 'url' => '/shadow_attributes/accept/' . $object['id'], 'style' => 'display:none;')); + echo $this->Form->end(); + ?> + + + + + + diff --git a/app/View/Elements/Events/View/sighting_field.ctp b/app/View/Elements/Events/View/sighting_field.ctp new file mode 100644 index 000000000..c4380fcff --- /dev/null +++ b/app/View/Elements/Events/View/sighting_field.ctp @@ -0,0 +1,35 @@ + + + Form->create('Sighting', array('id' => 'Sighting_' . $object['id'], 'url' => '/sightings/add/' . $object['id'], 'style' => 'display:none;')); + echo $this->Form->input('type', array('label' => false, 'id' => 'Sighting_' . $object['id'] . '_type')); + echo $this->Form->end(); + ?> + + +   +   +   + + + + + ' . h($s) . '/' . h($f) . '/' . h($e) . ')'; ?> + + + + element('sparkline', array('id' => $object['id'], 'csv' => $temp)); + } + ?> + diff --git a/app/View/Elements/Events/View/value_field.ctp b/app/View/Elements/Events/View/value_field.ctp new file mode 100644 index 000000000..d03e2e911 --- /dev/null +++ b/app/View/Elements/Events/View/value_field.ctp @@ -0,0 +1,49 @@ +'; + } else { + $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 '' . h($filename) . ''; + } else { + echo '' . h($filenameHash[0]) . ''; + } + if (isset($filenameHash[1])) echo '
' . $filenameHash[1]; + } + } else if (strpos($object['type'], '|') !== false) { + $separator = in_array($object['type'], array('ip-dst|port', 'ip-src|port')) ? ':' : '
'; + $separator_pos = strpos('|', $object['value']); + $final_value = h($object['value']); + echo substr_replace(h($object['value']), $separator, $separator_pos, strlen($separator)); + } else if ('vulnerability' == $object['type']) { + $cveUrl = (is_null(Configure::read('MISP.cveurl'))) ? "http://www.google.com/search?q=" : Configure::read('MISP.cveurl'); + echo $this->Html->link($sigDisplay, $cveUrl . $sigDisplay, array('target' => '_blank', 'class' => $linkClass)); + } else if ('link' == $object['type']) { + echo $this->Html->link($sigDisplay, $sigDisplay, array('class' => $linkClass)); + } else if ('cortex' == $object['type']) { + echo '
Cortex object
'; + } else if ('text' == $object['type']) { + if ($object['category'] == 'External analysis' && preg_match('/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i', $object['value'])) { + echo '' . h($object['value']) . ''; + } else { + $sigDisplay = str_replace("\r", '', h($sigDisplay)); + $sigDisplay = str_replace(" ", ' ', $sigDisplay); + echo nl2br($sigDisplay); + } + } else if ('hex' == $object['type']) { + $sigDisplay = str_replace("\r", '', $sigDisplay); + echo '' . nl2br(h($sigDisplay)) . ' '; + } else { + $sigDisplay = str_replace("\r", '', $sigDisplay); + echo nl2br(h($sigDisplay)); + } + if (isset($object['validationIssue'])) echo '  '; +?> diff --git a/app/View/Elements/ajaxTags.ctp b/app/View/Elements/ajaxTags.ctp index aa5fa34c2..90c229ac5 100644 --- a/app/View/Elements/ajaxTags.ctp +++ b/app/View/Elements/ajaxTags.ctp @@ -1,4 +1,4 @@ -
+
$data) { $sightingsData['data'][$aid]['html'] = ''; @@ -174,419 +175,28 @@ Actions $object): - $extra = ''; - $extra2 = ''; - $extra3 = ''; - $linkClass = 'white'; - $currentType = 'denyForm'; - if ($object['objectType'] == 0 ) { - $currentType = 'Attribute'; - if ($object['hasChildren'] == 1) { - $extra = 'highlight1'; - $extra3 = 'highlightBlueSides highlightBlueTop'; - } else { - $linkClass = ''; - } - if (!$mayModify) $currentType = 'ShadowAttribute'; - } else { - if (isset($object['proposal_to_delete']) && $object['proposal_to_delete']) { - $extra = 'highlight3'; - unset($object['type']); - } else $extra = 'highlight2'; - + $elements = array( + 0 => 'attribute', + 1 => 'proposal', + 2 => 'proposal_delete', + 3 => 'object' + ); + foreach ($event['objects'] as $k => $object) { + $element_type = 0; + if ($object['objectType'] == 1 && !empty($object['proposal_to_delete'])) { + $element_type = 1; + } else if ($object['objectType'] == 3) { + $element_type = 2; } - if ($object['objectType'] == 1) { - $extra2 = '1'; - $extra3 = 'highlightBlueSides'; - if (isset($object['firstChild'])) { - $extra3 .= ' highlightBlueTop'; - } - if (isset($object['lastChild'])) { - $extra3 .= ' highlightBlueBottom'; - } - } - if (isset($object['deleted']) && $object['deleted']) { - $extra .= ' background-light-red'; - } - $extra .= (isset($object['deleted']) && $object['deleted']) ? ' background-light-red' : ''; - ?> - - - - - - - - - - - - - - - -
- -
- - - Html->image('orgs/' . h($object['Org']['name']) . '.png', array('alt' => h($object['Org']['name']), 'title' => h($object['Org']['name']), 'style' => 'width:24px; height:24px')); - else echo h($object['Org']['name']); - } - } else { ?> -   - - - -
-
- -
- - -
-
- -
- - -
- -
> - > - '; - } else { - $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 '' . h($filename) . ''; - } else { - echo '' . h($filenameHash[0]) . ''; - } - if (isset($filenameHash[1])) echo '
' . $filenameHash[1]; - } - } else if (strpos($object['type'], '|') !== false) { - $filenameHash = explode('|', $object['value']); - echo h($filenameHash[0]); - if (isset($filenameHash[1])) { - $separator = '
'; - if (in_array($object['type'], array('ip-dst|port', 'ip-src|port'))) { - $separator = ':'; - } - echo $separator . h($filenameHash[1]); - } - } else if ('vulnerability' == $object['type']) { - if (! is_null(Configure::read('MISP.cveurl'))) { - $cveUrl = Configure::read('MISP.cveurl'); - } else { - $cveUrl = "http://www.google.com/search?q="; - } - echo $this->Html->link($sigDisplay, $cveUrl . $sigDisplay, array('target' => '_blank', 'class' => $linkClass)); - } else if ('link' == $object['type']) { - echo $this->Html->link($sigDisplay, $sigDisplay, array('class' => $linkClass)); - } else if ('cortex' == $object['type']) { - echo '
Cortex object
'; - } else if ('text' == $object['type']) { - if ($object['category'] == 'External analysis' && preg_match('/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i', $object['value'])) { - echo '' . h($object['value']) . ''; - } else { - $sigDisplay = str_replace("\r", '', h($sigDisplay)); - $sigDisplay = str_replace(" ", ' ', $sigDisplay); - echo nl2br($sigDisplay); - } - } else if ('hex' == $object['type']) { - $sigDisplay = str_replace("\r", '', $sigDisplay); - echo '' . nl2br(h($sigDisplay)) . ' '; - } else { - $sigDisplay = str_replace("\r", '', $sigDisplay); - echo nl2br(h($sigDisplay)); - } - if (isset($object['validationIssue'])) echo '  '; - ?> -
- 0, 2 => 1); - $valueParts = explode('|', $object['value']); - foreach ($components as $component => $valuePart) { - if (isset($object['warnings'][$component]) && isset($valueParts[$valuePart])) { - foreach ($object['warnings'][$component] as $warning) $temp .= '' . h($valueParts[$valuePart]) . ': ' . h($warning) . '
'; - } - } - echo '  '; - } - ?> -
- - - -
- element('ajaxAttributeTags', array('attributeId' => $object['id'], 'attributeTags' => $object['AttributeTag'], 'tagAccess' => ($isSiteAdmin || $mayModify || $me['org_id'] == $event['Event']['org_id']) )); ?> -
- -   - - - -
-
-   -
- - - - > - - -   - - -
    - $relatedAttribute['info'], 'Correlating Value' => $relatedAttribute['value'], 'date' => isset($relatedAttribute['date']) ? $relatedAttribute['date'] : 'N/A'); - $popover = ''; - foreach ($relatedData as $k => $v) { - $popover .= '' . h($k) . ': ' . h($v) . '
    '; - } - echo '
  • '; - if ($relatedAttribute['org_id'] == $me['org_id']) { - echo $this->Html->link($relatedAttribute['id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['id'], true, $event['Event']['id']), array ('class' => 'red')); - } else { - echo $this->Html->link($relatedAttribute['id'], array('controller' => 'events', 'action' => 'view', $relatedAttribute['id'], true, $event['Event']['id']), array ('class' => $otherColour)); - } - echo "
  • "; - echo ' '; - } - } - ?> -
- - -
    - $v): - if ($k == 'id') continue; - $popover .= '' . Inflector::humanize(h($k)) . ': ' . h($v) . '
    '; - endforeach; - ?> -
  • - Html->link($feed['id'], array('controller' => 'feeds', 'action' => 'previewIndex', $feed['id']), array('style' => 'margin-right:3px;')); - else: - ?> - - -
  • - -
- - -
-
- -
- - - -
-
class="inline-field-solid" ondblclick="activateField('', '', 'distribution', );"> - - -   -
- - - - - Form->create('Sighting', array('id' => 'Sighting_' . $object['id'], 'url' => '/sightings/add/' . $object['id'], 'style' => 'display:none;')); - echo $this->Form->input('type', array('label' => false, 'id' => 'Sighting_' . $object['id'] . '_type')); - echo $this->Form->end(); - ?> - - -   -   -   - - - - - ' . h($s) . '/' . h($f) . '/' . h($e) . ')'; ?> - - - - - element('sparkline', array('id' => $object['id'], 'csv' => $temp)); - } - ?> - - - - - - - -   - - - - - - -   - -   - - C - - - - Form->create('Shadow_Attribute', array('id' => 'ShadowAttribute_' . $object['id'] . '_accept', 'url' => '/shadow_attributes/accept/' . $object['id'], 'style' => 'display:none;')); - echo $this->Form->end(); - ?> - - - - - - - element('/Events/View/row_' . $object['objectType'], array( + 'object' => $object, + 'k' => $k, + 'mayModify' => $mayModify, + 'mayChangeCorrelation' => $mayChangeCorrelation, + 'page' => $page, + 'fieldCount' => $fieldCount + )); + } ?>
diff --git a/app/webroot/css/main.css b/app/webroot/css/main.css index ae7795519..4a176ba8a 100644 --- a/app/webroot/css/main.css +++ b/app/webroot/css/main.css @@ -272,7 +272,6 @@ td.highlight1 { td.highlight2 { background-color: #747170 !important; color: #ffffff !important; - } td.highlight3 { @@ -1714,6 +1713,143 @@ table.table.table-striped tr.deleted_row td { background-color:#f4f4f4; } +tr.tableInsetOrangeFirst td:first-child { + box-shadow: + inset 0px 2px 0px 0px #f57900, + inset 3px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeFirst td { + box-shadow: + inset 0px 2px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeFirst td:last-child { + box-shadow: + inset 0px 2px 0px 0px #f57900, + inset -2px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeMiddle td:first-child { + box-shadow: + inset 3px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeMiddle td:last-child { + box-shadow: + inset -3px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeLast td:first-child { + box-shadow: + inset 0px -3px 0px 0px #f57900, + inset 3px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeLast td { + box-shadow: + inset 0px -3px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrangeLast td:last-child { + box-shadow: + inset 0px -3px 0px 0px #f57900, + inset -3px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrange td:first-child { + box-shadow: + inset 0px 2px 0px 0px #f57900, + inset 0px -3px 0px 0px #f57900, + inset 2px 0px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrange td { + box-shadow: + inset 0px 2px 0px 0px #f57900, + inset 0px -3px 0px 0px #f57900; + border-top:0px !important; +} + +tr.tableInsetOrange td:last-child { + box-shadow: + inset 0px 2px 0px 0px #f57900, + inset 0px -3px 0px 0px #f57900, + inset -2px 0px 0px 0px #f57900; + border-top:0px !important; +} + +.tableHighlightBorder { + border-radius: 3px !important; + border-width: 3px; + border-style: solid; +} + +.tableHighlightBorderTop { + border-radius: 3px !important; + border-width: 3px; + border-style: solid; + border-bottom: 0px; +} + +.tableHighlightBorderCenter { + border-radius: 3px !important; + border-width: 3px; + border-style: solid; + border-bottom: 0px; + border-top: 0px; +} + +.tableHighlightBorderBottom { + border-radius: 3px !important; + border-width: 3px; + border-style:solid; + border-top: 0px; +} + +tr.tableHighlightBorderBottom td { + border-top:0px !important; +} + +.borderRed { + border-color:#cc0000; +} + +.borderOrange { + border-color:#f57900; +} + +.borderBlue { + border-color:#3465a4; +} + +tr.darkOrangeRow td, .darkOrangeElement { + background-color: #ce5c00 !important; + color: #ffffff; + border-top:0px !important; +} + +tr.blueRow td, .blueElement { + background-color: #3465a4 !important; + color: #ffffff; + border-top:0px !important; +} + +tr.redRow td, .redElement { + background-color: #cc0000 !important; + color: #ffffff; + border-top:0px !important; +} + @-webkit-keyframes rotation { from {-webkit-transform: rotate(0deg);} to {-webkit-transform: rotate(359deg);}