开发者

monitor incoming/outgoing http traffic with .net

开发者 https://www.devze.com 2022-12-16 11:14 出处:网络
I want to write a small application that can: 1. monitor URLs requested via a web browser and/or 2. monitor incoming http responses on the local machine

I want to write a small application that can: 1. monitor URLs requested via a web browser and/or 2. monitor incoming http responses on the local machine

I have been doing some Googling, but I am not finding any clear answers. I am thinking maybe System.Net.Sockets.TCPListener and messing around with it, but I am under the impression that it is either not what I"m looking for or can't handle both things.

I don't need a detailed step by step explanation. Just a small overview would be helpful (if this is even possible) such as (what classes to use, what events to subscribe to, any additional details needed to instantiate necessary objects) I can google the deta开发者_如何学Pythonils.


Why not just extend Fiddler to suit your needs?


You may want to use a utility like Wireshark (graphical, but not scriptable from C#, AFAIK). Wireshare uses a library called WinPcap, which does the actual monitoring of the TCP streams on the computer. Decoding of the HTTP headers will need to be done in your application (this is what wireshark/tcpdump/windump should be able to do). You will need to use PInvoke to call the WinPcap DLL. You can find library wrappers by performing a web search for "WinPcap PInvoke".

This question sound very similar to the following:

Is there any way in .NET to programmatically listen to HTTP traffic?

EDIT: Also, Capturing HTTP requests may help

0

精彩评论

暂无评论...
验证码 换一张
取 消