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

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/var/www/html/main_file/vendor/aws/aws-sdk-php/src/S3/   drwxr-xr-x
Free 13.1 GB of 57.97 GB (22.6%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

use 
Aws\Api\Service;
use 
Aws\CommandInterface;
use 
GuzzleHttp\Psr7;
use 
InvalidArgumentException;
use 
Psr\Http\Message\RequestInterface;

/**
 * Apply required or optional checksums to requests before sending.
 *
 * IMPORTANT: This middleware must be added after the "build" step.
 *
 * @internal
 */
class ApplyChecksumMiddleware
{
    use 
CalculatesChecksumTrait;
    private static 
$sha256AndMd5 = [
        
'PutObject',
        
'UploadPart',
    ];

    
/** @var Service */
    
private $api;

    private 
$nextHandler;

    
/**
     * Create a middleware wrapper function.
     *
     * @param Service $api
     * @return callable
     */
    
public static function wrap(Service $api)
    {
        return function (callable 
$handler) use ($api) {
            return new 
self($handler$api);
        };
    }

    public function 
__construct(callable $nextHandlerService $api)
    {
        
$this->api $api;
        
$this->nextHandler $nextHandler;
    }

    public function 
__invoke(
        
CommandInterface $command,
        
RequestInterface $request
    
) {
        
$next $this->nextHandler;
        
$name $command->getName();
        
$body $request->getBody();

        
//Checks if AddContentMD5 has been specified for PutObject or UploadPart
        
$addContentMD5 = isset($command['AddContentMD5'])
            ?  
$command['AddContentMD5']
            : 
null;

        
$op $this->api->getOperation($command->getName());

        
$checksumInfo = isset($op['httpChecksum'])
            ? 
$op['httpChecksum']
            : [];
        
$checksumMemberName array_key_exists('requestAlgorithmMember'$checksumInfo)
            ? 
$checksumInfo['requestAlgorithmMember']
            : 
"";
        
$requestedAlgorithm = isset($command[$checksumMemberName])
            ? 
$command[$checksumMemberName]
            : 
null;
        if (!empty(
$checksumMemberName) && !empty($requestedAlgorithm)) {
            
$requestedAlgorithm strtolower($requestedAlgorithm);
            
$checksumMember $op->getInput()->getMember($checksumMemberName);
            
$supportedAlgorithms = isset($checksumMember['enum'])
                ? 
array_map('strtolower'$checksumMember['enum'])
                : 
null;
            if (
is_array($supportedAlgorithms)
                && 
in_array($requestedAlgorithm$supportedAlgorithms)
            ) {
                
$headerName "x-amz-checksum-{$requestedAlgorithm}";
                
$encoded $this->getEncodedValue($requestedAlgorithm$body);
                if (!
$request->hasHeader($headerName)) {
                    
$request $request->withHeader($headerName$encoded);
                }
            } else {
                throw new 
InvalidArgumentException(
                    
"Unsupported algorithm supplied for input variable {$checksumMemberName}."
                    
"  Supported checksums for this operation include: "
                    
implode(", "$supportedAlgorithms) . "."
                
);
            }
            return 
$next($command$request);
        }

        if (!empty(
$checksumInfo)) {
        
//if the checksum member is absent, check if it's required
        
$checksumRequired = isset($checksumInfo['requestChecksumRequired'])
            ? 
$checksumInfo['requestChecksumRequired']
            : 
null;
            if ((!empty(
$checksumRequired) && !$request->hasHeader('Content-MD5'))
                || (
in_array($nameself::$sha256AndMd5) && $addContentMD5)
            ) {
                
// Set the content MD5 header for operations that require it.
                
$request $request->withHeader(
                    
'Content-MD5',
                    
base64_encode(Psr7\Utils::hash($body'md5'true))
                );
                return 
$next($command$request);
            }
        }

        if (
in_array($nameself::$sha256AndMd5) && $command['ContentSHA256']) {
            
// Set the content hash header if provided in the parameters.
            
$request $request->withHeader(
                
'X-Amz-Content-Sha256',
                
$command['ContentSHA256']
            );
        }

        return 
$next($command$request);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

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

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

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