I would like to rewrite the contents/payload of UDP packets as they are received by a machine, on selected reports - before they are passed to the listening application.
For example, I would like to change the headers of a UDP-based protocol by using grep-like regular expressions (to add, remove or change parts of each message received).
Is this possible with a software firewall or similar tool?
Thanks all!
Such a tool is called a UDP Proxy and there are a few out there.
If this isn't for production, but rather just learning. I recommend Scapy, you can craft and replay packets on a object oriented interface that relates to the OSI model. It acts like an interactive python console. You can also sniff with it, lots of fun ;-)
TRIPP may also be a solution:
http://tripp.dynalias.org/