What I’m basically trying to do is create a command line alternative to widecap. How I imagine this thing to work:
- External application calls my command line tool and passes the proxy as an argument
- The command line tool launches and redirects all web traffic for the application that called it through the proxy that was passed as an argument
- External application closes the command line tool after it’s done
The reason why I don’t want to implement the proxy support directly into the external application’s code is that I will not always be writing the external applications. I want it to be a separate tool that can be used by anyone.
Any directions/feedback/suggestions/links/ideas that you could give me will be greatly appreciated.
Edit: Just to be more clear, I would like to see a code example in C# that demonstrates how I can “hook” on a running process and tunnel all its web traffic through a proxy.
You can not do what are you asking for without decompiling/disassembling the external program and editing its code to do what are you asking for.
Another solution would be to program your C# application to capture the packets of the external application and redirecting them to your proxy server. This will be difficult to achieve but it will solve your problem.