I would recommend taking a look at netsed, there is some information on it at http://securitytube-tools.net/index.php?title=NetSed
It allows you to modify contents of traffic going through your machine in realtime through sed style regular expressions.
If you can't get your machine into the flow of traffic through wiring, your could set your machine as the gateway and set its route up to send traffic to the proper location.
If this doesn't work for you could always use something like ettercap, or another tool that would allow you to do some ARP poisoning, effectively making your machine the gateway.
Scapy is very nice as well, as mentioned by servarevitas3.