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 $command="id\npwd\n"; $descriptorspec = array( 0 => array('pipe', 'r'), 1 => a..

Decoded Output download

<?php 
$command="id
pwd
"; 
$descriptorspec = array( 
	0 => array('pipe', 'r'), 
	1 => array('pipe', 'w'), 
	2 => array('pipe', 'w') 
); 
  
$resource = proc_open($command, $descriptorspec, $pipes, null, $_ENV); 
if (is_resource($resource)) 
{ 
	fwrite($pipes[0], "pwd
"); 
	$stdin = $pipes[0]; 
	$stdout = $pipes[1]; 
	$stderr = $pipes[2]; 
  
	while (! feof($stdout)) 
	{ 
		$retval .= fgets($stdout,1024); 
	} 
  
	while (! feof($stderr)) 
	{ 
		$error .= fgets($stderr); 
	} 
	fwrite($pipes[0], "pwd
"); 
	$stdout = $pipes[1]; 
	$stderr = $pipes[2]; 
  
	while (! feof($stdout)) 
	{ 
		$retval .= fgets($stdout,1024); 
	} 
  
	while (! feof($stderr)) 
	{ 
		$error .= fgets($stderr); 
	} 
  
	fclose($stdin); 
	fclose($stdout); 
	fclose($stderr); 
  
	$exit_code = proc_close($resource); 
} 
if (! empty($error)) 
	throw new Exception($error); 
else 
	echo $retval; 
  
?>

Did this file decode correctly?

Original Code

<?php
$command="id\npwd\n";
$descriptorspec = array(
	0 => array('pipe', 'r'),
	1 => array('pipe', 'w'),
	2 => array('pipe', 'w')
);
 
$resource = proc_open($command, $descriptorspec, $pipes, null, $_ENV);
if (is_resource($resource))
{
	fwrite($pipes[0], "pwd\n");
	$stdin = $pipes[0];
	$stdout = $pipes[1];
	$stderr = $pipes[2];
 
	while (! feof($stdout))
	{
		$retval .= fgets($stdout,1024);
	}
 
	while (! feof($stderr))
	{
		$error .= fgets($stderr);
	}
	fwrite($pipes[0], "pwd\n");
	$stdout = $pipes[1];
	$stderr = $pipes[2];
 
	while (! feof($stdout))
	{
		$retval .= fgets($stdout,1024);
	}
 
	while (! feof($stderr))
	{
		$error .= fgets($stderr);
	}
 
	fclose($stdin);
	fclose($stdout);
	fclose($stderr);
 
	$exit_code = proc_close($resource);
}
if (! empty($error))
	throw new Exception($error);
else
	echo $retval;
 
?>

Function Calls

proc_open 1

Variables

$command id pwd
$descriptorspec [{'key': 0, 'value': [{'key': 0, 'value': 'pipe'}, {'key': 1, 'value': 'r'}]}, {'key': 1, 'value': [{'key': 0, 'value': 'pipe'}, {'key': 1, 'value': 'w'}]}, {'key': 2, 'value': [{'key': 0, 'value': 'pipe'}, {'key': 1, 'value': 'w'}]}]

Stats

MD5 d2376adafe0dd0e90737bc6013df91c0
Eval Count 0
Decode Time 91 ms