Last active
July 5, 2016 19:42
-
-
Save shemanaev/7655441 to your computer and use it in GitHub Desktop.
PHPLockIt decoder
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 | |
/* | |
PHPLockIt (new versions?) decoder | |
Usage: | |
`php _php_lockit_decoder.php5 <directory_in> <directory_out>` | |
*/ | |
if ($argv[1] == 'DECODE') { | |
$in = $argv[2]; | |
$output = $argv[3]; | |
$input = file_get_contents($in); | |
$out = str_replace('__FILE__', "'".$in."'", $input); | |
$out = str_replace('<?php', '', $out); | |
$out = preg_replace('/\?\>.*/i', '', $out); | |
$out = preg_replace('/echo\(.*return;/i', $step1, $out); | |
$out = str_replace('eval', 'echo', $out); | |
ob_start(); | |
eval($out); | |
$step1 = ob_get_contents(); | |
ob_end_clean(); | |
$step1 = str_replace('eval', 'echo', $step1); | |
$out = preg_replace('/echo\(.*return;/i', $step1, $out); | |
ob_start(); | |
eval($out); | |
$step2 = ob_get_contents(); | |
ob_end_clean(); | |
$step2 = str_replace('eval', 'echo', $step2); | |
$out = preg_replace('/echo\(.*\);/i', $step2, $out); | |
ob_start(); | |
eval($out); | |
$final = ob_get_contents(); | |
ob_end_clean(); | |
$final = "<?php\n".$final; | |
file_put_contents($output, $final); | |
} else { | |
mkdir($argv[2]); | |
$in = realpath($argv[1]); | |
$out = realpath($argv[2]); | |
$di = new RecursiveDirectoryIterator($in); | |
foreach (new RecursiveIteratorIterator($di) as $filename => $file) { | |
if (is_dir($filename)) continue; | |
$nf = str_replace($in, $out, $filename); | |
if (!is_dir(dirname($nf))) mkdir(dirname($nf), 0, true); | |
if ($file->getExtension() == 'php' && $filename != __FILE__) { | |
chdir(dirname($filename)); | |
echo exec(PHP_BINARY.' '.__FILE__.' DECODE "'.$filename.'" "'.$nf.'"'); | |
} else { | |
if ($filename != __FILE__) copy($filename, $nf); | |
} | |
echo str_replace($in, '', $filename)." done\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello,
not understand the functioning ... could post a script running? emviar or in my email?