ALeX: Code Twister Demo
Author: ALeX Kazik
Keywords: alx alex kazik amiga home hoempage mac macintosh apple video macosx

URL: http://alex.kazik.de/twister_demo1.html
demo.php 638 Bytes | `<?php // This is an example of an use of twister.php // defines define('DEVELOP', true); define('TEST', 'test'); require_once('demo.function.php'); // print welcome echo /*FILELOADER*/ file_get_contents('demo.welcome.txt'); // GLOBALS $DEMO = 'demo'; $TEST = TEST; $CHECK = 'check'; // evaluate a string, containing a variable $IN = 'strrev(\'abcdef\')'; eval(/*VAR*/'$OUT'.' = '.$IN.';'); // call the function use_me($OUT, $IN, TEST); // call the function by variable $fn = /*FUNCTION*/ 'use_me'; $fn($IN, $OUT, TEST); // debug if(DEVELOP){ var_dump($OUT); } ?>`
demo.function.php 376 Bytes | `<?php // this is an example function function use_me($setDEMO, $setTEST, $setCHECK){ global $DEMO; $DEMO = $setDEMO; $GLOBALS['TEST'] = $setTEST; $CHECK = $setCHECK; } // example of removing function kill_me(){ // this function will be removed, // cause it's not in use do{ something(); }while(true); } ?>`
demo.welcome.txt 8 Bytes | `welcome`
output |
    Welcome to PHP Code Twister V0.7 - (c) 2003 ALeX Kazik
    [ Loading file demo.php ]
    [ Loading file demo.function.php ]
    [ Define, Name substituation precheck ]
    [ Packit, Fileloader ]
    [ Loading file -PACKIT- ]
    [ Scan and Remove ]
    Note: removing function kill_me in "demo.function.php" on line 13
    Note: the global variable $CHECK is used only once
    [ Name substituation ]
    Note: the local variable $CHECK in function use_me is used only once
final (linebreaks added automatically) 256 Bytes | `<?php function a($b,$c,$d){global$a;$a=$b;$GLOBALS['b']=$c; $e=$d;}echo b(1,'d2VsY29tZQo=');$a='demo';$b='test'; $c='check';$d='strrev(\'abcdef\')';eval('$e'.' = '.$d.';'); a($e,$d,'test');$f='a';$f($d,$e,'test'); function b($a,$b){return base64_decode($b); }?>`
debugging output
stage1 after include 972 Bytes | `<?php // This is an example of an use of twister.php // defines define('DEVELOP', true); define('TEST', 'test'); // this is an example function function use_me($setDEMO, $setTEST, $setCHECK){ global $DEMO; $DEMO = $setDEMO; $GLOBALS['TEST'] = $setTEST; $CHECK = $setCHECK; } // example of removing function kill_me(){ // this function will be removed, // cause it's not in use do{ something(); }while(true); } // print welcome echo /*FILELOADER*/ file_get_contents('demo.welcome.txt'); // GLOBALS $DEMO = 'demo'; $TEST = TEST; $CHECK = 'check'; // evaluate a string, containing a variable $IN = 'strrev(\'abcdef\')'; eval(/*VAR*/'$OUT'.' = '.$IN.';'); // call the function use_me($OUT, $IN, TEST); // call the function by variable $fn = /*FUNCTION*/ 'use_me'; $fn($IN, $OUT, TEST); // debug if(DEVELOP){ var_dump($OUT); } ?>`
stage2 after replacing defines and packit 1095 Bytes | `<?php // This is an example of an use of twister.php // defines /*d1*//*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*/ // this is an example function function use_me($setDEMO, $setTEST, $setCHECK){ global $DEMO; $DEMO = $setDEMO; $GLOBALS['TEST'] = $setTEST; $CHECK = $setCHECK; } // example of removing function kill_me(){ // this function will be removed, // cause it's not in use do{ something(); }while(true); } // print welcome echo PHP_CODE_TWISTER_PACKIT_FUNCTION(1,'d2VsY29tZQo='); // GLOBALS $DEMO = 'demo'; $TEST = 'test'; $CHECK = 'check'; // evaluate a string, containing a variable $IN = 'strrev(\'abcdef\')'; eval(/*VAR*/'$OUT'.' = '.$IN.';'); // call the function use_me($OUT, $IN, 'test'); // call the function by variable $fn = /*FUNCTION*/ 'use_me'; $fn($IN, $OUT, 'test'); // debug if(false){ var_dump($OUT); } function PHP_CODE_TWISTER_PACKIT_FUNCTION($p, $t){ return base64_decode($t); } ?>`
stage3 after removing unused 1196 Bytes | `<?php // This is an example of an use of twister.php // defines /*d1*//*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*/ // this is an example function function use_me($setDEMO, $setTEST, $setCHECK){ global $DEMO; $DEMO = $setDEMO; $GLOBALS['TEST'] = $setTEST; $CHECK = $setCHECK; } // example of removing /*r1*/ /*r1*//*r1*//*r1*//*r1*/ // this function will be removed, // cause it's not in use /*r1*//*r1*/ /*r1*//*r1*//*r1*//*r1*/ /*r1*//*r1*//*r1*//*r1*//*r1*//*r1*/ /*r1*/ // print welcome echo PHP_CODE_TWISTER_PACKIT_FUNCTION(1,'d2VsY29tZQo='); // GLOBALS $DEMO = 'demo'; $TEST = 'test'; $CHECK = 'check'; // evaluate a string, containing a variable $IN = 'strrev(\'abcdef\')'; eval(/*VAR*/'$OUT'.' = '.$IN.';'); // call the function use_me($OUT, $IN, 'test'); // call the function by variable $fn = /*FUNCTION*/ 'use_me'; $fn($IN, $OUT, 'test'); // debug /*r2*//*r2*//*r2*//*r2*//*r2*/ /*r2*//*r2*//*r2*//*r2*//*r2*/ /*r2*/ function PHP_CODE_TWISTER_PACKIT_FUNCTION($p, $t){ return base64_decode($t); } ?>`
stage4 after name substituation 1046 Bytes | `<?php // This is an example of an use of twister.php // defines /*d1*//*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*//*d1*/ /*d1*//*d1*//*d1*/ // this is an example function function a($b, $c, $d){ global $a; $a = $b; $GLOBALS['b'] = $c; $e = $d; } // example of removing /*r1*/ /*r1*//*r1*//*r1*//*r1*/ // this function will be removed, // cause it's not in use /*r1*//*r1*/ /*r1*//*r1*//*r1*//*r1*/ /*r1*//*r1*//*r1*//*r1*//*r1*//*r1*/ /*r1*/ // print welcome echo b(1,'d2VsY29tZQo='); // GLOBALS $a = 'demo'; $b = 'test'; $c = 'check'; // evaluate a string, containing a variable $d = 'strrev(\'abcdef\')'; eval(/*VAR*/'$e'.' = '.$d.';'); // call the function a($e, $d, 'test'); // call the function by variable $f = /*FUNCTION*/ 'a'; $f($d, $e, 'test'); // debug /*r2*//*r2*//*r2*//*r2*//*r2*/ /*r2*//*r2*//*r2*//*r2*//*r2*/ /*r2*/ function b($a, $b){ return base64_decode($b); } ?>`
files | `<?php $files = array ( 'include' => array ( ), 'include_once' => array ( ), 'require' => array ( ), 'require_once' => array ( 'demo.function.php' => 1, ), 'fileloader' => array ( 'demo.welcome.txt' => 1, ), ); ?>`
scan | `<?php $scan = array ( 'global' => array ( 'DEMO' => 2, 'TEST' => 2, 'CHECK' => 1, 'IN' => 4, 'OUT' => 3, 'fn' => 2, ), 'function' => array ( 'use_me' => -2, 'php_code_twister_packit_function' => -1, 'base64_decode' => 1, ), 'class' => array ( ), 'method' => array ( ), 'member' => array ( ), 'fn_global' => array ( 'use_me' => array ( 'DEMO' => 1, ), 'php_code_twister_packit_function' => array ( ), ), 'fn_local' => array ( 'use_me' => array ( 'setDEMO' => 2, 'setTEST' => 2, 'setCHECK' => 2, 'CHECK' => 1, ), 'php_code_twister_packit_function' => array ( 'p' => 1, 't' => 2, ), ), 'me_global' => array ( ), 'me_local' => array ( ), 0 => 1, ); $replace = array ( 'global' => array ( 'DEMO' => 'a', 'TEST' => 'b', 'CHECK' => 'c', 'IN' => 'd', 'OUT' => 'e', 'fn' => 'f', ), 'function' => array ( 'use_me' => 'a', 'php_code_twister_packit_function' => 'b', ), 'class' => array ( ), 'method' => array ( ), 'member' => array ( ), 'fn_local' => array ( 'use_me' => array ( 'setDEMO' => 'b', 'setTEST' => 'c', 'setCHECK' => 'd', 'CHECK' => 'e', ), 'php_code_twister_packit_function' => array ( 'p' => 'a', 't' => 'b', ), ), ); ?>`
©2003 ALeX Kazik · last update 06. Oct 2003