!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/laravel-crm/vendor/maennchen/zipstream-php/test/   drwxr-xr-x
Free 13.04 GB of 57.97 GB (22.49%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

declare(strict_types=1);

namespace 
ZipStream\Test;

use function 
fgets;
use function 
pclose;
use function 
popen;
use function 
preg_match;

use 
RecursiveDirectoryIterator;
use 
RecursiveIteratorIterator;

use function 
strtolower;

use 
ZipArchive;

trait 
Util
{
    protected function 
cmdExists(string $command): bool
    
{
        if (
strtolower(\substr(PHP_OS03)) === 'win') {
            
$fp popen("where $command"'r');
            
$result fgets($fp255);
            
$exists = !preg_match('#Could not find files#'$result);
            
pclose($fp);
        } else { 
// non-Windows
            
$fp popen("which $command"'r');
            
$result fgets($fp255);
            
$exists = !empty($result);
            
pclose($fp);
        }

        return 
$exists;
    }

    protected function 
dumpZipContents(string $path): string
    
{
        if (!
$this->cmdExists('hexdump')) {
            return 
'';
        }

        
$output = [];

        if (!
exec("hexdump -C \"$path\" | head -n 50"$output)) {
            return 
'';
        }

        return 
"\nHexdump:\n" implode("\n"$output);
    }

    protected function 
validateAndExtractZip(string $zipPath): string
    
{
        
$tmpDir $this->getTmpDir();

        
$zipArchive = new ZipArchive();
        
$result $zipArchive->open($zipPath);

        if (
$result !== true) {
            
$codeName $this->zipArchiveOpenErrorCodeName($result);
            
$debugInformation $this->dumpZipContents($zipPath);

            
$this->fail("Failed to open {$zipPath}. Code: $result ($codeName)$debugInformation");

            return 
$tmpDir;
        }

        
$this->assertSame(0$zipArchive->status);
        
$this->assertSame(0$zipArchive->statusSys);

        
$zipArchive->extractTo($tmpDir);
        
$zipArchive->close();

        return 
$tmpDir;
    }

    protected function 
zipArchiveOpenErrorCodeName(int $code): string
    
{
        switch (
$code) {
            case 
ZipArchive::ER_EXISTS: return 'ER_EXISTS';
            case 
ZipArchive::ER_INCONS: return 'ER_INCONS';
            case 
ZipArchive::ER_INVAL: return 'ER_INVAL';
            case 
ZipArchive::ER_MEMORY: return 'ER_MEMORY';
            case 
ZipArchive::ER_NOENT: return 'ER_NOENT';
            case 
ZipArchive::ER_NOZIP: return 'ER_NOZIP';
            case 
ZipArchive::ER_OPEN: return 'ER_OPEN';
            case 
ZipArchive::ER_READ: return 'ER_READ';
            case 
ZipArchive::ER_SEEK: return 'ER_SEEK';
            default: return 
'unknown';
        }
    }

    protected function 
getTmpDir(): string
    
{
        
$tmp tempnam(sys_get_temp_dir(), 'zipstreamtest');
        
unlink($tmp);
        
mkdir($tmp) or $this->fail('Failed to make directory');

        return 
$tmp;
    }

    
/**
     * @return string[]
     */
    
protected function getRecursiveFileList(string $pathbool $includeDirectories false): array
    {
        
$data = [];
        
$path = (string) realpath($path);
        
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));

        
$pathLen strlen($path);
        foreach (
$files as $file) {
            
$filePath $file->getRealPath();

            if (
is_dir($filePath) && !$includeDirectories) {
                continue;
            }

            
$data[] = substr($filePath$pathLen 1);
        }

        
sort($data);

        return 
$data;
    }
}

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