source: trollforge/troll/proxen.pl @ 386

Revision 307, 1.8 KB checked in by incog, 3 years ago (diff)
Line 
1#!/usr/bin/perl
2
3use strict;
4use LWP::UserAgent;
5use HTTP::Request::Common;
6use HTTP::Cookies;
7use IO::Handle;
8STDOUT->autoflush(1);
9
10my $ua = LWP::UserAgent->new;
11$ua->agent(
12    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; YPC 3.0.0; .NET CLR 1.1.4322; yplus 4.1.00b)"
13);
14
15#Hopefully this will mask us from being detected as a script
16$ua->cookie_jar(HTTP::Cookies->new);
17$ua->timeout(3);
18
19my $response = $ua->request(GET "http://www.cybersyndrome.net/pla.html");
20die "Error fetching new proxies" if !$response->is_success;
21my $proxies = $response->content;
22$proxies =~ s/\n//g;
23$proxies =~ /<ol>(.+)<\/ol>/;
24$proxies = $1;
25$proxies =~
26  s/<a title="\w\w" onMouseOver="s\('\w\w'\)" onMouseOut="d\(\)" class="\w">//g;
27$proxies =~ s/<li>//g;
28$proxies =~ s/<\/li>//g;
29$proxies =~ s/<\/a>/\n/g;
30
31my @proxies = split(/\n/, $proxies);
32print "fetched ", scalar @proxies, " proxies\n";
33foreach (@proxies)
34{
35    open(GOODPROXIES, ">>goodproxies.txt") or die "cannot open goodproxies.txt";
36    chomp;
37    next if ($_ =~ /:80$/);
38    if (   $_ =~ /\.mil/
39        || $_ =~ /\.gov/
40        || $_ =~ /198\.2[5-6]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/
41        || $_ =~ /199\.2[0-1]:[0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/
42        || $_ =~ /198.2[0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/)
43    {
44        print "Skipping, .mil/.gov proxy\n";
45        next;
46    }
47    $ua->proxy('http', "http://$_/");
48    my $formkey;
49    print "Checking proxy: $_";
50    my $reply =
51      $ua->request(GET
52        'http://slashdot.org/comments.pl?sid=20721&op=Reply&threshold=1&commentsort=0&tid=124&mode=thread&pid=7947680'
53      );
54    if ($reply->is_success)
55    {
56        print " || SUCCESS\n";
57        print GOODPROXIES "$_\n";
58        next;
59    }
60    print " || FAILURE\n";
61
62    close GOODPROXIES;
63}
Note: See TracBrowser for help on using the repository browser.