Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 30-07-2009
Members
 
Join Date: May 2009
Posts: 44
Eval encoded file decoder

I am making a project in PHP where i am facing some issues with purchase script where i am using a very simple eval based encoding system i have try to think a lot and finally i have came to know how to decode the file by hand and following are the code for the same.

PHP Code:
<?php
// Open and read the content of the encoded file into a variable
$file file_get_contents('encoded_file1.php');

// Strip php tags
$file str_replace('<?php'""$file);
$file str_replace('<?'""$file);   // Make sure to get rid of short tags....
$file str_replace('?>'""$file);

// Strip new lines
$file str_replace("\n"""$file);

// Add semi colon to get around a parsing issue.
$file $file.';';

// Change the Eval function
$file str_replace('eval''echo '$file);

// Function to eval the new string
function demo()
{
  global 
$file;
  
ob_start();
  eval(
$file);
  
$contents ob_get_contents();
  
ob_end_clean(); 
  return(
$contents);
}  

// Run the code thru once
$file demol(); 

// Counter
$cnt 1;

// Loop it till it's decoded
while(preg_match('/^\?><\?php eval/'$file))
{
  
$file str_replace('?><?php eval''echo'$file);
  
$file str_replace('?><?'""$file);
  
$file deval();
  ++
$cnt;
}

//clean up some tags
$file str_replace('?><?php'""$file);
$file str_replace('?><?'""$file);

echo 
$cnt,' iterations<br/><br/>';
echo 
'<pre>';
echo 
$file;
echo 
'</pre>';
?>
Reply With Quote
  #2  
Old 30-07-2009
Member
 
Join Date: May 2008
Posts: 2,383
How to eval a php html file

After thinking a lot and taking many people and resources from different sites and book i have created code for ByteRun's encoding and at the same time i had a check it's really working very fine so there is no need of having any tension about the code if anyone finds more such kinds of code then please reply to this thread


PHP Code:
// Function to eval the new string 
function test() 

  global $file1, $_F, $_X; 
   
  ob_start(); 
  eval($file1); 
  $contents = ob_get_contents(); 
  ob_end_clean(); 
  return($contents); 


// Run the code 
$file1 = test(); 

$_X = base64_decode($_X); 

$file1 = str_replace('$_X=base64_decode($_X);', "", $file1); 


preg_match('/\$_X=strtr.*?\'\);/', $file1, $match2); 

$file1 = str_replace($match2[0], "", $file1); 

eval($match2[0]); 

$_R=ereg_replace('__FILE__',"'".$_F."'",$_X); 

$_R = ltrim($_R, '?><?php'); 
$_R = rtrim($_R, '
?>'); 

echo $_R; 
?>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Eval encoded file decoder"
Thread Thread Starter Forum Replies Last Post
Is there any decoder to play re4 extension file in VLC Lynch Windows Software 4 10-07-2011 08:04 PM
Jerk or slow motion when playing an MKV file encoded with real video codec in VLC Paul$Terry Windows Software 5 09-07-2011 10:40 PM
The eval() method in Java Isabella Software Development 6 11-08-2010 05:05 PM
How to read a h-264 encoded file. Captain Carrot Windows Software 6 04-05-2010 10:21 AM
Eval function in javascript Solaris Software Development 5 02-03-2010 05:59 PM


All times are GMT +5.5. The time now is 04:54 PM.