0

I'm trying to get the URL's of the network traffic, that which website the user had gone through by using the NetworkInterface in c#. I was able to get the total bytes by the following code :

I'm searching for the way to get the network traffic with URL's.

if (!NetworkInterface.GetIsNetworkAvailable())
                return;

            NetworkInterface[] interfaces
                = NetworkInterface.GetAllNetworkInterfaces();

            foreach (NetworkInterface ni in interfaces)
            {
                Console.WriteLine("    Bytes Sent: {0}",
                    ni.GetIPv4Statistics().BytesSent);
                Console.WriteLine("    Bytes Received: {0}",
                    ni.GetIPv4Statistics().BytesReceived);
            }
ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
Srikanth Reddy
  • 447
  • 1
  • 8
  • 23
  • WinForms _and_ Console Application? Are you sure? Anyway, neither of those are relevant to the question. – ProgrammingLlama Oct 15 '20 at 05:48
  • You'll need to use one of [these](https://stackoverflow.com/a/12437730/9363973) tools to intercept the network traffic of an application (in your case the web browser) so you can parse each packet and inspect it. But, there's a catch. Any content that's being transmitted through a secure channel (e.g HTTPS) you will not be able to read, unless you manually give it the key used to encrypt it – MindSwipe Oct 15 '20 at 05:50
  • @MindSwipe If it's not possible with HTTPS , How the fiddler.exe file able to track the all URLs ? – Srikanth Reddy Oct 15 '20 at 07:28
  • @John Yes, if the solution in win-forms also not an issue. I an deal it. – Srikanth Reddy Oct 15 '20 at 07:30
  • Fiddler is a proxy, meaning all your HTTP/S request go through it, meaning it knows the key used to encrypt the traffic. Meaning, if you want to use fiddler for an application, you need to set up the application (or your network interface) to use fiddler as a proxy. If you want to monitor network traffic from applications which are not using your application as a proxy, you'll to get the decryption key manually or live with the fact you'll read garbage data from encrypted transmissions – MindSwipe Oct 15 '20 at 07:38
  • @MindSwipe, Thanks for the info. So, For my result I needs to create a proxy. Am I right ? Is it possible ? – Srikanth Reddy Oct 15 '20 at 09:22

0 Answers0