Esempio n. 1
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $details = sprintf("Found %s files that reference risky function. \n\t-> %s", count($this->alerts), View::make('table', array('headers' => array('File', 'Line', 'Match'), 'rows' => $this->alerts)));
         $this->score = 1;
         $this->result .= $details;
         $this->action = "You do not need to deactivate these files, but please scrutinize them in the event of a security issue.";
     }
     $messenger->addMessage(get_object_vars($this));
     return $this;
 }
Esempio n. 2
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $details = sprintf("Found %s files that contain likely exploits \n\t-> %s", count($this->alerts), View::make('table', array('headers' => array('File', 'Line', 'Match'), 'rows' => $this->alerts)));
         $this->score = 2;
         $this->result .= $details;
         $this->action = "You should deactivate this plugin unless you can verify this is the intended use.";
     } else {
         $this->result .= "No exploits found.";
     }
     $messenger->addMessage(get_object_vars($this));
 }
Esempio n. 3
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $checks = array(array('message' => sprintf("Found %s files that reference sessions. %s ", count($this->alerts), $this->action), 'class' => 'fail'));
         $this->result .= View::make('checklist', array('rows' => $checks));
         $this->result .= View::make('table', array('headers' => array('File', 'Line', 'Match'), 'rows' => $this->alerts));
         $this->score = 2;
     } else {
         if ($this->has_plugin) {
             $this->result .= 'You are running wp-native-php-sessions plugin.';
         } else {
             $this->result .= 'No files referencing sessions found.';
         }
     }
     $messenger->addMessage(get_object_vars($this));
 }
Esempio n. 4
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $total = 0;
         $rows = array();
         foreach ($this->alerts as $alert) {
             $total += $alert['code'];
             $label = 'info';
             if (1 === $alert['code']) {
                 $label = 'warning';
             } elseif (2 >= $alert['code']) {
                 $label = 'error';
             }
             $rows[] = array('message' => $alert['message'], 'class' => $label);
         }
         $avg = $total / count($this->alerts);
         $this->result = sprintf("%s\n%s", $this->description, View::make('checklist', array('rows' => $rows)));
         // format the cron table
         $rows = array();
         $headers = array('jobname' => 'Job', 'schedule' => 'Frequency', 'next' => 'Next Run');
         // @TODO move this logic to the run() function or checkCron() function
         if ($this->cron) {
             foreach ($this->cron as $timestamp => $crons) {
                 foreach ($crons as $job => $data) {
                     $class = 'ok';
                     $data = array_shift($data);
                     if ($timestamp < time()) {
                         $class = "error";
                         $this->action = "<div class='warning'>Some cronjobs are outdated.</div>";
                     }
                     $rows[] = array('class' => $class, 'data' => array('jobname' => $job, 'schedule' => $data['schedule'], 'next' => date('M j,Y @ H:i:s', $timestamp)));
                 }
             }
         }
         $this->result .= sprintf("<hr/>%s", View::make('table', array('rows' => $rows, 'headers' => $headers)));
         $this->score = $avg;
     }
     $messenger->addMessage(get_object_vars($this));
 }
Esempio n. 5
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $total = 0;
         $rows = array();
         // this is dumb and left over from the previous iterationg. @TODO move scoring to run() method
         foreach ($this->alerts as $alert) {
             $total += $alert['code'];
             $alert['class'] = 'ok';
             if (-1 === $alert['code']) {
                 $alert['class'] = 'fail';
             } elseif (2 > $alert['code']) {
                 $alert['class'] = 'warning';
             }
             $rows[] = $alert;
         }
         $avg = $total / count($this->alerts);
         $this->result = View::make('checklist', array('rows' => $rows));
         $this->score = $avg;
         $this->action = "You should use object caching";
     }
     $messenger->addMessage(get_object_vars($this));
 }
Esempio n. 6
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $headers = array('slug' => "Plugin", 'installed' => "Current", 'available' => "Available", 'needs_update' => "Needs Update", 'vulnerable' => "Vulnerabilities");
         $rows = array();
         $count_update = 0;
         $count_vuln = 0;
         foreach ($this->alerts as $alert) {
             $class = 'ok';
             if ($alert['needs_update']) {
                 $class = 'warning';
                 $count_update++;
             }
             if ('None' != $alert['vulnerable']) {
                 $class = 'error';
                 $count_vuln++;
             }
             $rows[] = array('class' => $class, 'data' => $alert);
         }
         $rendered = PHP_EOL;
         $rendered .= sprintf("Found %d plugins needing updates and %d known vulnerabilities ... \n" . PHP_EOL, $count_update, $count_vuln);
         $rendered .= View::make('table', array('headers' => $headers, 'rows' => $rows));
         $this->result .= $rendered;
         if ($count_update > 0) {
             $this->score = 1;
             $this->action = "You should update all out-of-date plugins";
         }
         if ($count_vuln > 0) {
             $this->score = 2;
             $this->action = "Update plugins to fix vulnerabilities";
         }
     } else {
         $this->result .= "No plugins found.";
     }
     $messenger->addMessage(get_object_vars($this));
 }
Esempio n. 7
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $total = 0;
         $rows = array();
         // this is dumb and left over from the previous iterationg. @TODO move scoring to run() method
         foreach ($this->alerts as $alert) {
             $total += $alert['code'];
             $rows[] = $alert;
         }
         $avg = $total / count($this->alerts);
         $this->result = View::make('checklist', array('rows' => $rows));
         $this->score = round($avg);
     }
     $messenger->addMessage(get_object_vars($this));
 }
Esempio n. 8
0
 public function message(Messenger $messenger)
 {
     if (!empty($this->alerts)) {
         $total = 0;
         $rows = array();
         foreach ($this->alerts as $alert) {
             $total += $alert['code'];
             $label = 'info';
             if (1 === $alert['code']) {
                 $label = 'warning';
             } elseif (2 >= $alert['code']) {
                 $label = 'error';
             }
             $rows[] = array('message' => $alert['message'], 'class' => $label);
         }
         $avg = $total / count($this->alerts);
         $this->result = sprintf("%s\n%s", $this->description, View::make('checklist', array('rows' => $rows)));
         // format the cron table
         $rows = array();
         if ($this->cron_rows) {
             $headers = array('jobname' => 'Job', 'schedule' => 'Frequency', 'next' => 'Next Run');
             $this->result .= sprintf("<hr/>%s", View::make('table', array('rows' => $this->cron_rows, 'headers' => $headers)));
             $this->score = $avg;
         }
     }
     $messenger->addMessage(get_object_vars($this));
 }