. Thanks to // Hackers-IL et al. for the original code and header style. // // Adapted from the code available at // http://www-2.cs.cmu.edu/~dst/DeCSS/Gallery/css_descramble-js.txt // and distributed under the same licensing terms (i.e. "who knows"). // // This code is known to take input and produce gibberish output (in the // form of HTML charater entities: &#D; , where D is a decimal value // for [in this case] a single byte). The gibberish appears to match the // stuff produced by the javascript code. // // Known Bugs: // 1. Non 8-bit characters will cause trouble. The accept-charset value in // the form tag has been specified as "iso-8859-1", but some browsers might // ignore it. The output is indifferent to charset. // // Tested on the mighty www.sccs.swarthmore.edu: // * Debian GNU/Linux (Intel) v2.2r4 // * Apache 1.3.9 // * PHP 4.0.3pl1 // * (client) MSIE 5.1.3 for MacOS X; Character Set => "Western (Latin 1)" // // Changes Log: // // 6-Jan-2002 - original working transliteration // // Visit http://www.sccs.swarthmore.edu/users/02/tss/css-descramble.php // to try out the code. // We begin: // Circumvent PHP's dastardly, dastardly magic quotes, an awful feature that // mars an otherwise great language. Site admins might want to disable // get-magic-quotes-gpc in their php config file or an .htaccess file. // See http://www.php.net/manual/en/function.get-magic-quotes-gpc.php // for details. set_magic_quotes_runtime(0); // Thanks to hirose@tg.rim.or.jp, who put a variant of this code on // http://www.php.net/manual/en/function.get-magic-quotes-gpc.php if (get_magic_quotes_gpc()) { for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); ) $HTTP_POST_VARS{$k} = stripslashes($v); } ?> CSS Descrambler >3)^$t3)>>1)^$t3)>>8)^$t3)>>5)&0xff; $t3=($t3<<8)|$t6; $t6=$CSStab4[$t6]; $t5+=$t6+$t4; $ret .= chr(($CSStab1[ord($sec{$sec_index})]) ^ ($t5&0xff)); // Hackers-IL: *sec++ =CSStab1[*sec]^(t5&0xff); - This code is awful $sec_index++; $t5>>=8; } return $ret; } // If we've got input data, decrypt it and print it out. if(isset($HTTP_POST_VARS{'key'}) and isset($HTTP_POST_VARS{'sec'})) { echo "

Decryption results

\n"; echo "You may need to view source to get the most out of these results\n"; echo "Page down for the input form"; echo "

\n"; echo "

\n";
  echo "---BEGIN HTML ENTITY ENCODED DECRYPTED STUFF---";
  $decrypted_stuff =
    CSSdescramble($HTTP_POST_VARS{'sec'},$HTTP_POST_VARS{'key'});
  for($i = 0; $i < 0x800; $i++) {
    // Print a newline every 64 chars. It looks better in view source that way.
    if(!($i%64)) echo "\n";
    echo '&#'.ord($decrypted_stuff{$i}).';';
  }
  echo "\n---END HTML ENTITY ENCODED DECRYPTED STUFF---\n";
  echo "
\n"; } ?>

CSS Descrambler in PHP

Key: />

Sec:

A transliteration of the Javascript original by Tom Stepleton. v0.1, 6/Jan/2002