title: Capture and forwarding of network traffic from a particular application on Windows
body: <p>I need to capture network traffic that is going in/out of a particular application. The main issue is that I would like to do this in a blocking fashion -- i.e. capture the traffic, perform some analysis and encryption/decryption on it and then forward it along its regular route. So, it must use some sort of a blocking mechanism.</p>
  
  <p>Is there some code or a library that makes this easy to do on Windows (Server 2008 or Win7 will do)? Any C++ (or Python/Java) classes or libraries that already exist? </p>
  
  <p>I intend for the solution to also execute on the same machine as the target app and have administrative privileges. </p>
  
  <p>Any pointers to code samples would be greatly appreciated.</p>
  
  <p>Thanks for your help.</p>
  
  <p>p.s.: I have been looking at WinPcap but from my (limited) understanding, it can't filter/block based on specific applications. Is that right, or did I miss something? Any other solutions out there?</p>