!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_tdfonline/php/3ros/simplesamlphp/modules/core/lib/   drwxr-xr-x
Free 11.89 GB of 61.93 GB (19.2%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


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


/**
 * Perform installation and updates on simpleSAMLphp modules
 * based on information found in a module definition.
 *
 * @Author    Andreas Åkre Solberg, <andreas.solberg@uninett.no>
 */
class sspmod_core_ModuleInstaller {
    
    public 
$module;
    
    public function 
__construct(sspmod_core_ModuleDefinition $module) {
        
$this->module $module;
        
    }
    
    public function 
remove($branch NULL) { 
        
$access $this->module->getAccess($branch);
        
        switch(
$access['type']) {
            
// case 'svn' :
            //     $this->requireInstalled();
            //     $this->remove($access);
            //     break;
            
            
default:
                
$this->requireInstalled();
                
$this->removeModuleDir($access);
                break;
                
        }
    }
    
    public function 
install($branch NULL) {
        
        
$access $this->module->getAccess($branch);
        
        switch(
$access['type']) {
            case 
'svn' :
                
$this->requireNotInstalled();
                
$this->svnCheckout($access);
                
$this->enable();
                
$this->prepareConfig();
                break;
            
            case 
'zip' :
                
$this->requireNotInstalled();
                
$this->zipLoad($access);
                
$this->enable();
                
$this->prepareConfig();
                break;

            
            default:
                throw new 
Exception('Unknown access method type. Not one of [zip,tgz,svn]');
                
        }
        
    }
    
    public static function 
exec($cmd) {
        echo 
' $ ' $cmd "\n";
        
$output shell_exec(escapeshellcmd($cmd));    
        
        if (empty(
$output)) return;
        
        
$oa explode("\n"$output);
        
        foreach(
$oa AS $ol) {
            echo 
' > ' $ol "\n";            
        }

    }
    
    public function 
upgrade($branch NULL) {
        
        
$access $this->module->getAccess($branch);
        
        switch(
$access['type']) {
            case 
'svn' :
                
$this->requireInstalled();
                
$this->svnUpdate($access);
                
$this->enable();
                
$this->prepareConfig();
                break;
                
            case 
'zip' :
                
$this->requireInstalled();
                
$this->zipLoad($access);
                
$this->enable();
                
$this->prepareConfig();
                break;
            
            default:
                throw new 
Exception('Unknown access method type. Not one of [zip,tgz,svn]');
                
        }
        
    }
    
    public function 
dirExists() {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
        
$dir $basedir 'modules/' $this->module->def['id'];
        
        return (
file_exists($dir) && is_dir($dir));
    }
    
    public function 
requireValidURL($url) {
        if (!
preg_match('|http(s)?://[a-zA-Z0-9_-/.]|'$url)) 
            throw new 
Exception('Invalid URL [' $url ']');
    }
    
    public function 
requireNotInstalled() {
        if (
$this->dirExists())
            throw new 
Exception('The module [' $this->module->def['id'] . '] is already installed.');
    }
    
    public function 
requireInstalled() {
        if (!
$this->dirExists())
            throw new 
Exception('The module [' $this->module->def['id'] . '] is not installed.');
    }
    
    public function 
svnCheckout($access) {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
$cmd "svn co " escapeshellarg($access['url']) . " " $basedir "modules/" $this->module->def['id'];
        
self::exec($cmd);
    }
    
    public function 
svnUpdate($access) {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
$cmd "svn up " $basedir "modules/" $this->module->def['id'];
        
self::exec($cmd);
    }
    
    public function 
removeModuleDir($access) {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
$cmd "rm -rf " $basedir "modules/" $this->module->def['id'];
        
self::exec($cmd);
    }
    
    public function 
enable() {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
        
$this->requireInstalled();
        
        
$cmd "touch " $basedir "modules/" $this->module->def['id'] . '/enable';
        
self::exec($cmd);
    }
    
    public function 
prepareConfig() {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
        
$this->requireInstalled();
        
        
$dir $basedir "modules/" $this->module->def['id'] . '/config-templates';
        if (!
file_exists($dir)) return;
        
        
$files scandir($dir);
        foreach(
$files AS $file) {
            if(!
preg_match('|^.*\.php|'$file)) continue;
            
            if (
file_exists($basedir 'config/' $file)) {
                echo 
"Configuration file [" $file "] already exists. Will not overwrite existing file.\n";
                continue;
            }
            
            
$cmd 'cp ' $dir '/' $file ' ' $basedir 'config/';
            
self::exec($cmd);    
        }
    }
    
    public function 
zipLoad($access) {
        
$config SimpleSAML_Configuration::getConfig('config.php');
        
$basedir $config->getBaseDir();
        
        
$zipfile $access['url'];
        
$localfile tempnam(sys_get_temp_dir(), 'ssp-module-');
        
$filecontents file_get_contents($zipfile);
        
file_put_contents($localfile$filecontents);
        
        
$cmd "unzip -qo " escapeshellarg($localfile) . " -d " $basedir "modules/";
        
self::exec($cmd);

    }
    
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

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

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.5258 ]--