My home page
Back to my software experience page
Back to my portfolio
ChaosNET in Python
This Python code serves as a cross-platform replacement for Brad Parker's chaosd
process, which supports the basic illusion of a ChaosNET ether implemented either over
WinSock/TCP stream sockets on the localhost or UNIX-domain stream sockets. Further code
provides generic interfaces for creating clients attached to these virtual ethers with
One of those clients is a simple masquerading gateway, which echoes one client's packets
to and from the Internet encapsulated in UDP. This allows for remote machines following Bjorn
Victor's CHUDP protocol to be transparently linked to a virtual Chaos network on the local
The eventual goal would be to implement a FILE protocol server completely asynchronously,
either based on the asyncore framework shown here, or perhaps by migrating to Twisted.
- chaos.py The basic definitions needed for the Chaos protocol and packets.
- chaos_async.py Classes derived from the asyncore base supporting
sending and receive Chaos packets encapsulated in a stream, and for creating "ether servers" which
echo packets from one client to all clients on a Chaos subnet.
- chaosd.py An example script for a simple ChaosNET server process, using
chaos_async.py objects to emulate two ChaosNET subnets over localhost TCP stream sockets.
- chaos_udp.py Classes derived from asyncore supporting Chaos packets
encapsulated in UDP, including a simply stream-to-UDP masquerading router.
- udp_masq.py A simple script implementing a chaos_udp masquerading
router between a Windows and a UNIX host.
- chaos_client.py Classes to implement simple ChaosNET clients using
- chaos_listen.py A simple example using chaos_client.py classes to
provide a "listen" client, echoing all packets on a particular subnet.
- chaos_responder.py The beginnings of a simple "responder",
which acts like a host obeying the minimal protocol, including simple ANS responses to RFC packets,
and recording RUT packets to maintain an internal routing table.
- windows_box.py A simple script creating a server for a local
subnet and a UDP masquerade with a hard-coded route to a UNIX machine on the network.
This code is perhaps not very idiomatic Python. I have not settled on a framework for
formal unit tests, and am not sure the best way to do so for such interactive programs. It
does not provide much error-checking at all in the encoding and decoding of the underlying
packets. Asyncore seems to be the red-headed stepchild of asynchronous Python network frameworks,
so I will probably go with the crowd and port this to Twisted at some point.