Network Expect is a framework for managing network packets, including packet crafting, injection, and reception. The framework uses Tcl (http://www.tcl.tk/), which provides branching and high-level control structures to direct the interaction with the network.
NetworkExpect is specially useful for recreating situations that trigger a problem (bug), for replaying traffic, for writing proof-of-concept protocols and tools, for simulating Denial-of-Service attacks, and, in general, for situations that require injecting network traffic at a very low level, i.e. traffic that requires transmitting and receiving invalid packets, traffic that requires setting specific header fields to specific values (e.g. TCP sequence numbers, TCP and IP flags, etc.)
Documentation, examples, and more information related to NetworkExpect can be found in the Network Expect wiki at http://www.netexpect.org.