PHP Tutorial N-Layer encryption Gzinflate str_rot13 base64 cracking method based on Eval
PHP uses the str_rot13 (Base64_decode (' BASE64 encrypted content ')) to decrypt the core code of the eval (gzinflate)
PHP encryption method under non-expansion mode:
There's an online one here, and it's good. Trojan Kill is also OK, to protect the code can not be.
Corresponding to write a simple decryption,
specifically for Eval. This principle is very useful.
Special Note: This decryption program seems to have to be used in PHP5 above,
I tested it on PHP4. Code that is encrypted in the eval (gzinflate str_rot13 (' BASE64 encrypted content ')) is never decrypted correctly.
<?php
File contents that have been encrypted
$a = "eval (gzinflate (Base64_decode (' str_rot13)"));
function decodephp ($a) {
$max _level=300; Maximum number of layers
for ($i =0; $i < $max _level; $i + +) {
Ob_start ();
Eval (str_replace (' eval ', ' echo ', $a));
$a = Ob_get_clean ();
if (Strpos ($a, ' eval (gzinflate str_rot13 (Base64_decode ') ===false) {
return $a;
}
}
}
echo decodephp ($a);
?>
PHP uses n-tier encryption eval (Base64_decode ("Codes")) to crack the Gzinflate
First of all, this is not my original, I transferred from a foreign blog above. I tested it. I think it's very useful.
If you want to see the decryption of PHP's core code using the eval (str_rot13 base64_decode (' BASE64 encrypted content ')), please check here: Php uses eval (gzinflate (str_ ROT13 (Base64_decode (' BASE64 encrypted content ')) The decryption of the core code.
Special Note: This decryption program seems to have to be used in PHP5 above,
I tested it on PHP4. The encrypted code in the eval (gzinflate base64_decode ("Codes")) is always not decrypted properly
Here's the code:
<?php
/*
Taken from [Url]http://www.php.net/manual/de/function.eval.php#59862[/url]
Directions:
1. Save this snippet as decrypt.php
2. Save encoded PHP code in Coded.txt
3. Create a blank file called Decoded.txt (from Shell do CHMOD 0666 decoded.txt)
4. Execute This script (visit decrypt.php in a Web browser or does PHP decrypt.php in the shell)
5. Open Decoded.txt, the PHP should is decrypted if not post the "code on" [Url]http://www.ariadoss.com/forums/web-developme Nt/lamp[/url]
Gzinflate The decryption method that executes the cryptographic code is translated into Chinese after the text (the original version of the Chinese characters are not. Hey)
1. Save the entire script as decrypt.php
2. Save the code that needs to be decrypted as Coded.txt and decrypt.php in the same directory.
3. Create a blank file named Decoded.txt (the Decoded.txt permission must be set to chmod 0666, which is writable). Of course, you can not create a file file. As long as the folder has write permissions, The script automatically creates a document named Decoded.txt.
4. Run the decryption script (run decrypt.php in the browser to access http://your domain name/storage directory/decrypt.php)
5. Open Decoded.txt, The code should have been decrypted and, if an error occurs, send the code to [Url]http://www.ariadoss.com/forums/web-development/lamp[/url]
*/
Echo Ndecode Nested eval (gzinflate ()) by Debo Jurgen <mailto:jurgen@person.benn ";
Echo 1. Reading Coded.txtn ";
$fp 1 = fopen ("Coded.txt", "R");
$contents = fread ($fp 1, filesize ("Coded.txt"));
Fclose ($fp 1);
Echo 2. DECODINGN ";
while (Preg_match/eval (gzinflate/, $contents)) {
$contents =preg_replace ("/<?|?"). >/"," ", $contents); Eval (preg_replace ("/eval/", "$contents =", $contents)); } echo "3. Writing Decoded.txtn "; $FP 2 = fopen ("Decoded.txt", "w"); Fwrite ($fp 2, Trim ($contents)); Fclose ($fp 2);
?
Simply say Gzinflate,eval (gzinflate base64_decode ("Codes"));d the way Ecoding-eval-gzinflate-base64_decode is used.
Save the above program file decrypt.php,
Of course the file name can be set itself.
Create a coded.txt in the same directory as this file,
This contains the encrypted code, which is the eval (gzinflate base64 _decode ("Codes")) codes;
to be clear is to decrypt the gzinflate (Base64_decode ("Codes")) that executes inside the secret text. The
executes the saved file decrypt.php so that a decoded.txt txt document is generated in the same directory,
opens the document. Inside is the original code that was encrypted.