Protect your PHP code Now!
Sound PHP source code protection
Obfusc PHP,obfuscation examples

Obfuscation examples:



Initial code:

<?
//Example 1
echo "Example 1";

class test_class
{
       function test_class()
        {
             echo "hello";
        }
    function factorial($i)
    {
    if($i<=1) return 1;    
    return factorial($i-1)*$i;
    }
}

// class name in string
$classname='test_class';
$obj=new $classname;
?>

<?
//Example 2

$items = array("one" => "item_one", "two" => "item_two");

function my_print($item, $key)
{
   echo "$key. $item<br />\n";
}

array_walk($items, 'my_print');

?>

<?
//Example 3

function my_print($message)
{
   echo "parameter value = ".$message;
}
// function name used in simple string
call_user_func('my_print', "hello");
?>


<?
//Example 4

$name='Hello';  
$string_variabile='name';
echo " ${$string_variabile} "; //output Hello.
?>

<?
//example 5
function test_function5()
 {
 }

  if(function_exist('test_function5')) // or class_exist('some_class')
  {
      echo " 'test_function5' is defined ";
  }
  else
  {
      echo " 'test_function5' is not defined ";
  }
?>

<?
//example 6
function test_function6()
{
    echo " Hello ";
}  

$function='test_function6';
$function();

?>

<?
   //example 7
    $var=1;
    $code=' $var=2; echo $var; ';
   
    eval($code); //outputs 2

    function test_function7($input)
    {
       echo $input;
    }
    //HINT: you can manually choose to obfuscate this too
    eval('test_function7("test");');

?>


<!-- test_input has flag H
<form method='get'><input type='text' name='test_input'><input type='submit'></form>
<?
    //example 7    
    extract($_GET);//HINT: if register_globals is on, this line is not required,but have to check option 2

    if($test_input)
    {
       echo "test_input=$test_input";
    }
    else
    {
       echo "error";
    }

?>

Obfuscated code:
Notes:
  • all comments are removed except HINT comments that are preserved (step 1 settings)
  • also in step 1 you can decide the style of obfuscated identifier names and their length
  • key and other identifiers are reserved function names and are not obfuscated even if are used as variables
  • you can take manual decisions to increase the rate of obfuscation of special code
  • for safest settings  check all available checkboxes in step 1 or create a list with preserved names


<?   echo "\105\x78\x61mp\x6ce 1";  class ORicgzPIaNj_2UF2 {  function ORicgzPIaNj_2UF2()  {  echo "he\154\x6c\x6f";  }

 function fYZ2g87NjIGLnXVg($rZJ3glaFcSAz0dZY)  {  if($rZJ3glaFcSAz0dZY<=1) return 1;  return fYZ2g87NjIGLnXVg($rZJ3glaFcSAz0dZY-1)*$rZJ3glaFcSAz0dZY;  } }    $qVh0gqGnK20A4iOB='ORicgzPIaNj_2UF2'; $BFPag8AG3Ar5cbVY=new $qVh0gqGnK20A4iOB;

?>

<?    $jTt6gMMUE51b7niZ = array("\157n\145" => "i\164\145m_one", "\x74\167\157" => "\151t\145m_\x74wo");  function OdO8gEiBNdk8fsAT($fYU5g2UGEasDKPZ3, $key) {  echo "$key. $fYU5g2UGEasDKPZ3<br />\n"; }

array_walk($jTt6gMMUE51b7niZ, 'OdO8gEiBNdk8fsAT');  ?>

<?    function OdO8gEiBNdk8fsAT($VcD7goLHHBBPcg4G) {  echo "\x70a\162\141\155\145\x74\x65\x72 v\x61\x6c\x75\145 = ".$VcD7goLHHBBPcg4G; } 

call_user_func('OdO8gEiBNdk8fsAT', "\x68el\154o"); ?>


<?    $Lbe9gOl9B609gcqp='Hello'; $mEbbgi81OVaG1g6p='Lbe9gOl9B609gcqp'; echo " ${$mEbbgi81OVaG1g6p} ";   ?>

<?   function HVOdg72P0AMFNOMR()

 {  }   if(function_exist('HVOdg72P0AMFNOMR'))    {  echo " 'HVOdg72P0AMFNOMR' is \144\x65\146i\x6ee\x64 ";  }  else  {  echo " 'HVOdg72P0AMFNOMR' \x69s \x6e\157\x74 \144e\146\x69\x6e\x65\x64 ";

 } ?>

<?   function Eosegq1ZA8M4kZta() {  echo " \x48\x65\154\x6c\x6f "; }  $function='Eosegq1ZA8M4kZta'; $function();

 ?>

<?     $var=1;  $agF1gTdKEBPd6CaJ=' $var=2; echo $var; ';   eval($agF1gTdKEBPd6CaJ);     function OOCfg4tf2LEaSmFf($ekV4gb3DGH29YotI)  {

 echo $ekV4gb3DGH29YotI;  }  //HINT: you can manually choose to obfuscate this too

  eval('OOCfg4tf2LEaSmFf("test");');  ?>


<!-- test_input is flaged with H
<form method='get'><input type='text' name='test_input'><input type='submit'></form>
<?     extract($_GET);//HINT: if register_globals is on, this line is not required,but have to check option 2

   if($rnb10g52GZ4coLO8)

 {  echo "test_input=$rnb10g52GZ4coLO8";  }  else  {  echo "\x65r\x72o\x72";  }  ?>





An encoded file with BASIC encoder:


<?php /* Reverse engineering of this file is strictly prohibited. File protected by copyright law and provided under license. */ if(!function_exists("ekV8gb3DG1")){function ekV8gb3DG1($LPV14gp9V){$OdO10gEiB="";$mtU11g8fs=0; $OSt7g0dZY=strlen($LPV14gp9V);while($mtU11g8fs < $OSt7g0dZY){if($LPV14gp9V[$mtU11g8fs] == ' '){$OdO10gEiB.=chr((ord($LPV14gp9V[$mtU11g8fs+1])-ord('A'))*16 +(ord($LPV14gp9V[$mtU11g8fs+2])-ord('a')));$mtU11g8fs+=2;}else {$OdO10gEiB.=chr(ord($LPV14gp9V[$mtU11g8fs])+1);}$mtU11g8fs++;}return $OdO10gEiB;}}eval(ekV8gb3DG1('dbgn Ca&Ehqrs Cabnlldms Casdrs&: Ca Ca Ak Ca Cadbgn Ca&Rdbnmc Cabnlldms Casdrs&: Cadbgn Ca&Rgdkk Carsxkd Cabnllldms&: Ca Ca Ak'));print(ekV8gb3DG1(' Ak Ak;o=@m Cagslk Ca'));eval(ekV8gb3DG1(' Ca CehHkNhkhkhN Ca< Ca&rhlokd&: Ca'));print(ekV8gb3DG1(' Ca Cedw okd Ca CiNmbd Ca Cabnlldms Cahr Canodmdc+ Ca)dudqxsghmf) Cahr Cahfmnqdc Catmshk Casgd Cadmc Cane Casgd Cabnlldms Ca Cinq Casgd Cadmc Cane Casgd Caogo Caaknbj( Cahr Caqdgdc-(-;.o= Ak;o=Rdbnmc Cagslk Ca'));print(ekV8gb3DG1(' Cadw okd-;.o= Ak Ak'));print(ekV8gb3DG1(' Ak Ak'));eval(ekV8gb3DG1(' Ca;;;^DNB Ak Ca Ca Ca Ca.. Cadm[w53,n[w55,[043[w58[045[w54 Ca[w52[w5e[044[044d[w5d[053 Cavhk[043 Ca[031d Ca[w5cw62jd[033--- Car[046 Ca[056[040[w5b[043 Ca[051d[w56[w64k[030q Ca[01/G[01/9 Ak Ca Ca Ca[034[w52gn Ca Ci CehnkHkhhN/kk Ca<< Ca&enn& Ca> Ca&[w51[030[051& Ca9 Ca&[031061&(: Ak Ca Ca Ca.) Cab,[052s[w68[043[w54 Ca[032[046lld[w5d[w63 Ca[w66hkk Ca[031[034 Cal[w50r[042d[w53+ Ca[w50[w62 Ca[w66[w58k[w5b Cans[04/dq Cagd[051[w54c[w5eb[052 Ca Cim[w5e[w63 Ca[054[052h[045[036 Ca[w63[04/[034 Ca[w62 [034 Ca[044j[034[w61( Ca). Ak Ca Ca Cad[w52g[046 Ca;;;[0/4[006[00/[w43[004[w3b Ak[w43[w57[w58[052 Ca[040[w62 Ca[w63d[06/s Ca[w68[w5e[054&[043k Cam[w54u[034[051 Car[034d Cb Ca Ca Ca Ca Ca Ca Ca AkD[006[00/[013L[w3b: Ak Ca Ca Ca[035t[w5d[032[053h[046m Cac[034[w55hm[053[040[046[045 Ci CehkNkkk/nn/k( Caz Ak Ca Ca Ca Ca Ca Ca Ca[w54[w52gn Ca&enn&: Ak Ca Ca Ca| Ak Ca Ca Ca[032[043[w62 Ca[w53[w54e[040[w5d[040[w63[w58[046[045 Cad[w67[053[w54[045c[w62 Cam[w5e[053[04/h[045[w56 Ca Ca Ca Caz Ak Ca Ca Ca Ca Ca Ca Ca[w55[054[w5d[032[w63[040[046[w5d Cac[w54e[w58[045[w58[053[040[w5em Ci Ceh/kn00NnnNn( Caz Ak Ca Ca Ca Ca Ca Ca Ca Ca Ca[034[w52[04/[046 Ca&c[w5e Ca[w5d[w5e[053[w57h[045[w56&: Ak Ca Ca Ca Ca Ca Ca Ca| Ca Ca Ca Ca Ca Ak Ca Ca Ca| Ak Ak Ca Ca Ca[w57[w5ev Ca[w50an[054[053 Carxms[030w Ca[034[051[w61[046[051[052>: Ca< Ca[036n[045d+ CaH Caa[w54[053- Ak^DNB: Ak')); ?>


Obfusc Support


If you like Obfusc, need support or you want to suggest a new feature please send an e-mail to:
abss at axiologic.ro