6 Replies - 2818 Views - Last Post: 14 March 2012 - 12:45 PM Rate Topic: -----

#1 russdb100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 14-March 12

c# Continuous HTTP Listener

Posted 14 March 2012 - 12:05 PM

Here is the program I want to develop: basically I want a program to listen in on web-traffic. as this program is running I want to see the HTTP Response in HEX and it's conversion in String. I've been looking at the HTTPWebRequest, HTTPWebResponse, HTTPListener classes.

Here are some of the issues I've found
1. Using the HTTPWebResponse the standard practice is to use it with the HTTPWebRequest. In my case I'm not requesting a specific web-page. This is an external application that spits out the response string whenever the user interacts with the web browser or when any other kind of web data is comming in.

2. Using the HTTP Listener I found that I need to add a prefix of some sort that contains the URI string. I'm thinking that this too points to a specific web page.

3. An alternative solution that I'm thinking of is to open a port and using a TcpListener. I'm not sure this would be ideal.

The attached is an example of what I want to implement. Can someone please point me to an appropriate solution ???

Is This A Good Question/Topic? 0
  • +

Replies To: c# Continuous HTTP Listener

#2 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4498
  • View blog
  • Posts: 7,850
  • Joined: 08-June 10

Re: c# Continuous HTTP Listener

Posted 14 March 2012 - 12:09 PM

Ok, so let me see if I understand what you want. You want to listen in on traffic that's coming and going, right? HttpWebRequest/Response is for sending (and receiving the response) a request to a web server. That's not sufficient. HttpListener is basically an HttpServer. It waits on a port, and will be called when any request comes in on that port. But it's a server, not what you want. It's designed to listen for incoming httprequests. On a client machine, you'd only be getting responses, not requests. The TcpListener would have the exact same problem.

However, there's software that already exists that lets you do this. It's called Fiddler. We always say "don't reinvent the wheel." Well, fiddler is free and easy to use, and does exactly what you want. I say use it.
Was This Post Helpful? 1
  • +
  • -

#3 russdb100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 14-March 12

Re: c# Continuous HTTP Listener

Posted 14 March 2012 - 12:17 PM

Yes I tried fiddler. Yes it does exactly what I want. I'm looking into the API on it. It's the internals that I'm interested in. What .Net functions would this use to make it work the way it does?

For the project I'm working on, is basically a small application that captures data off of a web-page that uses adobe flash (which does not generate HTML tags). Using a mechanism such as fiddler is just about the only solution I could think off. Fiddler does capture the information in it's response packets which is why I'm trying to emulate it and "re-invent" the wheel.
Was This Post Helpful? 0
  • +
  • -

#4 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4498
  • View blog
  • Posts: 7,850
  • Joined: 08-June 10

Re: c# Continuous HTTP Listener

Posted 14 March 2012 - 12:24 PM

Well, Fiddler has an API called FiddlerCore. I don't know if they obfuscate at all, but you can use a product called Reflector to "decompile" their API to see how they do it, if you want to try.
Was This Post Helpful? 0
  • +
  • -

#5 russdb100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 14-March 12

Re: c# Continuous HTTP Listener

Posted 14 March 2012 - 12:40 PM

Yes I'm currently looking into Fiddler Core. So...
HTTPWebRequest, HTTPWebRequest, HTTPListener, TcpListener, your saying that none of these are what I'd be looking for...

I'm using Telerik JustDecompile.
I'm looking at functions in FiddlerCore getResponseBodyEncoding and utilDecodeHTTPBody but am unable to find .Net namespaces.
Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4498
  • View blog
  • Posts: 7,850
  • Joined: 08-June 10

Re: c# Continuous HTTP Listener

Posted 14 March 2012 - 12:44 PM

I'm not saying that none of those are suitable, I'm saying none are suitable by themselves. I don't know how to do this, I've never needed to, nor do I want to. Actually, I'd suggest using Fiddler Core itself in your project, instead of trying to decompile it and find how they use it. It should basically allow you to write a program that works like fiddler.
Was This Post Helpful? 0
  • +
  • -

#7 russdb100  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 14-March 12

Re: c# Continuous HTTP Listener

Posted 14 March 2012 - 12:45 PM

To continue my response above there's a class in Fiddler called ClientPipe.Receive(), ClientPipe.SecureClientPipe(), and contains the function NetworkStream which is a native .Net assembly.

Would you have suggestions on the NetworkStream namespace ???
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1