packet data intercept and modification
I'd like to be able to intercept/ modify data in tcp flow, on the side of tcp client. Examples for pcap show how to parse tcp packet header/ payload. But suppose, i want to modify packet payload before tcp client reads it, or drop the packet entirely. How can i do that with pcap capure? As above, you can't do interception/modification with pcap. For this you need one of the following OS-dependent techniques: Linux : libnetfilter_queue + iptables MacOS , FreeBSD : divert sockets + ipfw Windows : WinPkFilter (commercial), WinDivert (LGPL), or write your own NDIS IM or WFP call-out driver. (usual