SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | // original link: https://pastebin.com/ac8r3q81 | |
3 | // father link: http://thehackernews.com/2012/03/carbylamine-php-encoder-make-php-files.html | |
4 | function rstr() //Random String Function | |
5 | { | |
6 | $len=rand(3,6); | |
7 | $chr=''; | |
8 | for($i=1;$i<=$len;$i++) | |
9 | { | |
10 | $chr.=rand(0,1) ? chr(rand(65,90)) : chr(rand(97,122)); | |
11 | } | |
12 | return $chr; | |
13 | } | |
14 | function enjumble($data) //Custom Encoding + Base64 + gzinflate() | |
15 | { | |
16 | for($i=0;$i<strlen($data);$i++) | |
17 | { | |
18 | $data[$i]=chr(ord($data[$i])+1); | |
19 | } | |
20 | return base64_encode(gzdeflate($data,9)); | |
21 | } | |
22 | function striptag($in) //Remove '<?php' from initial code | |
23 | { | |
24 | $pos = strpos($in,"<?php"); //to do: add support for short_tags | |
25 | if(is_numeric($pos)) | |
26 | { | |
27 | for($i=$pos;$i<=$pos+4 && strlen($in) >=5;$i++) | |
28 | { | |
29 | $in[$i]=' '; | |
30 | } | |
31 | return $in; | |
32 | } | |
33 | else | |
34 | { | |
35 | return $in; | |
36 | } | |
37 | } | |
38 | function makeoutfile($str) | |
39 | { $funcname=rstr(); | |
40 | $varname='$'.rstr(); | |
41 | $template= | |
42 | "<?php function ".$funcname."($varname) | |
43 | { | |
44 | $varname=gzinflate(base64_decode($varname)); | |
45 | for(\$i=0;\$i<strlen($varname);\$i++) | |
46 | { | |
47 | ".$varname."[\$i] = chr(ord(".$varname."[\$i])-1); | |
48 | } | |
49 | return $varname; | |
50 | }eval($funcname(\""; | |
51 | $str=enjumble($str); | |
52 | $template = $template . $str."\"));?>"; | |
53 | return $template; | |
54 | } | |
55 | function main($argc,$argv) | |
56 | { | |
57 | $banner= | |
58 | "\n +-------------------------------------------------------------------+ | |
59 | |+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| | |
60 | |+ +| | |
61 | +____ _ _ _ +| | |
62 | / __ \ | | | | (_) +| | |
63 | | / \/ __ _ _ __ | |__ _ _ | | __ _ _ __ ___ _ _ __ _+|_ | |
64 | | | / _` || '__|| '_ \ | | | || | / _` || '_ ` _ \ | || '_ \ / _ \ | |
65 | | \__/\| (_| || | | |_) || |_| || || (_| || | | | | || || | | || __/ | |
66 | \____/ \__,_||_| |_.__/ \__, ||_| \__,_||_| |_| |_||_||_| |_| \___| | |
67 | |+ __/ | +| | |
68 | |+ Carbylamine PHP Encoder +| | |
69 | |+ v0.1.1 Nightly +| | |
70 | |+ +| | |
71 | |+ +| | |
72 | |+ Coded by Prakhar Prasad +| | |
73 | |+ (prakharpd@gmail.com) +| | |
74 | |+ +| | |
75 | |+ +| | |
76 | |+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| | |
77 | +-------------------------------------------------------------------+\n\n"; | |
78 | $usage="$banner Syntax: ".$_SERVER['PHP_SELF']." <file to encode> <output file>\n"; | |
79 | if($argc==1) {echo $usage ; die();} | |
80 | if($argc>1) $file = $argv[1]; | |
81 | if($argc>2) $outfile = $argv[2]; | |
82 | if(empty($file) || empty($outfile)) { echo "Input/Output filename not entered!\n\n\x07" ;die();} | |
83 | if(!file_exists($file)) | |
84 | { | |
85 | echo "$banner Error: Input file doesn't exist\n\n\x07"; | |
86 | } | |
87 | else{ | |
88 | $orginal_size=round(filesize($file)/1024,2); | |
89 | echo "$banner Encoding : $file ($orginal_size KB) \n\n "; | |
90 | $output_filename=$outfile; | |
91 | $outfile=fopen($outfile,'w+'); | |
92 | $file=fread(fopen($file,'r'),filesize($file)); | |
93 | $outdata=makeoutfile(striptag($file)); | |
94 | $newsize=round(strlen($outdata)/1024,2); | |
95 | echo " Compression : ".@round(100-(($newsize*100)/($orginal_size!=0?$orginal_size:1)),2)."%\n\n"; | |
96 | if(!fwrite($outfile,$outdata)) | |
97 | { | |
98 | echo " Unable to write to $output_filename\n\n\x07"; | |
99 | } | |
100 | else | |
101 | { | |
102 | echo " Successfully Encoded! to $output_filename\n\n" ; | |
103 | }}} | |
104 | main($argc,$argv); | |
105 | ?> |