p0c has asked for the wisdom of the Perl Monks concerning the following question:
The simple code running on PC II:-------- ---------- ----------- | | | PC II | | | | PC I | --> | (PROXY) | -> | GATEWAY | | | | | | | -------- ---------- -----------
And with this iptables rules to forward all the HTTP traffic to the proxy:#!/usr/bin/perl -w use HTTP::Proxy; use HTTP::Proxy::BodyFilter::tags; use HTTP::Proxy::BodyFilter::simple; system("echo 1 > /proc/sys/net/ipv4/ip_forward"); my $proxy = HTTP::Proxy->new( port => 8080, host => 'localhost' ); $proxy->push_filter( mime => 'text/html', response => HTTP::Proxy::BodyFilter::tags->new(), response => HTTP::Proxy::BodyFilter::simple->new( sub { ${ $_[1] } =~ s!src=.+(.jpg|.gif|.bmp|.png)!src=\"http://files.m +yopera.com/Idonotlikebroccoli/albums/3758/thumbs/noob.jpg_thumb.jpg\" +!ig; print "Filter ran!\n"; } ) ); $proxy->start;
What this does is replace theiptables -F iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports + 8080
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Transparent proxy / Intercepting proxy
by jettero (Monsignor) on May 27, 2009 at 10:41 UTC | |
Re: Transparent proxy / Intercepting proxy
by arc_of_descent (Hermit) on May 27, 2009 at 10:10 UTC | |
by p0c (Initiate) on May 27, 2009 at 10:29 UTC | |
by arc_of_descent (Hermit) on May 27, 2009 at 10:36 UTC |