#!/usr/bin/perl # The DMCA says: "a person who has lawfully obtained the right to use a copy of # a computer program may circumvent a technological measure that effectively # controls access to a particular portion of that program for the sole purpose # of identifying and analyzing those elements of the program that are necessary # to achieve interoperability of an independently created computer program with # other programs... to the extent that any such acts of identification and # analysis do not constitute infringement under this title." # # This script is, of course, only to ensure interoperability with # non-javascript-compatible browsers. # # by Schnarf (2600, vol. 20, no. 4) # # Open the file open( F, $ARGV[0] ) or die "Could not open $ARGV[0] for reading: $!\n"; @raw = ; close(F); $page = join( "\n", @raw ); # Get the data to decrypt $data = getData($page); # Now decode that data $final = decode($data); # Print it to STDOUT print $final; # This just grabs the parameter to _x sub getData { my $page = shift; my $start = index( $page, '_x("' ); if ( $start == -1 ) { die("Could not locate start of raw data!\n"); } my $end = index( $page, '");', $start + 4 ); if ( $end == -1 ) { die("Could not locate end of raw data!\n"); } $start += 4; return substr( $page, $start, $end - $start ); } # This is just _x converted to perl sub decode { my $s = shift; $s = unescape($s); my @t = (); my @j = (); my $i; for ( $i = 0 ; $i < length($s) ; $i++ ) { $t[$j] .= chr( ord( substr( $s, $i, 1 ) ) + ( $i % 2 == 0 ? 1 : -1 ) ); if ( ( $i + 1 ) % 300 == 0 ) { $j++; $t[$j] = ''; } } my $u = ''; for ( $i = 0 ; $i < $#t ; $i++ ) { $u .= $t[$i]; } return $u; } sub unescape { my $str = shift; $str =~ s/%([a-fA-F0-9]{2})/chr(hex($1))/ge; return $str; }