More actions
Created page with "Encodes a file as base64 gzip compressed payload file. <pre> <?php $input_file = 'info.php'; $output_file = 'x.php'; function removePhpTags($content) { $content = preg_replace('/^<\?php\s*/', '', $content); $content = preg_replace('/\s*\?>$/', '', $content); return $content; } $file_content = file_get_contents($input_file); $file_content = removePhpTags($file_content); $encoded = base64_encode(gzcompress($file_content)); $payload = "<?php eval(gzuncompress(base..." |
No edit summary |
||
Line 1: | Line 1: | ||
Encodes a file as base64 gzip compressed payload file. | Encodes a file as base64 gzip compressed payload file. | ||
< | <syntaxhighlight lang="php" line> | ||
<?php | <?php | ||
$input_file = 'info.php'; | $input_file = 'info.php'; | ||
Line 19: | Line 19: | ||
file_put_contents($output_file, $payload); | file_put_contents($output_file, $payload); | ||
?> | ?> | ||
</ | </syntaxhighlight> |
Latest revision as of 21:36, 28 November 2024
Encodes a file as base64 gzip compressed payload file.
<?php
$input_file = 'info.php';
$output_file = 'x.php';
function removePhpTags($content) {
$content = preg_replace('/^<\?php\s*/', '', $content);
$content = preg_replace('/\s*\?>$/', '', $content);
return $content;
}
$file_content = file_get_contents($input_file);
$file_content = removePhpTags($file_content);
$encoded = base64_encode(gzcompress($file_content));
$payload = "<?php eval(gzuncompress(base64_decode('$encoded')));?>";
file_put_contents($output_file, $payload);
?>