IO::Socket::Socks

Provides a way to create socks client or server both 4 and 5 version
Download

IO::Socket::Socks Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Oleg G.
  • Publisher web site:
  • http://search.cpan.org/~oleg/

IO::Socket::Socks Tags


IO::Socket::Socks Description

IO::Socket::Socks is a Perl module that connects to a SOCKS proxy, tells it to open a connection to a remote host/port when the object is created. The object you receive can be used directly as a socket for sending and receiving data from the remote host. In addition to create socks client this module could be used to create socks server. See examples below.SYNOPSISClient use IO::Socket::Socks; my $socks = new IO::Socket::Socks(ProxyAddr=>"proxy host", ProxyPort=>"proxy port", ConnectAddr=>"remote host", ConnectPort=>"remote port", ); print $socks "foo\n"; $socks->close();Server use IO::Socket::Socks ':constants'; my $socks_server = new IO::Socket::Socks(ProxyAddr=>"localhost", ProxyPort=>"8000", Listen=>1, UserAuth=>\&auth, RequireAuth=>1 ); my $select = new IO::Select($socks_server); while(1) { if ($select->can_read()) { my $client = $socks_server->accept(); if (!defined($client)) { print "ERROR: $SOCKS_ERROR\n"; next; } my $command = $client->command(); if ($command-> == CMD_CONNECT) { # Handle the CONNECT $client->command_reply(REPLY_SUCCESS, addr, port); } ... #read from the client and send to the CONNECT address ... $client->close(); } } sub auth { my $user = shift; my $pass = shift; return 1 if (($user eq "foo") && ($pass eq "bar")); return 0; }Product's homepage


IO::Socket::Socks Related Software