Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'socket': 0.05; '21,': 0.07; 'parser': 0.07; 'plenty': 0.07; 'python': 0.09; 'cc:addr :python-list': 0.10; 'suggest': 0.11; 'task.': 0.16; 'tcp': 0.16; 'twisted': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'feb': 0.19; 'email addr:gmail.com>': 0.20; 'all,': 0.21; 'cheers,': 0.23; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'url:wiki': 0.26; 'am,': 0.27; 'message- id:@mail.gmail.com': 0.27; 'this?': 0.28; 'fast.': 0.29; 'leverage': 0.29; 'url:mailman': 0.29; 'framework': 0.30; 'code': 0.31; 'implement': 0.32; 'url:python': 0.32; 'sources': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'doing': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'useful': 0.36; 'thank': 0.36; 'resources': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'received:209.85.214': 0.39; 'url:mail': 0.40; 'traffic': 0.61; 'between': 0.63; 'taking': 0.65; 'pleased': 0.66; '2013': 0.84; 'url:trac': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=V/jIs0EwK4mh7J20RTQAIsYSyCQyDA3MFdWV1dVmRvM=; b=RiT9cvdzMJZpG2m+yVzuXeLh95ymZBBVe2Mg3Lzfut0PKvAZK2tEVk24YayjZfwVsL ztMo0yP/RpUz79Zm1fy8IzV//c+947fjaCdpU8I+bxbImVsoZYHfy16ffDZ+XoC69CZs tXJOYyi4gfnRbQJjLeXB8XkDHA5TpqG9wybaYZnTZYNbEPJEnONFCSMKNyHWth38RDih kM2ydn+62tokpMrJ0rkL/aOsmmWZQ3y+Em1Rg5Dv0nX5H5cXVm7r8tBbS6vhtGg2lo0P H42UQEKsN/g6YSgcFG/BCEmlVfGKIcutIeSl2al3QJZH9+ghbPYEOQF3bDHBTFA2X03k ACPA== X-Received: by 10.60.1.129 with SMTP id 1mr10859435oem.93.1361461189585; Thu, 21 Feb 2013 07:39:49 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Rodrick Brown Date: Thu, 21 Feb 2013 10:39:19 -0500 Subject: Re: Transparent Proxy and Redirecting Sockets To: Luca Bongiorni Content-Type: multipart/alternative; boundary=e89a8fb1f4f49519fb04d63de2cf Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 92 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361461192 news.xs4all.nl 6840 [2001:888:2000:d::a6]:60401 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39436 --e89a8fb1f4f49519fb04d63de2cf Content-Type: text/plain; charset=ISO-8859-1 On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni wrote: > Hi all, > Around I have found plenty useful sources about TCP transparent proxies. > However I am still missing how to make socket redirection. > > What I would like to do is: > > host_A <--> PROXY <--> host_B > ^ > | > host_C <------ > > At the beginning the proxy is simply forwarding the data between A and B. > Subsequently, when a parser catches the right pattern, the proxy quit the > communication between A and B and redirect all the traffic to the host_C. > > I would be pleased if someone would suggest me some resources or hints. > > Are you looking for a Python way of doing this? I would highly recommend taking a look at ha-proxy as its very robust, simple and fast. If you're looking to implement this in Python code you may want to use a framework like Twisted - http://twistedmatrix.com/trac/wiki/TwistedProject Twisted provides many functionality that can leverage to accomplish this task. > Thank you :) > Cheers, > Luca > > -- > http://mail.python.org/mailman/listinfo/python-list > --e89a8fb1f4f49519fb04d63de2cf Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Thu, Feb 21, 2013 at 10:24 AM, Luca Bongiorni <bongio= 87@gmail.com> wrote:
Hi all,
Around I have found plenty useful sources about TCP transparent proxies. Ho= wever I am still missing how to make socket redirection.

What I would like to do is:

host_A <--> PROXY <--> host_B
=A0 =A0 =A0 =A0 =A0 =A0 =A0 ^
=A0 =A0 =A0 =A0 =A0 =A0 =A0 |
host_C <------

At the beginning the proxy is simply forwarding the data between A and B. Subsequently, when a parser catches the right pattern, the proxy quit the c= ommunication between A and B and redirect all the traffic to the host_C.
I would be pleased if someone would suggest me some resources or hints.


Are you looking for a Python way= of doing this? I would highly recommend taking a look at ha-proxy as its v= ery=A0robust,=A0simple and fast. If you're looking to=A0implement=A0thi= s in Python code you may want to use a framework like Twisted -=A0http://twistedmatrix= .com/trac/wiki/TwistedProject=A0

Twisted provides many functionality that ca= n leverage to accomplish this task.=A0
=A0
Thank you :)
Cheers,
Luca

--
http://mail.python.org/mailman/listinfo/python-list

--e89a8fb1f4f49519fb04d63de2cf--