#!/usr/bin/perl -w # unpp.pl -- Decoder for "!Impressions! Web Design PageParser v1.1" # # Copyright (c) 1997, Devin Carraway # # Freely redistributable under terms of the GNU Public License. # # Works with (against?) PageParser v1.1; at the moment it merely replicates # in perl what PP does in JavaScript (albeit much quicker, owing to the # relative optimizations of the languages), making some guesses as to what # string literals contain the decoder lookup table and the page data. # # A tiny attempt to retain HTML as an open format; if you don't want anyone # to see your code, don't expect anyone to run it. # require 5; use strict; use URI::Escape; my $buf = join("\n",<>); my (@sbuf,$x); while ($buf =~ m/[A-Za-z_]\w*\s*=\s*"([^"]*)"[\t\f ]*[;,\n]?/g) { my $x = $1; push @sbuf, $x unless ($x =~ /^javascript$/i); } my $filter = $sbuf[0]; my $data = $sbuf[$#sbuf]; my $activelen = length($data); $activelen = 500 unless $activelen<500; my $rbuf = substr($data,$activelen); my $cbuf = ''; my @scbuf = split(//,substr($data,0,$activelen)); my @fcbuf = split(//,$filter); my ($i,$i1,$sindex) = (0,0,0); for ($i=0; $i<=$#scbuf; $i++) { for ($i1=0,$sindex=-1; $i1<=$#fcbuf; $i1++) { ($sindex = $i1), last if ($fcbuf[$i1] eq $scbuf[$i]); } if ($sindex!=-1 && $fcbuf[$sindex^3] eq 'A' || $fcbuf[$sindex^3] eq 'c') { print ""; } $cbuf .= (($sindex!=-1)?($fcbuf[$sindex ^ 3]):$scbuf[$i]); } $buf = uri_unescape($cbuf.$rbuf); print $buf;