/**
  * Returns an instance of this class
  *
  * This method allows the passed argument to be either an instance of
  * IDS_Init or an array.
  *
  * @param  mixed  $config    IDS_Init | array
  * @param  string $classname the class name to use
  *
  * @return object $this
  */
 public static function getInstance($config, $classname = 'IDS_Log_Email')
 {
     if (!self::$instance) {
         self::$instance = new $classname($config);
     }
     return self::$instance;
 }
Beispiel #2
0
 /**
  * Returns an instance of this class
  *
  * This method allows the passed argument to be either an instance of
  * IDS_Init or an array.
  *
  * @param mixed $config IDS_Init | array
  *
  * @return object $this
  */
 public static function getInstance($config)
 {
     if (!self::$instance) {
         self::$instance = new IDS_Log_Email($config);
     }
     return self::$instance;
 }
Beispiel #3
0
 /**
  * This function sends out a mail
  * about the intrusion including the intrusion details
  *
  * @param array $results
  * @return boolean
  */
 private function idsmail($result)
 {
     vendor('phpids/IDS/Log/Email.php');
     vendor('phpids/IDS/Log/Composite.php');
     $compositeLog = new IDS_Log_Composite();
     $compositeLog->addLogger(IDS_Log_Email::getInstance($this->init->config['IDS_Logging']['recipient'], $this->config['IDS_Logging']['subject'], NULL, $this->init->config['IDS_Logging']['safemode'], $this->init->config['IDS_Logging']['allowed_rate'], $this->init->config['IDS_Basic']['tmp_path']));
     if (!$result->isEmpty()) {
         $compositeLog->execute($result);
     }
     return true;
 }
Beispiel #4
0
$ids_init->config['General']['base_path'] = TM_INCLUDEPATH . '/phpids/lib/IDS/';
$ids_init->config['General']['use_base_path'] = true;
#$ids_init->config['General']['use_base_path'] = false;
$ids_init->config['General']['html'] = array("POST.summary", "POST.body", "POST.body_text", "POST.subject", "POST.message_doptin", "POST.message_greeting", "POST.message_update", "POST.content");
$ids_init->config['General']['exceptions'] = array("POST.summary", "POST.body", "POST.body_text", "POST.subject", "POST.message_doptin", "POST.message_greeting", "POST.message_update", "POST.content", "REQUEST.summary", "REQUEST.body", "REQUEST.body_text", "REQUEST.subject", "REQUEST.message_doptin", "REQUEST.message_greeting", "REQUEST.message_update", "REQUEST.content");
$ids_init->config['Caching']['caching'] = 'file';
//none
$ids_init->config['Caching']['expiration_time'] = 600;
$ids_init->config['Caching']['path'] = "../../../../admin/tmp/phpids.cache";
$ids_init->config['Logging']['path'] = "../../../../admin/tmp/phpids.log";
#$ids_init->config['Caching']['path'] =TM_INCLUDEPATH."/../admin/tmp/phpids.cache";
#$ids_init->config['Logging']['path'] =TM_INCLUDEPATH."/../admin/tmp/phpids.log";
$ids = new IDS_Monitor($ids_request, $ids_init);
$ids_result = $ids->run();
if (!$ids_result->isEmpty()) {
    /*
     * The following steps are optional to log the results
     */
    require_once 'IDS/Log/File.php';
    require_once 'IDS/Log/Email.php';
    require_once 'IDS/Log/Composite.php';
    #require_once (TM_INCLUDEPATH.'/phpids/lib/IDS/Log/File.php');
    #require_once (TM_INCLUDEPATH.'/phpids/lib/IDS/Log/Email.php');
    #require_once (TM_INCLUDEPATH.'/phpids/lib/IDS/Log/Comopsite.php');
    $compositeLog = new IDS_Log_Composite();
    $compositeLog->addLogger(IDS_Log_File::getInstance($ids_init), IDS_Log_Email::getInstance($ids_init));
    $compositeLog->execute($ids_result);
    #if (DEBUG) echo $ids_result;
    $_MAIN_MESSAGE .= "<h1>PHPIDS Intrusion detection:</h1>";
    $_MAIN_MESSAGE .= "<pre><font size=1 color=\"red\">" . $ids_result . "</font></pre>";
}