Created
April 10, 2013 08:37
-
-
Save ivan1911/5352891 to your computer and use it in GitHub Desktop.
Simple php obfuscator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$infile=$_SERVER['argv'][1]; | |
$outfile=$_SERVER['argv'][2];if (!$infile || !$outfile) { | |
die("Usage: php {$_SERVER['argv'][0]} <input file> <output file>\n");} | |
echo "Processing $infile to $outfile\n"; | |
$data="ob_end_clean();?>"; | |
$data.=php_strip_whitespace($infile); | |
// compress data | |
$data=gzcompress($data,9); | |
// encode in base64 | |
$data=base64_encode($data); | |
// generate output text | |
$out='<?ob_start();$a=\''.$data.'\';eval(gzuncompress(base64_decode($a)));$v=ob_get_contents();ob_end_clean();?>'; | |
// write output text | |
file_put_contents($outfile,$out); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment