#!/usr/bin/perl # Vincent 'rastakid' van Scherpenseel (vincent [at] vanscherpenseel [dot] nl) - 1 June 2004 # # World Hopper 0.2 (whopper.pl) # Simple but powerfull tool to connect to remote services through a chain of HTTP (CONNECT) proxy # servers, to gain high anonymity. Opens a listening socket at port 1337 (default) and then waits # for a client to connect. When a client connects World Hopper builds a chain of proxy servers. # Tested OK with: telnet, pop3 and irc. # # Usage: whopper.pl [dest_host:dest_port] # Proxyfile should contain HTTP CONNECT proxies, each on a new line. Here are two proxies to get # you started: 213.187.220.93:3128 and 168.187.151.173:6588. # If you omit the destination, your connecting client needs HTTP proxy support. # # Whopper lives at: http://projects.vanscherpenseel.nl/whopper/ # See http://projects.vanscherpenseel.nl/whopper/changelog.txt for changes. # More ways to contact me at: http://vincent.vanscherpenseel.nl # Shouting out to #outlaws (www/irc.outlaws.nu)! use strict; use IO::Socket; use Net::hostent; my (@proxies, $proxy_host, $proxy_port, $server, $client, $hostinfo, $server_port, $childpid, $proxy_connection, $line, $iterate, $last_proxy, $non_http_output); $server_port = 1337; if (@ARGV[0] eq "") { die "Usage: whopper.pl [dest_host:dest_port]\n"; } print "\nWorld Hopper 0.2 - Vincent 'rastakid' van Scherpenseel\n"; print "=" x 54 . "\n\n"; # Read proxy servers from file open(INF,"$ARGV[0]") or die "Fatal: opening proxyfile (@ARGV[0]) failed with error: $!\n";; @proxies = ; close(INF); @proxies = grep(!/^#/, @proxies); print "[Found " . scalar(@proxies) . " proxy servers in @ARGV[0]]\n"; # Open listening sockets for clients $server = IO::Socket::INET->new(LocalPort => $server_port, Type => SOCK_STREAM, Reuse => 1, Listen => SOMAXCONN ) or die "Fatal: listening on port $server_port failed with error: $@\n"; print "[Listening for client connections on port $server_port]\n"; while ($client = $server->accept()) { $non_http_output = 0; # Set to default (no non-HTTP output yet) $client->autoflush(1); $hostinfo = gethostbyaddr($client->peeraddr); printf "[Client connection from %s]\n", $hostinfo ? $hostinfo->name : $client->peerhost; # Connect to first proxy server chomp($proxies[0]); $last_proxy = $proxies[0]; ($proxy_host,$proxy_port) = split(/:/,$proxies[0]); $proxy_connection = IO::Socket::INET->new(Proto => "tcp", PeerAddr => $proxy_host, PeerPort => $proxy_port) or die "Fatal: connecting to proxy server $proxy_host:$proxy_port failed with error: $!"; $proxy_connection->autoflush(1); print "[Connected to $proxy_host:$proxy_port]\n"; # Chain proxy servers for ($iterate=1;$iterate)) { # Filter out HTTP code 200s and empty lines on CONNECT (for POP3 and such compatibility) if (($line =~ /200 Connection established/ or $line eq "\r" or $line eq "\n" or $line eq "\r\n") and $non_http_output == 0) { $line = ""; } else { $non_http_output = 1; } print $client $line; } kill("TERM", $childpid); } else { while (defined ($line = <$client>)) { print $proxy_connection $line; } } }