破解DVD格式,就是著名的DECSS (轉)

發表於2007-12-09
破解DVD格式,就是著名的DECSS (轉)[@more@]

#!/usr/bin/

# Dev 0.06 -- a utility for strip Cascading Style Sheet (CSS)
# information from an HTML page

# Copyright 2000, Mr. Bad of Pigdog Journal ().
# All Rights Reserved.

# This software is distributed under the Artistic License, which should have
# come with this file. Please distribute this software far and w.
# The original version can always be found on the World Wide at:
#

# THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
# WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

use Getopt::Std;
use strict; # Choosy software use's strict!

my($USAGE) = <DeCSS 0.06: a utility to strCascading Style Sheets (CSS) tags
  from HTML documents

USAGE: DeCSS [-h] [-i input file] [-o output file]

options:
 -h print this help message
  -i input file input file to strip (default: standard input)
  -o output file place to put the output (default: standard output)

END_OF_USAGE

my(%options);
local(*IN, *OUT);

getopts("hi:o:", %options);

if (exists $options{h}) {
  print $USAGE;
  exit(0);
}

if (exists $options{i}) {
  open(IN, "} else {
  open(IN, "}

if (exists $options{o}) {
  open(OUT, ">$options{o}") or die "Can't open $options{o}: $!n";
} else {
  open(OUT, ">&STDOUT") or die "Can't open STDOUT: $!n";
}

decssify(*IN, *OUT);

close(IN);
close(OUT);

sub decssify {
  local(*IN, *OUT) = @_;

  # Yeah, like -you- never slurp in entire files at a time.

  (IN); undef $/;

  my($content) = ;

  $content =~ s%%%mg; # Strip stylesheet links
  $content =~ s%%%mg; # Strip

相關文章