Re: socket.getsockopt() and SO_ORIGINAL_DST

2010-05-21 Thread chris
Hi guys, I found a solution myself in O'Reilly's Security Power Tools. It works seamlessly as follows: from socket import * SO_ORIGINAL_DST = 80 s = socket(AF_INET, SOCK_STREAM) s.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) s.bind(('192.168.255.254', 80)) s.listen(1) conn, addr = s.accept() dst = c

socket.getsockopt() and SO_ORIGINAL_DST

2010-05-20 Thread chris
Hi guys, On netfilter-based NAT systems there is theoretically a possibility to retrieve the original address *after* NAT'ing a connection. In C, this can be done as in squid, a transparent HTTP proxy: http://paste.pocoo.org/show/216495/ I'd like to do the same in Python. So I started with a