Socket - Fiirewall

Rene Pijlman reageer.in at de.nieuwsgroep
Sat Mar 1 09:29:56 EST 2003


Salvatore:
>I would like to create a little firewall in Python,
>Does anybody know how to block a port like a FireWall ?

That's the easy part.

    receive(packet)
    if packet.destination_port == 80:
        send(packet)
    else:
        pass
    # :-)

Firewalls are typically implemented in a primitive
high-performance language (C) at the TCP/IP routing layer in the
OS kernel. I don't think this is a good application for an
interpreted high level scripting language like Python, that
typically resides ~3 layers higher in the protocol stack.

-- 
René Pijlman

Wat wil jij leren?  http://www.leren.nl




More information about the Python-list mailing list