Quick Search:
 
 PHP Code: Base 64 Decode Jump to:  
Category: >> PHP Code >> Base 64 Decode  

<< lastnext >>

Snippet Name: Base 64 Decode

Description: I recently ran across a freeware web application written in PHP that utilized the following method to encrypt its source code. You can decode the encoded script with this PHP snippet.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 28th, 2009

<?PHP 
 
// sample is encoded like this:
// eval(gzinflate(base64_decode('encoded text'))); 
 
 
ECHO "\nDECODE nested eval(gzinflate()) by DEBO Jurgen <[email protected]>\n\n";
ECHO "1. Reading coded.txt\n";
$fp1 = FOPEN ("coded.txt", "r");
$contents = FREAD ($fp1, FILESIZE ("coded.txt"));
FCLOSE($fp1);
ECHO "2. Decoding\n";
WHILE (PREG_MATCH("/eval\(gzinflate/",$contents)) {
$contents=PREG_REPLACE("/< \?|\?>/", "", $contents);
EVAL(PREG_REPLACE("/eval/", "\$contents=", $contents));
}
ECHO "3. Writing decoded.txt\n";
$fp2 = FOPEN("decoded.txt","w");
FWRITE($fp2, TRIM($contents));
FCLOSE($fp2);
 
/*
1.) Save the code you wish to decode in coded.txt
2.) Save the above PHP snippet in file like decrypt.php
3.) Create an empty text file called decoded.txt and it CHMOD it to 0666.
4.) Run decrypt.php and open up decoded.txt to view the source code.
*/
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org