Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

(jeffa) Re: Encrypt web files!

by jeffa (Bishop)
on Jul 24, 2003 at 16:20 UTC ( [id://277591] : note . print w/replies, xml ) Need Help??

in reply to Re: Re: Encrypt web files!
in thread Encrypt web files!

Complete snake oil. With the help a few CPAN modules, i didn't even need to understand the "encryption algorithm".
#!/usr/bin/perl -T use strict; use warnings; use CGI; use JavaScript; use LWP::Simple; use HTML::TokeParser::Simple; if (CGI::param('go')) { print CGI::header('text/plain'); my $javascript = fetch_js(CGI::param('url')); parse_js($javascript); } else { print_form(); } sub parse_js { my $javascript = shift; my $runtime = JavaScript::Runtime->new(); my $context = $runtime->create_context(); $context->bind_function(name => 'write', func => sub{ print @_}); return $context->eval($javascript); } sub fetch_js { my $html = LWP::Simple::get(shift); my $parser = HTML::TokeParser::Simple->new(\$html); my ($token,$js); while ($token = $parser->get_token) { if ($token->is_start_tag('script')) { $js = $parser->get_token->as_is; last; } } $js =~ s/document\.write/write/g; return $js; } sub print_form { my $q = CGI->new; print $q->header(), $q->start_html('See the source of cleverSource encrypted page'), $q->start_form, $q->textfield('url',' +source'), $q->submit('go'), $q->end_form, $q->end_html, ; }
Be sure and download the necessary Javascript libs in order to be able to use JavaScript.


(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re: (jeffa) Re: Encrypt web files!
by CountZero (Bishop) on Jul 25, 2003 at 08:45 UTC

    Isn't it a criminal offence under US-law to even try to decode encrypted things?


    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law