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


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

namespace Enlightn\Enlightn\Analyzers\Performance;

use 
Enlightn\Enlightn\Analyzers\Concerns\AnalyzesMiddleware;
use 
Enlightn\Enlightn\Inspection\Reflector;
use 
Fideloper\Proxy\TrustProxies;
use 
Fruitcake\Cors\HandleCors;
use 
Illuminate\Contracts\Config\Repository as ConfigRepository;
use 
Illuminate\Contracts\Foundation\Application;
use 
Illuminate\Contracts\Http\Kernel;
use 
Illuminate\Http\Middleware\TrustHosts;
use 
Illuminate\Routing\Router;

class 
UnusedGlobalMiddlewareAnalyzer extends PerformanceAnalyzer
{
    use 
AnalyzesMiddleware;

    
/**
     * The title describing the analyzer.
     *
     * @var string|null
     */
    
public $title 'Your application does not contain unused global HTTP middleware.';

    
/**
     * The severity of the analyzer.
     *
     * @var string|null
     */
    
public $severity self::SEVERITY_MINOR;

    
/**
     * The time to fix in minutes.
     *
     * @var int|null
     */
    
public $timeToFix 5;

    
/**
     * A collection of unused middleware
     *
     * @var \Illuminate\Support\Collection
     */
    
protected $unusedMiddleware;

    
/**
     * Create a new analyzer instance.
     *
     * @param  \Illuminate\Routing\Router  $router
     * @param  \Illuminate\Contracts\Http\Kernel  $kernel
     * @return void
     */
    
public function __construct(Router $routerKernel $kernel)
    {
        
$this->router $router;
        
$this->kernel $kernel;
    }

    
/**
     * Get the error message describing the analyzer insights.
     *
     * @return string
     */
    
public function errorMessage()
    {
        return 
'Your application contains global middleware that is not currently being used. It is '
            
.'recommended to remove these middleware from your Kernel class to enhance performance '
            
.'slightly. Your unused middleware include: '.$this->formatUnusedMiddleware();
    }

    
/**
     * Execute the analyzer.
     *
     * @param \Illuminate\Contracts\Foundation\Application $app
     * @param \Illuminate\Contracts\Config\Repository $config
     * @return void
     * @throws \ReflectionException
     */
    
public function handle(Application $appConfigRepository $config)
    {
        
$this->unusedMiddleware collect();

        if (
class_exists(TrustProxies::class) && $this->appUsesGlobalMiddleware(TrustProxies::class)) {
            
$middlewareClass collect($this->getGlobalMiddleware())->filter(function ($middleware) {
                return 
$middleware === TrustProxies::class || is_subclass_of($middlewareTrustProxies::class);
            })->
first();

            
$middleware $app->make($middlewareClass);
            
$proxies Reflector::get($middleware'proxies');

            if (empty(
$proxies) && is_null($config->get('trustedproxy.proxies'))) {
                
$this->unusedMiddleware->push(TrustProxies::class);

                if (
$this->appUsesGlobalMiddleware(TrustHosts::class)) {
                    
// Trusted hosts without trusted proxies is useless.
                    
$this->unusedMiddleware->push(TrustHosts::class);
                }
            }
        } elseif (
$this->appUsesGlobalMiddleware(TrustHosts::class)) {
            
// Trusted hosts without trusted proxies is useless.
            
$this->unusedMiddleware->push(TrustHosts::class);
        }

        if (empty(
$config->get('cors.paths', [])) && $this->appUsesGlobalMiddleware(HandleCors::class)) {
            
$this->unusedMiddleware->push(HandleCors::class);
        }

        if (
$this->unusedMiddleware->count() > 0) {
            
$this->markFailed();
        }
    }

    
/**
     * @return string
     */
    
protected function formatUnusedMiddleware()
    {
        return 
$this->unusedMiddleware->map(function ($middlewareClass) {
            return 
'['.class_basename($middlewareClass).']';
        })->
join(', '' and ');
    }
}

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