View difference between Paste ID: K0vaAPAH and DN1bQcnC
SHOW: | | - or go back to the newest paste.
1
<?php
2
/**
3
 coded by shutdown57
4
**/
5
error_reporting(0);
6
$input=$argv[1];
7
$output=$argv[2];
8
echo "shutdown57 Obfuscator\n";
9
echo PHP_EOL;
10
if(empty($input) && empty($output))
11
{
12
	echo "Usage :: php $argv[0] original-file.php output.php \n";
13
	exit;
14
}
15
function strToHex($string){
16
 $field=bin2hex($string);
17
$field=chunk_split($field,2,"\x");
18
$field= "\x" . substr($field,0,-2);
19
return $field;
20
}
21
function RandomString()
22
{
23
    $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
24
    $randstring = '';
25
    for ($i = 0; $i <=5; $i++) {
26
        @$randstring.= $characters[rand(0, strlen($characters))];
27
    }
28
    return $randstring;
29
}
30
31
function obfuscate($text)
32
{
33
	$var = RandomString();
34
	$var2 = RandomString();
35
36
	$res = str_rot13(base64_encode($text));
37
38
	$content='$'.$var.'="\x73\x74\x72\x5f\x72\x6f\x74\x31\x33";$'.$var2.'="\x62\x61\x73\x65\x36\x34\x5f\x64\x65\x63\x6f\x64\x65";@eval($'.$var2.'($'.$var.'("'.$res.'")));';
39
	$hex=strToHex($content);
40
	return $content;
41
}
42
43
function create_result($result,$output)
44
{
45
	$var = "shutdown57_".RandomString();
46
	$content ='<?php /* Obfuscate by shutdown57 < [email protected] > */ ';
47
	$result = strToHex($result);
48
	$content.= '$'.$var.'="'.$result.'";@eval($'.$var.'); ?>';
49
	return file_put_contents($output,$content);
50
}
51
function cleanInput($text)
52
{
53
	$x=str_replace(['<?php','?>'],"",$text);
54
	return $x;
55
}
56
$input = cleanInput(file_get_contents($input));
57
$obs = obfuscate($input);
58
if(create_result($obs,$output))
59
{
60
	echo "DONE => $output \n";
61
}else{
62
	echo "FAILED !!\n";
63
}