#!/usr/bin/perl use strict; use warnings; use CGI; use WWW::Mechanize; my $cgi = new CGI(); my $u = $cgi->param('u') || 'Username'; my $p = $cgi->param('p') || 'Password'; my $c = $cgi->param('c') || 'United States'; my $t = $cgi->param('t') || 'anon'; my @d = localtime(time); $d[3] = sprintf( "%02d", $d[3] ); $d[4] = sprintf( "%02d", $d[4] + 1 ); $d[5] += 1900; my $d = "data/$d[5]-$d[4]-$d[3]-$c\-$t\.txt"; print "Content-type: text/plain\n\n"; if ( -e $d ) { open( F, "$d" ); while ( ) { print; } close( F ); } else { my $www = new WWW::Mechanize(); $www->get("http://www.stayinvisible.com/index.pl/download_proxies?username=$u&identifier=$p&op=auth&method=login"); $www->get('http://www.stayinvisible.com/cgi-bin/download.cgi?format=1'); open( F, ">$d" ); my $data = $www->content(); foreach ( split( /\n/, $data ) ) { my @data = split( /,/, $_ ); if ( $data[2] =~ /$t/i && $data[3] =~ /$c/i ) { print "$data[0]:$data[1]\n"; print F "$data[0]:$data[1]\n"; } } close( F ); }