diff options
author | dakkar <dakkar@luxion> | 2006-12-14 18:23:51 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2006-12-14 18:23:51 +0000 |
commit | f58000d8784458d5e8676d6002267b7529ece2ca (patch) | |
tree | 714725ca5aeb8b048e77eb2c85a778449aaf2791 /MyProxy.pl | |
parent | merge da dechirico (diff) | |
download | myProxy-f58000d8784458d5e8676d6002267b7529ece2ca.tar.gz myProxy-f58000d8784458d5e8676d6002267b7529ece2ca.tar.bz2 myProxy-f58000d8784458d5e8676d6002267b7529ece2ca.zip |
aggiunto supporto proxy SOCKS (es. Tor)
git-svn-id: svn://luxion/repos/myProxy/trunk@232 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'MyProxy.pl')
-rwxr-xr-x | MyProxy.pl | 22 |
1 files changed, 19 insertions, 3 deletions
@@ -7,10 +7,9 @@ use HTTP::Response; use Log::Log4perl; use FindBin; use YAML; +use Getopt::Long; -# qui dovrei inizializzare log4perl -Log::Log4perl::init("$FindBin::Bin/log.conf"); - +my $LOGCONF="$FindBin::Bin/log.conf"; my $PORT=3128; my @PATFILES=map {"$FindBin::Bin/adzap/scripts/$_"} qw(prematch.list squid_redirect postmatch.list); my $ZAPSDIR="$FindBin::Bin/adzap/zaps"; @@ -212,9 +211,26 @@ sub jumpFilter { } { + my $socks=0; + GetOptions('socks|s!' => \$socks, + 'port|p=i' => \$PORT, + 'log|l=s' => \$LOGCONF, + ); + Log::Log4perl::init($LOGCONF); my $logger=Log::Log4perl->get_logger('MyProxy.main'); $logger->info("Loading..."); for (@PATFILES) {loadPatterns($_)}; + if ($socks) { + $logger->info("Using SOCKS"); + require LWP::Protocol::http::SocksChain; + LWP::Protocol::implementor( http => 'LWP::Protocol::http::SocksChain' ); + @LWP::Protocol::http::SocksChain::EXTRA_SOCK_OPTS=( Chain_Len => 1, + Debug => 0, + Random_Chain => 0, + Auto_Save => 1, + Restore_Type => 1, + ); + } my $proxy=HTTP::Proxy->new(port=>$PORT); $proxy->push_filter(request => HTTP::Proxy::HeaderFilter::simple->new(\&doFilter)); $proxy->push_filter(request => HTTP::Proxy::HeaderFilter::simple->new(\&jumpFilter)); |