Exemple #1
0
 /**
  * @Event("LiveTest.Runner.Init")
  *
  * @param array $arguments
  */
 public function runnerInit(array $arguments, Event $event)
 {
     if (array_key_exists('version', $arguments)) {
         $credentials = new Credentials($this->getRunId(), $this->getEventDispatcher());
         $event->setProcessed();
     }
 }
 /**
  * @Event("LiveTest.Runner.Init")
  */
 public function runnerInit(Event $event)
 {
     if (!function_exists('curl_version')) {
         echo "  The mandatory cURL library (http://php.net/manual/de/book.curl.php) was not found.\n";
         echo "  LiveTest will not work without cURL support.";
         $event->setProcessed();
     }
 }
Exemple #3
0
 /**
  * @Event("Scanner.CheckResponse.isFiltered")
  */
 public function isStopped(Event $event, $ruleName)
 {
     if ($this->runLevels[$ruleName] > $this->currentRunLevel) {
         $event->setProcessed();
         return true;
     }
     return false;
 }
Exemple #4
0
 /**
  * @Event("Scanner.Scan.isStopped")
  */
 public function isStopped(Event $event)
 {
     foreach ($this->stopStrategies as $strategy) {
         if ($strategy->isStopped()) {
             $event->setProcessed();
             return true;
         }
     }
     return false;
 }
Exemple #5
0
 /**
  * This function echoes the global help if the --help command line argument is set
  *
  * @Event("LiveTest.Runner.Init")
  *
  * @param array $arguments
  */
 public function runnerInit(array $arguments, Event $event)
 {
     $path = $this->getBasePathFrom();
     if (array_key_exists('help', $arguments) || count($arguments) == 0) {
         $templateContent = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . $this->template);
         echo $this->replacePlaceholdersInTemplateContentWithPath($templateContent, $path);
         $event->setProcessed();
     }
     return true;
 }
Exemple #6
0
 /**
  * @Event("Scanner.CheckResponse.isFiltered")
  */
 public function isFiltered(Event $event, $ruleName, Response $response)
 {
     $uri = (string) $this->retriever->getOriginUri($response->getUri());
     if ($this->currentModus === self::MODUS_FILTER) {
         $isFiltered = $this->isFilteredByFilter($ruleName, $uri);
     } else {
         $isFiltered = $this->isFilteredByExclusives($ruleName, $uri);
     }
     if ($isFiltered) {
         $event->setProcessed();
         return true;
     } else {
         return false;
     }
 }
Exemple #7
0
 /**
  * This function checks if a newer version of livetest is avaiable.
  *
  * @Event("LiveTest.Runner.Init")
  *
  * @param array $arguments
  * @param Event $event
  */
 public function doUpgradeCheck($arguments, Event $event)
 {
     if (array_key_exists('check-upgrade', $arguments)) {
         echo '  Checking for upgrade (current version ' . LIVETEST_VERSION . '): ';
         $zend = new Client(self::PHM_API);
         $zend->setAdapter(new Curl());
         $latestStable = trim($zend->request()->getBody());
         if (version_compare(LIVETEST_VERSION, $latestStable, '<')) {
             echo 'Newer version found (latest stable: ' . $latestStable . ").\n" . '                                                Please visit livetest.www.phmlabs.com for more information.';
         } else {
             echo 'No newer version found (latest stable: ' . $latestStable . ')';
         }
         $event->setProcessed();
     }
 }
Exemple #8
0
 /**
  * @Event("LiveTest.Runner.Error")
  *
  * @param \Exception $e
  */
 public function handleException(\Exception $exception, Event $event)
 {
     $event->setProcessed();
     if ($this->debug) {
         echo "  An error occured (debug modus):\n\n";
         echo "  Class  : " . get_class($exception) . "\n";
         echo "  Message: " . $exception->getMessage() . "\n";
         echo "  File   : " . $exception->getFile() . "\n";
         echo "  Line   : " . $exception->getLine() . "\n\n";
         $trace = str_replace('#', '           #', $exception->getTraceAsString());
         $trace = str_replace('           #0', '#0', $trace);
         echo "  Trace  : " . $trace;
     } else {
         echo "  An error occured: " . $exception->getMessage();
     }
 }