!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)

/uploads/script/vendor/composer/composer/src/Composer/Util/   drwxr-xr-x
Free 13.27 GB of 57.97 GB (22.89%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\Util;

use 
Composer\Factory;
use 
Composer\IO\IOInterface;
use 
Composer\Config;
use 
Composer\Downloader\TransportException;

/**
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class GitHub
{
    
/** @var IOInterface */
    
protected $io;
    
/** @var Config */
    
protected $config;
    
/** @var ProcessExecutor */
    
protected $process;
    
/** @var HttpDownloader */
    
protected $httpDownloader;

    
/**
     * Constructor.
     *
     * @param IOInterface     $io             The IO instance
     * @param Config          $config         The composer configuration
     * @param ProcessExecutor $process        Process instance, injectable for mocking
     * @param HttpDownloader  $httpDownloader Remote Filesystem, injectable for mocking
     */
    
public function __construct(IOInterface $ioConfig $configProcessExecutor $process nullHttpDownloader $httpDownloader null)
    {
        
$this->io $io;
        
$this->config $config;
        
$this->process $process ?: new ProcessExecutor($io);
        
$this->httpDownloader $httpDownloader ?: Factory::createHttpDownloader($this->io$config);
    }

    
/**
     * Attempts to authorize a GitHub domain via OAuth
     *
     * @param  string $originUrl The host this GitHub instance is located at
     * @return bool   true on success
     */
    
public function authorizeOAuth($originUrl)
    {
        if (!
in_array($originUrl$this->config->get('github-domains'))) {
            return 
false;
        }

        
// if available use token from git config
        
if (=== $this->process->execute('git config github.accesstoken'$output)) {
            
$this->io->setAuthentication($originUrltrim($output), 'x-oauth-basic');

            return 
true;
        }

        return 
false;
    }

    
/**
     * Authorizes a GitHub domain interactively via OAuth
     *
     * @param  string                        $originUrl The host this GitHub instance is located at
     * @param  string                        $message   The reason this authorization is required
     * @throws \RuntimeException
     * @throws TransportException|\Exception
     * @return bool                          true on success
     */
    
public function authorizeOAuthInteractively($originUrl$message null)
    {
        if (
$message) {
            
$this->io->writeError($message);
        }

        
$note 'Composer';
        if (
$this->config->get('github-expose-hostname') === true && === $this->process->execute('hostname'$output)) {
            
$note .= ' on ' trim($output);
        }
        
$note .= ' ' date('Y-m-d Hi');

        
$url 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' str_replace('%20''+'rawurlencode($note));
        
$this->io->writeError(sprintf('Head to %s'$url));
        
$this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.'$this->config->getAuthConfigSource()->getName()));

        
$token trim($this->io->askAndHideAnswer('Token (hidden): '));

        if (!
$token) {
            
$this->io->writeError('<warning>No token given, aborting.</warning>');
            
$this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');

            return 
false;
        }

        
$this->io->setAuthentication($originUrl$token'x-oauth-basic');

        try {
            
$apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' $originUrl '/api/v3/';

            
$this->httpDownloader->get('https://'$apiUrl, array(
                
'retry-auth-failure' => false,
            ));
        } catch (
TransportException $e) {
            if (
in_array($e->getCode(), array(403401))) {
                
$this->io->writeError('<error>Invalid token provided.</error>');
                
$this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');

                return 
false;
            }

            throw 
$e;
        }

        
// store value in user config
        
$this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
        
$this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl$token);

        
$this->io->writeError('<info>Token stored successfully.</info>');

        return 
true;
    }

    
/**
     * Extract ratelimit from response.
     *
     * @param array $headers Headers from Composer\Downloader\TransportException.
     *
     * @return array Associative array with the keys limit and reset.
     */
    
public function getRateLimit(array $headers)
    {
        
$rateLimit = array(
            
'limit' => '?',
            
'reset' => '?',
        );

        foreach (
$headers as $header) {
            
$header trim($header);
            if (
false === strpos($header'X-RateLimit-')) {
                continue;
            }
            list(
$type$value) = explode(':'$header2);
            switch (
$type) {
                case 
'X-RateLimit-Limit':
                    
$rateLimit['limit'] = (int) trim($value);
                    break;
                case 
'X-RateLimit-Reset':
                    
$rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
                    break;
            }
        }

        return 
$rateLimit;
    }

    
/**
     * Finds whether a request failed due to rate limiting
     *
     * @param array $headers Headers from Composer\Downloader\TransportException.
     *
     * @return bool
     */
    
public function isRateLimited(array $headers)
    {
        foreach (
$headers as $header) {
            if (
preg_match('{^X-RateLimit-Remaining: *0$}i'trim($header))) {
                return 
true;
            }
        }

        return 
false;
    }
}

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