• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 811
  • Last Modified:

Intercept internet traffic C++

hi,

I was wondering on how to approach writing a listener that would "sniff out" all outbound network traffic in Windows on all ports before it actually gets sent and reroute that traffic to a proxy server or modify the requests headers?

What would be the best approach for that?

Using: Windows and C, C++
0
xNejX
Asked:
xNejX
  • 4
  • 3
  • 2
  • +1
2 Solutions
 
Infinity08Commented:
What you want is WinPcap :

        http://www.winpcap.org/

For development you'll want this page :

        http://www.winpcap.org/devel.htm
0
 
masheikCommented:

tcpdump, a powerful command-line packet analyzer; and libpcap, a portable C/C++ library for network traffic capture

http://www.tcpdump.org/

0
 
Infinity08Commented:
tcpdump and libpcap are not for Windows. The Windows equivalents are WinDump and WinPcap (as mentioned above).
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
xNejXAuthor Commented:
Can all of these be implemented in C++ as a library or something from which I can call this redirections on my own without calling an external exe file?
0
 
masheikCommented:
>>>tcpdump and libpcap are not for Windows. The Windows equivalents are WinDump and WinPcap (as mentioned above
oh..I did not notice it requred for windows..then Windump and WinPcap are the perfect options

0
 
masheikCommented:
Here is the good guides,

>>Can all of these be implemented in C++ as a library
   yes..

http://www.winpcap.org/docs/docs_41b5/html/group__wpcapsamps.html
http://www.codeproject.com/KB/IP/winpcap_basic.aspx
0
 
Infinity08Commented:
>>  Can all of these be implemented in C++ as a library or something from which I can call this redirections on my own without calling an external exe file?

That's what WinPcap is :)
0
 
Infinity08Commented:
>> That's what WinPcap is :)

Or to be more specific : it is a library that provides you an interface to sniff network traffic.
0
 
xNejXAuthor Commented:
Thank you guys, I'll look more into it.
0
 
fx23Commented:
You can also use wrappers to WinPcap that are written in C++ and are easier to use. One that I can recommend is PcapPlusPlus: https://github.com/seladb/PcapPlusPlus
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now