Plugin Directory

Changeset 1392070


Ignore:
Timestamp:
04/11/2016 01:48:24 PM (10 years ago)
Author:
seraum
Message:

New ofuscation lib added

Location:
wp-obfuscator/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-obfuscator/trunk/README.txt

    r1032543 r1392070  
    33Tags: Security, obfuscation, wp-config.php
    44Requires at least: 3.5
    5 Tested up to: 4.0.1
    6 Stable tag: 0.5
     5Tested up to: 4.4.2
     6Stable tag: 0.6
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2222Be sure to make a copy of your wp-config.php file if it\'s not like the default wp-config-sample.php file.
    2323
     24Launch the obfuscation process when your site is ready or for testing purpose. Some plugins need to read wp-config.php file in plain text when you install them.
     25
    2426== Changelog ==
     27version 0.6 :
     28I have created a better obfuscation lib
     29
    2530version 0.5 :
    2631Add internationalization (fr_FR and en_EN languages)
  • wp-obfuscator/trunk/files/class/seraum_obf.php

    r1032393 r1392070  
    11<?php
     2
    23/*
     4
    35Author: Adrien Thierry
     6
    47Licence: GPLv2 or later
     8
    59http://seraum.com
     10
    611http://asylum.seraum.com
     12
    713http://hackmyfortress.com
     14
     15More info ? Need a better php obfuscator ? Contact us : http://seraum.com
     16
    817*/
    9 class Free_Obfusc
    10 {
    11     var $dic = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_/ ,.:!'=+;";
    12     function doIt($c, $it){for($i = 0; $i < $it; $i++){ $c = $this->h($c);}return $c;}
    13     function h($c)
     18
     19class Free_Obfusc{
     20
     21
     22    function doIt($code)
    1423    {
    15         $c = "?>" . $c;
    16         $this -> dic = str_shuffle($this -> dic);$mr = rand(1, strlen($this->dic));$ms = $this->di($mr);$c0 = unpack("H*", base64_encode(gzdeflate($this->r(base64_encode($c), $mr, $this -> dic))));
    17         $crf = $this->sr(rand(4, 10));$eval = $this->sr(rand(4, 10));$b64 = $this->sr(rand(4, 10));$unr = $this->sr(rand(4, 10));
    18         $gzinflate = $this->sr(rand(4, 10));$pack = $this->sr(rand(4, 10));$master = $this->sr(rand(4, 10));$ur = $this -> ur($unr);
    19         $rnd = $this->sr(rand(4, 10));$rnd2 = $this->sr(rand(4, 10));$fcrf = $this->cf($crf, '\$' . $rnd . ',\$' . $rnd2, 'return create_function(\$' . $rnd . ',\$' . $rnd2 . ');', $unr, "create_function");
    20         $rnd = $this->sr(rand(4, 10));$feval = $this->cf($eval, '\$' . $rnd, 'return eval(\$' . $rnd . ');', $unr, '$' . $crf);
    21         $rnd = $this->sr(rand(4, 10));$fb64 = $this->cf($b64, '\$' . $rnd, 'return base64_decode(\$' . $rnd . ');', $unr, '$' . $crf);
    22         $rnd = $this->sr(rand(4, 10));$fgz = $this->cf($gzinflate, '\$' . $rnd, 'return gzinflate(\$' . $rnd . ');', $unr, '$' . $crf);
    23         $rnd = $this->sr(rand(4, 10));$fpack = $this->cf($pack, '\$' . $rnd, 'return pack(\"H*\", \$' . $rnd . ');', $unr, '$' . $crf);
    24         $ret = "<?php ";$ret .= $this->cj();$ret .= $this->cj();$ret .= $this->cj();
    25         $ret .= "\$$master=$ms;";$ret .= $fcrf;$c1 = array();
    26         $c1[] = $ur; $c1[] = $this->cj();$c1[] = $fgz;
    27         $c1[] = $this->cj();$c1[] = $fb64;$c1[] = $this->cj();
    28         $c1[] = $feval;$c1[] = $this->cj();$c1[] = $fpack;shuffle($c1);
    29         $iA = count($c1);for($i = 0; $i < $iA; $i++){$ret .= $c1[$i];}$ret .= "\$$eval(\$$b64(" . $unr . "(\$$gzinflate(\$$b64(\$$pack(\"" . $c0[1] . "\"))), \$" . $master . ", \"" . $this -> dic . "\")));";
    30         $ret .= $this->cj();$ret .= $this->cj();$ret .= " ?>";
    31         return $ret;
     24        $round = 2;
     25        for($i = 0; $i < $round; $i++)
     26        {
     27            $code = $this->hideCode($code);
     28        }
     29        return $code;
    3230    }
    33     function ur($na = "r"){$function = 'function ' . $na . '($s, $n, $nb){$nb = $nb . $nb;$n = (int)$n % (strlen($nb) / 2);for ($i = 0, $l = strlen($s); $i < $l; $i++) {if(strpos($nb, $s[$i]) !== false){$s[$i] = $nb[(strpos($nb, $s[$i]) + (strlen($nb) / 2)) - $n];}}return $s;}';return $function;}   
    34     function r($s, $n, $nb){$nb = $nb . $nb;$n = (int)$n % (strlen($nb) / 2);for ($i = 0, $l = strlen($s); $i < $l; $i++){if(strpos($nb, $s[$i]) !== false){$s[$i] = $nb[strpos($nb, $s[$i]) + $n];}}return $s;}
    35     function cf($na, $arg, $c0, $ur, $cname){$dic = str_shuffle($this->dic);$i1 = rand(1, strlen($dic));$i2 = rand(1, strlen($dic));$arg = $this->r($arg, $i1, $dic);$c0 = $this->r($c0, $i2, $dic);$c0 = '$' . $na . ' = ' . $cname . '(' . $ur . '("' . $arg . '", ' . $i1 . ', "' . $dic . '"), ' . $ur . '("' . $c0 . '", ' . $i2 . ', "' . $dic . '"));';return $c0;}
    36     function cj(){$res = "";$a = rand(1, 2);if($a == 1){$var = "";$value = "";$n = rand(1, 10);for($i = 0; $i < $n; $i++){$var = $this->sr(rand(2, 10));$value = $this->sr(rand(1, 100));$tmp = '$' . $var . '="' . $value . '";';$res .= $tmp;}}else if($a == 2){$value = "";$n = rand(1, 4);for($i = 0; $i < $n; $i++){$value = "//" . $this->sr(rand(1, 1000)) . "\r\n";$res .= $value;}}return $res;}
    37     function sr($car){$string = "";$chaine = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";srand((double)microtime()*1000000);for($i=0; $i<$car; $i++){$string .= $chaine[rand()%strlen($chaine)];}return $string;}
    38     function di($int){$res = "";$tmpi = 0;while($int > 0){$tmpi = rand(0, $int);$int = $int - $tmpi;$res .= "$tmpi+";}$res = substr($res, 0, -1);return $res;}
     31
     32    function hideCode($code)
     33    {
     34    $code = "?>" . $code;
     35    $obf = unpack("H*", bin2hex(gzdeflate($code)))[1];
     36    $create = base64_encode("create_function");
     37    $pac = base64_encode("pack");
     38    $preg = base64_encode("preg_replace_callback");
     39    $h = base64_encode("H*");
     40    $hex = base64_encode("hex2bin");
     41    $gzi = base64_encode("gzinflate");
     42    $s = base64_encode("|.|");
     43    $point = base64_encode(".");
     44    $base64d = base64_encode("base64_decode");
     45    $evald = base64_encode("eval");
     46    $base64dname = $this->ivrandom(rand(4, 10));
     47    $base64dname2 = $this->ivrandom(rand(4, 10));
     48    $base64dname3 = $this->ivrandom(rand(4, 10));
     49    $base64dname4 = $this->ivrandom(rand(4, 10));
     50    $base64dname5 = $this->ivrandom(rand(4, 10));
     51    $base64dname6 = $this->ivrandom(rand(4, 10));
     52    $base64dname7 = $this->ivrandom(rand(4, 10));
     53    $base64dname8 = $this->ivrandom(rand(4, 10));
     54    $createname = $this->ivrandom(rand(4, 10));
     55    $pacname = $this->ivrandom(rand(4, 10));
     56    $pregname = $this->ivrandom(rand(4, 10));
     57    $hname = $this->ivrandom(rand(4, 10));
     58    $hexname = $this->ivrandom(rand(4, 10));
     59    $sname = $this->ivrandom(rand(4, 10));
     60    $gziname = $this->ivrandom(rand(4, 10));
     61    $pointname = $this->ivrandom(rand(4, 10));
     62    $evalname = $this->ivrandom(rand(4, 10));
     63    $randname = $this->ivrandom(rand(4, 10));
     64    $rot = $this->ivrandom(rand(4, 10));
     65    $arg1 = $this->ivrandom(rand(4, 10));
     66
     67    $strot = '$' . $this->ivrandom(rand(4, 10));
     68    $n = '$' . $this->ivrandom(rand(4, 10));
     69    $nbrot = '$' . $this->ivrandom(rand(4, 10));
     70    $strrot = str_shuffle('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_/ ,.:!');
     71    $randrot = rand(1, 100);
     72    $randclear = $randrot;
     73    $randrot = $this->decompose_int($randrot);
     74
     75    $frot = ' function ' .$rot . '(' . $strot . ', ' . $n . ', ' . $nbrot . ') {' . $nbrot . ' = ' . $nbrot . ' . ' . $nbrot . ';' . $this->create_aleat() . $n . ' = (int)' . $n . ' % (strlen(' . $nbrot . ') / 2);' . $this->create_aleat() . 'for ($i = 0, $l = strlen(' . $strot . '); $i < $l; $i++) {if(strpos(' . $nbrot . ', ' . $strot . '[$i]) !== false){' . $this->create_aleat() . $strot . '[$i] = ' . $nbrot . '[(strpos(' . $nbrot . ', ' . $strot . '[$i]) + (strlen(' . $nbrot . ') / 2)) - ' . $n . '];}}return ' . $strot . ';}';
     76
     77    $b64 = "base64_decode";
     78
     79    $evalf = ' eval($' . $arg1 . ');';
     80
     81    $evalo = unpack("H*", bin2hex($evalf));
     82    $evalb64 = $this->rot($b64, $randclear, $strrot);
     83    $result = '<?php ' . $this->create_aleat()  . '$' . $randname . ' = ' . $randrot . ';'  . $this->create_aleat()  . '$' . $base64dname . ' = ' . $rot . "('" . $evalb64 . '\', $' . $randname . ', \'' . $strrot . '\');' . $this->create_aleat() . '$' . $createname . ' = $' . $base64dname . '("' . $create . '");' . $this->create_aleat()  . '$' . $base64dname2 . ' = $' . $base64dname . ';' . $this->create_aleat()  . '$' . $pacname . ' = $' . $base64dname2 . '("' . $pac . '");' . $this->create_aleat()  . '$' . $base64dname3 . ' = $' . $base64dname2 . ';' . $this->create_aleat()  . '$' . $pregname . ' = $' . $base64dname . '("' . $preg . '");' . $this->create_aleat()  . '$' . $base64dname4 . ' = $' . $base64dname3 . ';' . $this->create_aleat()  . '$' . $hname . ' = $' . $base64dname . '("' . $h . '");' . $this->create_aleat()  . '$' . $base64dname5 . ' = $' . $base64dname4 . ';' . $this->create_aleat()  . '$' . $hexname . ' = $' . $base64dname . '("' . $hex . '");' . $this->create_aleat()  . '$' . $base64dname6 . ' = $' . $base64dname5 . ';' . $this->create_aleat()  . '$' . $sname . ' = $' . $base64dname . '("' . $s . '");' . $this->create_aleat()  . '$' . $base64dname7 . ' = $' . $base64dname6 . ';' . $this->create_aleat()  . '$' . $pointname . ' = $' . $base64dname7 . '("' . $point . '");' . '$' . $base64dname8 . ' = $' . $base64dname7 . ';' . $this->create_aleat()  . '$' . $gziname . ' = $' . $base64dname8 . '("' . $gzi . '");' . '$' . $evalname . ' = $' . $createname . '(\'$' . $arg1 . '\', $' . $hexname . '($' . $pacname . '($' . $hname . ', "' . $evalo[1] . '")));' . $this->create_aleat()  . '$' . $pregname . '($' . $sname . ',$' . $createname . '("", $' . $evalname . '($' . $gziname . '($' . $hexname . '($' . $pacname . '($' . $hname . ', "' . $obf . '"))))),$' . $pointname . ');' . $this->create_aleat()  . '' . $frot . '' . $this->create_aleat()  . '?>';
     84
     85    return $result;
     86    }
     87
     88    function decompose_int($int)
     89    {
     90        $res = "";
     91        $tmpi = 0;
     92        while($int > 0)
     93        {
     94            $tmpi = rand(0, $int);
     95            $int = $int - $tmpi;
     96            $res .= "$tmpi+";
     97        }
     98        $res = substr($res, 0, -1);
     99        return $res;
     100    }
     101    function ivrandom($car)
     102    {
     103        $string = "";
     104        $chaine = "abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
     105        srand((double)microtime()*1000000);
     106        for($i=0; $i<$car; $i++)
     107        {
     108            $string .= $chaine[rand()%strlen($chaine)];
     109        }
     110        return $string;
     111    }
     112
     113    function rot($s, $n, $nbrot)
     114    {
     115        $nbrot = $nbrot . $nbrot;
     116        $n = (int)$n % (strlen($nbrot) / 2);
     117        for ($i = 0, $l = strlen($s); $i < $l; $i++)
     118        {
     119            if(strpos($nbrot, $s[$i]) !== false)
     120            {
     121                $s[$i] = $nbrot[strpos($nbrot, $s[$i]) + $n];
     122            }
     123        }
     124        return $s;
     125    }
     126
     127    function unrot($s, $n = 13, $nbrot = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_/ ,.:!')
     128    {
     129        $nbrot = $nbrot . $nbrot;
     130        $n = (int)$n % (strlen($nbrot) / 2);
     131        for ($i = 0, $l = strlen($s); $i < $l; $i++)
     132        {
     133            if(strpos($nbrot, $s[$i]) !== false)
     134            {
     135                $s[$i] = $nbrot[(strpos($nbrot, $s[$i]) + (strlen($nbrot) / 2)) - $n];
     136            }
     137        }
     138        return $s;
     139    }
     140    function create_aleat()
     141    {
     142            $res = "";
     143            $a = rand(1, 2);
     144            if($a == 1)
     145            {
     146                $var = "";
     147                $value = "";
     148                $n = rand(1, 10);
     149                for($i = 0; $i < $n; $i++)
     150                {
     151                    $var = $this->ivrandom(rand(2, 10));
     152                    $value = $this->ivrandom(rand(1, 100));
     153                    $tmp = '$' . $var . '="' . $value . '";';
     154                    $res .= $tmp;
     155                }
     156            }
     157            else if($a == 2)
     158            {
     159                $value = "";
     160                $n = rand(1, 4);
     161                for($i = 0; $i < $n; $i++)
     162                {
     163                    $value = "//" . $this->ivrandom(rand(1, 1000)) . "\r\n";
     164                    $res .= $value;
     165                }
     166            }
     167           
     168            return $res;
     169    }
     170
    39171}
     172
    40173?>
  • wp-obfuscator/trunk/wpobfuscator.php

    r1032543 r1392070  
    44Plugin Title: WP-Obfuscator
    55Plugin URI: http://seraum.com
    6 Description: This extension obfuscate your wp-config.php file to make it unreadable by a hacker. Please, save your wp-config.php file before to obfuscate it.
     6Description: This extension obfuscate your wp-config.php file to make it unreadable by a hacker. Please, save your wp-config.php file before to obfuscate it. Launch obfuscation when your site is ready to production.
    77Author: Adrien Thierry
    8 Version: 0.5
     8Version: 0.6
    99Author URI: http://seraum.com/
    1010Text Domain: wpobfuscator
Note: See TracChangeset for help on using the changeset viewer.