Advertisement
cdw1p

[PHP] Script Obfuscate 1.1

Mar 11th, 2019
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * Obfuscate V.1
  4. * Indonesian Coder
  5. */
  6. class obfuscate
  7. {
  8.     var $text,$string;
  9.     public function __construct()
  10.     {
  11.         #$this->string = self::cleanTxt($string);  
  12.     }
  13.     public function strToHex($string)
  14.     {
  15.         $this->text = bin2hex($string);
  16.         $this->text = chunk_split($this->text,2,"\x");
  17.         $this->text = "\x" . substr($this->text,0,-2);
  18.         return $this->text;
  19.     }
  20.     public function genStr($x=10)
  21.     {
  22.         $this->string = "qwertyuiopasdfghjklzxcvbnm";
  23.         $this->output = "";
  24.         for ($i=0; $i < $x; $i++) {
  25.             $this->output .= $this->string[rand(0,strlen($this->string) - 1)];
  26.         }
  27.         return $this->output;
  28.     }
  29.     public function cleanTxt($string)
  30.     {
  31.         return str_replace(['<?php','?>'], "", $string);
  32.     }
  33.     public function execute($string)
  34.     {
  35.         $this->content = "";
  36.         $this->content = self::cleanTxt($string);
  37.         $this->content = self::encode($this->content);
  38.         $this->content = self::strToHex($this->content);
  39.         $this->var1 = self::genStr(10);
  40.         $this->var2 = self::genStr(15);
  41.         $this->output = '$'.$this->var1.'= base64_decode("\x59\x6d\x46\x7a\x5a\x54\x59\x30\x58\x32\x52\x6c\x59\x32\x39\x6b\x5a\x51\x3d\x3d");$'.$this->var2.'=base64_decode("\x63\x33\x52\x79\x58\x33\x4a\x76\x64\x44\x45\x7a");@eval($'.$this->var1.'($'.$this->var2.'("'.$this->content.'")));';
  42.         return $this->output;
  43.     }
  44.     public function encode($string)
  45.     {
  46.         $this->text = str_rot13(base64_encode($string));
  47.         return $this->text;
  48.     }
  49. }
  50. final class apache27 extends obfuscate
  51. {
  52.     public function __construct()
  53.     {
  54.         echo " Simple Obfusate By Mr.Apache27 - Thanks To Indonesian Hacker Rules\n";
  55.         echo " Input File : ";
  56.         $file = trim(fgets(STDIN));
  57.         self::_run($file);
  58.     }
  59.     public function _run($file)
  60.     {
  61.         $file = file_get_contents($file) or die(self::msg("File Not FOund"));
  62.         $data = self::execute($file);
  63.         $output = '<?php /*Obfusate By Mr.Apache27*/ '.$data.' ?>';
  64.         self::msg("Success Obfusate , Genereting FIle....");
  65.         $files = self::genStr(15).".txt";
  66.         self::save($files,$output);
  67.         self::msg("File Name : {$files}");
  68.     }
  69.     public function save($file,$data){
  70.         $fp = @fopen($file, "a");
  71.         @fwrite($fp, $data);
  72.         @fclose($fp);
  73.     }
  74.     public function msg($data){
  75.         echo " [".date("h:i:s")."] {$data}\n";
  76.     }
  77. }
  78. new apache27();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement