!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smabpro.picotech.app/public_html/vendor/aws/aws-sdk-php/src/Token/   drwxr-xr-x
Free 28.8 GB of 117.98 GB (24.41%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     TokenProvider.php (8.3 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace Aws\Token;

use 
Aws;
use 
Aws\Api\DateTimeResult;
use 
Aws\CacheInterface;
use 
Aws\Exception\TokenException;
use 
GuzzleHttp\Promise;

/**
 * Token providers are functions that accept no arguments and return a
 * promise that is fulfilled with an {@see \Aws\Token\TokenInterface}
 * or rejected with an {@see \Aws\Exception\TokenException}.
 *
 * <code>
 * use Aws\Token\TokenProvider;
 * $provider = TokenProvider::defaultProvider();
 * // Returns a TokenInterface or throws.
 * $token = $provider()->wait();
 * </code>
 *
 * Token providers can be composed to create a token using conditional
 * logic that can create different tokens in different environments. You
 * can compose multiple providers into a single provider using
 * {@see Aws\Token\TokenProvider::chain}. This function accepts
 * providers as variadic arguments and returns a new function that will invoke
 * each provider until a token is successfully returned.
 */
class TokenProvider
{
    use 
ParsesIniTrait;
    const 
ENV_PROFILE 'AWS_PROFILE';

    
/**
     * Create a default token provider tha checks for cached a SSO token from
     * the CLI
     *
     * This provider is automatically wrapped in a memoize function that caches
     * previously provided tokens.
     *
     * @param array $config Optional array of token provider options.
     *
     * @return callable
     */
    
public static function defaultProvider(array $config = [])
    {

        
$cacheable = [
            
'sso',
        ];

        
$defaultChain = [];

        if (
            !isset(
$config['use_aws_shared_config_files'])
            || 
$config['use_aws_shared_config_files'] !== false
        
) {
            
$profileName getenv(self::ENV_PROFILE) ?: 'default';
            
$defaultChain['sso'] = self::sso(
                
$profileName,
                
self::getHomeDir() . '/.aws/config',
                
$config
            
);
        }

        if (isset(
$config['token'])
            && 
$config['token'] instanceof CacheInterface
        
) {
            foreach (
$cacheable as $provider) {
                if (isset(
$defaultChain[$provider])) {
                    
$defaultChain[$provider] = self::cache(
                        
$defaultChain[$provider],
                        
$config['token'],
                        
'aws_cached_' $provider '_token'
                    
);
                }
            }
        }

        return 
self::memoize(
            
call_user_func_array(
                [
TokenProvider::class, 'chain'],
                
array_values($defaultChain)
            )
        );
    }

    
/**
     * Create a token provider function from a static token.
     *
     * @param TokenInterface $token
     *
     * @return callable
     */
    
public static function fromToken(TokenInterface $token)
    {
        
$promise Promise\Create::promiseFor($token);

        return function () use (
$promise) {
            return 
$promise;
        };
    }

    
/**
     * Creates an aggregate token provider that invokes the provided
     * variadic providers one after the other until a provider returns
     * a token.
     *
     * @return callable
     */
    
public static function chain()
    {
        
$links func_get_args();
        
//Common use case for when aws_shared_config_files is false
        
if (empty($links)) {
            return function () {
                return 
Promise\Create::promiseFor(false);
            };
        }

        return function () use (
$links) {
            
/** @var callable $parent */
            
$parent array_shift($links);
            
$promise $parent();
            while (
$next array_shift($links)) {
                
$promise $promise->otherwise($next);
            }
            return 
$promise;
        };
    }

    
/**
     * Wraps a token provider and caches a previously provided token.
     * Ensures that cached tokens are refreshed when they expire.
     *
     * @param callable $provider Token provider function to wrap.
     * @return callable
     */
    
public static function memoize(callable $provider)
    {
        return function () use (
$provider) {
            static 
$result;
            static 
$isConstant;

            
// Constant tokens will be returned constantly.
            
if ($isConstant) {
                return 
$result;
            }

            
// Create the initial promise that will be used as the cached value
            // until it expires.
            
if (null === $result) {
                
$result $provider();
            }

            
// Return a token that could expire and refresh when needed.
            
return $result
                
->then(function (TokenInterface $token) use ($provider, &$isConstant, &$result) {
                    
// Determine if the token is constant.
                    
if (!$token->getExpiration()) {
                        
$isConstant true;
                        return 
$token;
                    }

                    if (!
$token->isExpired()) {
                        return 
$token;
                    }
                    return 
$result $provider();
                })
                ->
otherwise(function($reason) use (&$result) {
                    
// Cleanup rejected promise.
                    
$result null;
                    return 
Promise\Create::promiseFor(null);
                });
        };
    }

    
/**
     * Wraps a token provider and saves provided token in an
     * instance of Aws\CacheInterface. Forwards calls when no token found
     * in cache and updates cache with the results.
     *
     * @param callable $provider Token provider function to wrap
     * @param CacheInterface $cache Cache to store the token
     * @param string|null $cacheKey (optional) Cache key to use
     *
     * @return callable
     */
    
public static function cache(
        callable 
$provider,
        
CacheInterface $cache,
        
$cacheKey null
    
) {
        
$cacheKey $cacheKey ?: 'aws_cached_token';

        return function () use (
$provider$cache$cacheKey) {
            
$found $cache->get($cacheKey);
            if (
is_array($found) && isset($found['token'])) {
                if (isset(
$found['token']) && $found['token'] instanceof TokenInterface) {
                    
$foundToken $found['token'];
                    if (!
$foundToken->isExpired()) {
                        return 
Promise\Create::promiseFor($foundToken);
                    }
                    if (isset(
$found['refreshMethod']) && is_callable($found['refreshMethod'])) {
                        return 
Promise\Create::promiseFor($found['refreshMethod']());
                    }
                }
            }

            return 
$provider()
                ->
then(function (TokenInterface $token) use (
                    
$cache,
                    
$cacheKey
                
) {
                    
$cache->set(
                        
$cacheKey,
                        
$token,
                        
null === $token->getExpiration() ?
                            
$token->getExpiration() - time()
                    );

                    return 
$token;
                });
        };
    }

    
/**
     * Gets profiles from the ~/.aws/config ini file
     */
    
private static function loadDefaultProfiles() {
        
$profiles = [];
        
$configFile self::getHomeDir() . '/.aws/config';

        if (
file_exists($configFile)) {
            
$configProfileData \Aws\parse_ini_file($configFiletrueINI_SCANNER_RAW);
            foreach (
$configProfileData as $name => $profile) {
                
// standardize config profile names
                
$name str_replace('profile '''$name);
                if (!isset(
$profiles[$name])) {
                    
$profiles[$name] = $profile;
                }
            }
        }

        return 
$profiles;
    }

    private static function 
reject($msg)
    {
        return new 
Promise\RejectedPromise(new TokenException($msg));
    }

    
/**
     * Token provider that creates a token from cached sso credentials
     *
     * @param string $ssoProfileName the name of the ini profile name
     * @param string $filename the location of the ini file
     * @param array $config configuration options
     *
     * @return SsoToken
     * @see Aws\Token\SsoToken for $config details.
     */
    
public static function sso($profileName$filename$config = [])
    {
        return new 
SsoTokenProvider($profileName$filename$config);
    }
}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0038 ]--