diff --git a/app/Controller/AppController.php b/app/Controller/AppController.php index a89ee719d..39310cd31 100755 --- a/app/Controller/AppController.php +++ b/app/Controller/AppController.php @@ -64,7 +64,6 @@ class AppController extends Controller { } public function beforeFilter() { - // user must accept terms if (!$this->Auth->user('termsaccepted') && ($this->request->here != '/users/terms') && ($this->request->here != '/users/logout') && ($this->request->here != '/users/login')) { $this->redirect(array('controller' => 'users', 'action' => 'terms')); @@ -431,7 +430,9 @@ class AppController extends Controller { } } - // CakePHP returns false if filesize is 0 at lib/cake/Utility/File.php:384 +/** + * CakePHP returns false if filesize is 0 at lib/cake/Utility/File.php:384 + */ public function checkEmpty($fileP = '/var/www/cydefsig/app/files/test') { // Check if there were problems with the file upload // only keep the last part of the filename, this should prevent directory attacks diff --git a/app/Controller/EventsController.php b/app/Controller/EventsController.php index 95130e8ba..38b5abfcb 100755 --- a/app/Controller/EventsController.php +++ b/app/Controller/EventsController.php @@ -80,16 +80,16 @@ class EventsController extends AppController { } } -// // do not show cluster outside server -// if ('true' == Configure::read('CyDefSIG.private')) { -// if ($this->_isRest()) { -// $this->paginate = Set::merge($this->paginate,array( -// 'conditions' => -// array(array('Event.cluster !=' => true)), -// //array("AND" => array(array('Event.private !=' => 2))), -// )); -// } -// } + //// do not show cluster outside server + //if ('true' == Configure::read('CyDefSIG.private')) { + // if ($this->_isRest()) { + // $this->paginate = Set::merge($this->paginate,array( + // 'conditions' => + // array(array('Event.cluster !=' => true)), + // //array("AND" => array(array('Event.private !=' => 2))), + // )); + // } + //} } public function isAuthorized($user) { diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index 66b6db919..669297119 100644 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -191,20 +191,20 @@ class ServersController extends AppController { } if (is_array($event['Event']['Attribute']) && !isset($event['Event']['Attribute']['id'])) { $toRemove = array(); - $size = sizeof($event['Event']['Attribute']); + $size = count($event['Event']['Attribute']); for ($i = 0; $i < $size; $i++) { switch($event['Event']['Attribute'][$i]['distribution']) { - case 'Org': - $toRemove[] = $i; - break; - case 'Community': - $event['Event']['Attribute'][$i]['private'] = true; - $event['Event']['Attribute'][$i]['distribution'] = 'Org'; - break; - case 'All': - $event['Event']['Attribute'][$i]['cluster'] = true; - $event['Event']['Attribute'][$i]['distribution'] = 'Community'; - break; + case 'Org': + $toRemove[] = $i; + break; + case 'Community': + $event['Event']['Attribute'][$i]['private'] = true; + $event['Event']['Attribute'][$i]['distribution'] = 'Org'; + break; + case 'All': + $event['Event']['Attribute'][$i]['cluster'] = true; + $event['Event']['Attribute'][$i]['distribution'] = 'Community'; + break; } } foreach ($toRemove as $thisRemove) { @@ -213,17 +213,17 @@ class ServersController extends AppController { $event['Event']['Attribute'] = array_values($event['Event']['Attribute']); } elseif (is_array($event['Event']['Attribute']) && isset($event['Event']['Attribute']['id'])) { switch($event['Event']['Attribute']['distribution']) { - case 'Org': - unset($event['Event']['Attribute']); - break; - case 'Community': - $event['Event']['Attribute']['private'] = true; - $event['Event']['Attribute']['distribution'] = 'Org'; - break; - case 'All': - $event['Event']['Attribute']['cluster'] = true; - $event['Event']['Attribute']['distribution'] = 'Community'; - break; + case 'Org': + unset($event['Event']['Attribute']); + break; + case 'Community': + $event['Event']['Attribute']['private'] = true; + $event['Event']['Attribute']['distribution'] = 'Org'; + break; + case 'All': + $event['Event']['Attribute']['cluster'] = true; + $event['Event']['Attribute']['distribution'] = 'Community'; + break; } } // Distribution, set reporter of the event, being the admin that initiated the pull diff --git a/app/Controller/WhitelistsController.php b/app/Controller/WhitelistsController.php index 66958710e..c31f52c92 100644 --- a/app/Controller/WhitelistsController.php +++ b/app/Controller/WhitelistsController.php @@ -8,23 +8,23 @@ App::uses('AppController', 'Controller'); class WhitelistsController extends AppController { public $components = array( - 'Acl', - 'Auth' => array( - 'authorize' => array( - 'Actions' => array('actionPath' => 'controllers/Whitelists') - ) - ), - 'Security', - 'Session' - ); + 'Acl', + 'Auth' => array( + 'authorize' => array( + 'Actions' => array('actionPath' => 'controllers/Whitelists') + ) + ), + 'Security', + 'Session' + ); - //public $components = array('Security'); - public $paginate = array( - 'limit' => 60, - 'order' => array( - 'Whitelist.name' => 'ASC' - ) - ); + //public $components = array('Security'); + public $paginate = array( + 'limit' => 60, + 'order' => array( + 'Whitelist.name' => 'ASC' + ) + ); /** * index method diff --git a/app/Model/Attribute.php b/app/Model/Attribute.php index d8bbab13d..3ae218a9e 100644 --- a/app/Model/Attribute.php +++ b/app/Model/Attribute.php @@ -775,7 +775,7 @@ class Attribute extends AppModel { $this->create(); $this->data['Attribute']['event_id'] = $eventId; if ($malware) { - $md5 = !$tmpfile->size() ? md5_file($fileP) : $tmpfile->md5() ; + $md5 = !$tmpfile->size() ? md5_file($fileP) : $tmpfile->md5(); $this->data['Attribute']['category'] = $category ? $category : "Payload delivery"; $this->data['Attribute']['type'] = "malware-sample"; $this->data['Attribute']['value'] = $fullFileName ? $fullFileName . '|' . $md5 : $filename . '|' . $md5; // TODO gives problems with bigger files diff --git a/app/Model/Event.php b/app/Model/Event.php index cd8444637..b468b3b50 100644 --- a/app/Model/Event.php +++ b/app/Model/Event.php @@ -400,7 +400,7 @@ class Event extends AppModel { if (!$attribute['cluster'] && !$attribute['private']) { $attribute['cluster'] = true; $attribute['distribution'] = 'Community'; - } + } // remove value1 and value2 from the output unset($attribute['value1']); unset($attribute['value2']); @@ -548,7 +548,7 @@ class Event extends AppModel { $response = $HttpSocket->get($uri, $data = '', $request); if ($response->isOk()) { -//debug($response->body); + //debug($response->body); $xml = Xml::build($response->body); $eventArray = Xml::toArray($xml); $eventIds = array(); diff --git a/app/View/Attributes/add.ctp b/app/View/Attributes/add.ctp index e92b7879a..469548746 100755 --- a/app/View/Attributes/add.ctp +++ b/app/View/Attributes/add.ctp @@ -18,9 +18,6 @@ if ('true' == Configure::read('CyDefSIG.sync')) { echo $this->Form->input('distribution', array('label' => 'Distribution', 'selected' => 'All', 'between' => $this->Html->div('forminfo', '', array('id' => 'AttributeDistributionDiv')) )); -// echo $this->Form->input('sharing', array('label' => 'Distribution', -// 'before' => $this->Html->div('forminfo', isset($attrDescriptions['sharing']['formdesc']) ? $attrDescriptions['sharing']['formdesc'] : $attrDescriptions['sharing']['desc']), -// )); } else { echo $this->Form->input('private', array( 'before' => $this->Html->div('forminfo', isset($attrDescriptions['private']['formdesc']) ? $attrDescriptions['private']['formdesc'] : $attrDescriptions['private']['desc']), diff --git a/app/View/Users/admin_index.ctp b/app/View/Users/admin_index.ctp index ca65f25ca..d85bea878 100755 --- a/app/View/Users/admin_index.ctp +++ b/app/View/Users/admin_index.ctp @@ -35,7 +35,7 @@   - Html->link(__('Edit'), array('admin' => true, 'action' => 'edit', $user['User']['id']), null); echo $this->Form->postLink(__('Delete'), array('admin' => true, 'action' => 'delete', $user['User']['id']), null, __('Are you sure you want to delete # %s?', $user['User']['id'])); }?>