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


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

namespace Enlightn\SecurityChecker;

use 
GuzzleHttp\Client;
use 
Psr\Http\Message\ResponseInterface;

class 
AdvisoryFetcher
{
    
/**
     * @var \GuzzleHttp\Client
     */
    
private $client;

    
/**
     * @var string
     */
    
private $tempDir;

    const 
ADVISORIES_URL 'https://codeload.github.com/FriendsOfPHP/security-advisories/zip/master';

    const 
CACHE_FILE_NAME 'php_security_advisories.json';

    const 
ARCHIVE_FILE_NAME 'php_security_advisories.zip';

    const 
EXTRACT_PATH 'php_security_advisories';

    public function 
__construct($tempDir null)
    {
        
$this->client = new Client();
        
$this->tempDir is_null($tempDir) ? sys_get_temp_dir() : $tempDir;
    }

    
/**
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    
public function fetchAdvisories()
    {
        
$archivePath $this->fetchAdvisoriesArchive();

        (new 
Filesystem)->deleteDirectory($extractPath $this->getExtractDirectoryPath());

        
$zip = new ZipExtractor;
        
$zip->extract($archivePath$extractPath);

        return 
$extractPath;
    }

    
/**
     * @return string
     * @throws \GuzzleHttp\Exception\GuzzleException
     */
    
public function fetchAdvisoriesArchive()
    {
        
$headers = [];
        
$cacheResult = [];

        if (! empty(
$cache $this->getCacheFile())) {
            
$cacheResult json_decode($cachetrue);

            if (
is_file($cacheResult['ArchivePath'])) {
                
// Set cache headers only if both the cache file and archive file exist.
                
$headers = [
                    
'If-None-Match' => $cacheResult['Key'],
                    
'If-Modified-Since' => $cacheResult['Date'],
                ];
            }
        }

        
$response $this->client->get(self::ADVISORIES_URL, [
            
'headers' => $headers,
        ]);

        if (
$response->getStatusCode() !== 304) {
            
$this->writeCacheFile($response);

            
$this->storeAdvisoriesArchive((string) $response->getBody());

            return 
$this->getArchiveFilePath();
        }

        
// If a 304 Not Modified header is found, simply rely on the cached archive file.
        
return $cacheResult['ArchivePath'];
    }

    
/**
     * @param string $content
     * @return false|int
     */
    
public function storeAdvisoriesArchive($content)
    {
        return 
file_put_contents($this->getArchiveFilePath(), $content);
    }

    
/**
     * @return false|string|null
     */
    
public function getCacheFile()
    {
        if (! 
is_file($path $this->getCacheFilePath())) {
            return 
null;
        }

        return 
file_get_contents($path);
    }

    public function 
getCacheFilePath()
    {
        return 
$this->tempDir.DIRECTORY_SEPARATOR.self::CACHE_FILE_NAME;
    }

    public function 
getArchiveFilePath()
    {
        return 
$this->tempDir.DIRECTORY_SEPARATOR.self::ARCHIVE_FILE_NAME;
    }

    public function 
getExtractDirectoryPath()
    {
        return 
$this->tempDir.DIRECTORY_SEPARATOR.self::EXTRACT_PATH;
    }

    public function 
setClient(Client $client)
    {
        
$this->client $client;
    }

    protected function 
writeCacheFile(ResponseInterface $response)
    {
        
$cache = [
            
'Key' => $response->getHeader('Etag')[0],
            
'Date' => $response->getHeader('Date')[0],
            
'ArchivePath' => $this->getArchiveFilePath(),
        ];

        
file_put_contents($this->getCacheFilePath(), json_encode($cache), LOCK_EX);
    }
}

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