Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php header("Content-type: text/html; charset=utf-8"); //header("Content-type: text/htm..

Decoded Output download

<?php 
header("Content-type: text/html; charset=utf-8"); 
//header("Content-type: text/html; charset=euc-kr"); 
 
function expired(){ 
	$today = strtotime("now"); 
	$end = strtotime("2018-09-30 13:34:00"); 
	if($today > $end){ 
		echo "Your subscription has expired."; 
		exit(); 
	}	 
} 
 
function strToHex($string){ 
	$hex = ''; 
	for ($i=0; $i<strlen($string); $i++){ 
		$ord = ord($string[$i]); 
		$hexCode = dechex($ord); 
		$hex .= substr('0'.$hexCode, -2); 
	} 
	return strToUpper($hex); 
} 
 
function hexToStr($hex){ 
	$string=''; 
	for ($i=0; $i < strlen($hex)-1; $i+=2){ 
		$string .= chr(hexdec($hex[$i].$hex[$i+1])); 
	} 
	return $string; 
} 
 
function getInziTextFromFile($file){ 
	$res1 = exif_read_data($file); 
	$test = hexToStr('01').hexToStr('00').hexToStr('00'); 
	$test2 = hexToStr('01').hexToStr('00').hexToStr('00'); 
	$str = $res1['UndefinedTag:0x0134']; 
	$result = getInziTextFromStr($str); 
	return $result; 
} 
 
function getInziTextFromStr($str){ 
    expired(); 
	$result = []; 
	$array = explode("CDrawMemo",$str); 
	for($i=1 ; $i<count($array); $i++){ 
		$str = $array[$i]; 
 
 
		$test = hexToStr('01').hexToStr('00').hexToStr('00'); 
		$test2 = hexToStr('01').hexToStr('00').hexToStr('00').hexToStr('00'); 
 
		$pos0 = strpos($str,"CDrawMemo"); 
		$str = substr($str,$pos0); 
		$pos00 = strrpos($str,"CDraw"); 
		if($pos00 > 0){ 
		   $str = substr($str,0,$pos00); 
		} 
 
        $str = str_replace("\r\n","^^",$str); 
        $str = str_replace("\n","^^",$str); 
        $str = str_replace("\r","^^",$str); 
 
		$ppos = strrpos($str, mb_convert_encoding("", "EUC-KR",  "UTF-8")); 
		if($ppos > 0){ 
		   $str = substr($str,0,$ppos); 
		} 
		$ppos = strrpos($str, mb_convert_encoding("", "EUC-KR",  "UTF-8")); 
		if($ppos > 0){ 
		   $str = substr($str,0,$ppos); 
		} 
		$ppos = strrpos($str, mb_convert_encoding("", "EUC-KR",  "UTF-8")); 
		if($ppos > 0){ 
		   $str = substr($str,0,$ppos); 
		} 
 
		$pos1 = strpos($str,$test); 
		$p1 = substr($str,$pos1); 
		$pos2 = strrpos($p1,$test2); 
		$print = substr($str,$pos1,($pos2-$pos1)); 
 
		//$pos2 = strrpos($str,$test2); 
		//$print = substr($str,$pos1,($pos2-$pos1)); 
		$print= mb_convert_encoding($print, "UTF-8", "EUC-KR"); 
 
		$pattern = '/[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z]+/u'; 
		preg_match_all($pattern,$print,$match); 
		$result[($i-1)] = implode('',$match[0]); 
        //$result = str_replace("^^","<br>",$result); 
	} 
	//$result = implode('^',$result); 
 
 
	$res = ""; 
    for($f=0 ; $f<count($result); $f++){ 
		if($f > 0){	$res .= ""; } 
		$res .= "mminzi2002003003000".$result[$f]; 
	} 
	return $res; 
} 
 
function getInziTextFromFile_b($file){ 
	$res1 = exif_read_data($file); 
	$str = $res1['UndefinedTag:0x80A4']; 
	$result = getInziTextFromStr_b($str); 
	return $result; 
} 
 
function getInziTextFromStr_b($str){ 
    expired(); 
	$result = []; 
    $extpos = []; 
	$array = explode("ENDOBJECT",$str); 
	for($i=0 ; $i<count($array); $i++){ 
		$str = $array[$i]; 
		$aStr = explode("BEGINOBJECT",$str); 
		$str1 = $aStr[0]; 
        $posZZ = strpos($aStr[1],"POINTS"); 
        $meta = substr($aStr[1],$posZZ); 
        $pos = explode("\n",$meta); 
    	for($f=0; $f<count($pos); $f++){ 
    		if($f == 2){ 
    			$_l = $pos[$f]; 
    		}else if($f == 3){ 
    			$_t = $pos[$f]; 
    		}else if($f == 4){ 
                $pos2_l = $pos[$f]; 
    		}else if($f == 5){ 
    			$pos2_l = $pos[$f]; 
    		}else if($f == 6){ 
                $pos3_l = $pos[$f]; 
    		}else if($f == 7){ 
    			$pos3_l = $pos[$f]; 
    		} 
    	} 
        $_w = abs($pos3_l - $_l); 
    	$_h = abs($_t - $pos2_t); 
		$pos0 = strpos($str1,"OiIndex"); 
		$index = $pos0 + strlen("OiIndex"); 
		if($pos0 > 0){ 
			$str1 = substr($str1,$pos0); 
			$str1 = str_replace("OiAnoDat","",$str1); 
			$str1 = str_replace("OiAnText","",$str1); 
			$pos00 = strrpos($str1,"LeadDat"); 
			if($pos00 > 0){ 
			   $str1 = substr($str1,0,$pos00); 
			} 
		}else{ 
			$pos00 = strrpos($str1,"LeadDat"); 
			if($pos00 > 0){ 
			   $str1 = substr($str1,0,$pos00); 
			} 
		} 
		$str1= mb_convert_encoding($str1, "UTF-8", "EUC-KR"); 
		$pattern = '/[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z]+/u'; 
		preg_match_all($pattern,$str1,$match); 
		$res1 = implode('',$match[0]); 
		$result[$i] = str_replace("OiIndex".$i,"",$res1); 
        $extpos[$i]["l"] = $_l; 
        $extpos[$i]["t"] = $_t; 
        $extpos[$i]["w"] = $_w; 
        $extpos[$i]["h"] = $_h; 
	} 
	$res = ""; 
    for($f=1 ; $f<(count($result)-1); $f++){ 
		if($f > 1){	$res .= ""; } 
		$res .= 'mminzi'.$extpos[$f]["l"].''.$extpos[$f]["t"].''.$extpos[$f]["w"].''.$extpos[$f]["h"].'0'.$result[$f]; 
	} 
	return $res; 
} 
?> 
 
 
<?php 
/* 
$input = $argv[1]; 
$output = $argv[2]; 
$result1 = getInziTextFromFile_b("./test2.tif"); 
echo $result1; 
$str = file_get_contents("./".$_GET["file"]); 
$result = getInziTextFromStr_b($str); 
echo $result1; 
*/ 
?> 

Did this file decode correctly?

Original Code

<?php
header("Content-type: text/html; charset=utf-8");
//header("Content-type: text/html; charset=euc-kr");

function expired(){
	$today = strtotime("now");
	$end = strtotime("2018-09-30 13:34:00");
	if($today > $end){
		echo "Your subscription has expired.";
		exit();
	}	
}

function strToHex($string){
	$hex = '';
	for ($i=0; $i<strlen($string); $i++){
		$ord = ord($string[$i]);
		$hexCode = dechex($ord);
		$hex .= substr('0'.$hexCode, -2);
	}
	return strToUpper($hex);
}

function hexToStr($hex){
	$string='';
	for ($i=0; $i < strlen($hex)-1; $i+=2){
		$string .= chr(hexdec($hex[$i].$hex[$i+1]));
	}
	return $string;
}

function getInziTextFromFile($file){
	$res1 = exif_read_data($file);
	$test = hexToStr('01').hexToStr('00').hexToStr('00');
	$test2 = hexToStr('01').hexToStr('00').hexToStr('00');
	$str = $res1['UndefinedTag:0x0134'];
	$result = getInziTextFromStr($str);
	return $result;
}

function getInziTextFromStr($str){
    expired();
	$result = [];
	$array = explode("CDrawMemo",$str);
	for($i=1 ; $i<count($array); $i++){
		$str = $array[$i];


		$test = hexToStr('01').hexToStr('00').hexToStr('00');
		$test2 = hexToStr('01').hexToStr('00').hexToStr('00').hexToStr('00');

		$pos0 = strpos($str,"CDrawMemo");
		$str = substr($str,$pos0);
		$pos00 = strrpos($str,"CDraw");
		if($pos00 > 0){
		   $str = substr($str,0,$pos00);
		}

        $str = str_replace("\r\n","^^",$str);
        $str = str_replace("\n","^^",$str);
        $str = str_replace("\r","^^",$str);

		$ppos = strrpos($str, mb_convert_encoding("", "EUC-KR",  "UTF-8"));
		if($ppos > 0){
		   $str = substr($str,0,$ppos);
		}
		$ppos = strrpos($str, mb_convert_encoding("", "EUC-KR",  "UTF-8"));
		if($ppos > 0){
		   $str = substr($str,0,$ppos);
		}
		$ppos = strrpos($str, mb_convert_encoding("", "EUC-KR",  "UTF-8"));
		if($ppos > 0){
		   $str = substr($str,0,$ppos);
		}

		$pos1 = strpos($str,$test);
		$p1 = substr($str,$pos1);
		$pos2 = strrpos($p1,$test2);
		$print = substr($str,$pos1,($pos2-$pos1));

		//$pos2 = strrpos($str,$test2);
		//$print = substr($str,$pos1,($pos2-$pos1));
		$print= mb_convert_encoding($print, "UTF-8", "EUC-KR");

		$pattern = '/[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z]+/u';
		preg_match_all($pattern,$print,$match);
		$result[($i-1)] = implode('',$match[0]);
        //$result = str_replace("^^","<br>",$result);
	}
	//$result = implode('^',$result);


	$res = "";
    for($f=0 ; $f<count($result); $f++){
		if($f > 0){	$res .= ""; }
		$res .= "mminzi2002003003000".$result[$f];
	}
	return $res;
}

function getInziTextFromFile_b($file){
	$res1 = exif_read_data($file);
	$str = $res1['UndefinedTag:0x80A4'];
	$result = getInziTextFromStr_b($str);
	return $result;
}

function getInziTextFromStr_b($str){
    expired();
	$result = [];
    $extpos = [];
	$array = explode("ENDOBJECT",$str);
	for($i=0 ; $i<count($array); $i++){
		$str = $array[$i];
		$aStr = explode("BEGINOBJECT",$str);
		$str1 = $aStr[0];
        $posZZ = strpos($aStr[1],"POINTS");
        $meta = substr($aStr[1],$posZZ);
        $pos = explode("\n",$meta);
    	for($f=0; $f<count($pos); $f++){
    		if($f == 2){
    			$_l = $pos[$f];
    		}else if($f == 3){
    			$_t = $pos[$f];
    		}else if($f == 4){
                $pos2_l = $pos[$f];
    		}else if($f == 5){
    			$pos2_l = $pos[$f];
    		}else if($f == 6){
                $pos3_l = $pos[$f];
    		}else if($f == 7){
    			$pos3_l = $pos[$f];
    		}
    	}
        $_w = abs($pos3_l - $_l);
    	$_h = abs($_t - $pos2_t);
		$pos0 = strpos($str1,"OiIndex");
		$index = $pos0 + strlen("OiIndex");
		if($pos0 > 0){
			$str1 = substr($str1,$pos0);
			$str1 = str_replace("OiAnoDat","",$str1);
			$str1 = str_replace("OiAnText","",$str1);
			$pos00 = strrpos($str1,"LeadDat");
			if($pos00 > 0){
			   $str1 = substr($str1,0,$pos00);
			}
		}else{
			$pos00 = strrpos($str1,"LeadDat");
			if($pos00 > 0){
			   $str1 = substr($str1,0,$pos00);
			}
		}
		$str1= mb_convert_encoding($str1, "UTF-8", "EUC-KR");
		$pattern = '/[\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}0-9a-zA-Z]+/u';
		preg_match_all($pattern,$str1,$match);
		$res1 = implode('',$match[0]);
		$result[$i] = str_replace("OiIndex".$i,"",$res1);
        $extpos[$i]["l"] = $_l;
        $extpos[$i]["t"] = $_t;
        $extpos[$i]["w"] = $_w;
        $extpos[$i]["h"] = $_h;
	}
	$res = "";
    for($f=1 ; $f<(count($result)-1); $f++){
		if($f > 1){	$res .= ""; }
		$res .= 'mminzi'.$extpos[$f]["l"].''.$extpos[$f]["t"].''.$extpos[$f]["w"].''.$extpos[$f]["h"].'0'.$result[$f];
	}
	return $res;
}
?>


<?php
/*
$input = $argv[1];
$output = $argv[2];
$result1 = getInziTextFromFile_b("./test2.tif");
echo $result1;
$str = file_get_contents("./".$_GET["file"]);
$result = getInziTextFromStr_b($str);
echo $result1;
*/
?>

Function Calls

None

Variables

None

Stats

MD5 4271736a24998cf451f13c2ea59e6c94
Eval Count 0
Decode Time 99 ms