Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Code to capture and send ip packets

Code to capture and send ip packets

Scheduled Pinned Locked Moved C / C++ / MFC
c++
5 Posts 3 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_16391238
    wrote on last edited by
    #1

    Hello I am looking for c++ code to capture all the ip packets. I want to capture the original packet not taking a copy from this packet. In other words I don’t want windows to capture this packet. My program should be the only entity that will read this packet.

    L 1 Reply Last reply
    0
    • M Member_16391238

      Hello I am looking for c++ code to capture all the ip packets. I want to capture the original packet not taking a copy from this packet. In other words I don’t want windows to capture this packet. My program should be the only entity that will read this packet.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      In that case you will need to write a network driver and install it in the kernel. And it is unlikely that anyone here will offer to help you as code such as you describe is exactly the sort of thing that hackers and scammers would use.

      M 1 Reply Last reply
      0
      • L Lost User

        In that case you will need to write a network driver and install it in the kernel. And it is unlikely that anyone here will offer to help you as code such as you describe is exactly the sort of thing that hackers and scammers would use.

        M Offline
        M Offline
        Member_16391238
        wrote on last edited by
        #3

        Thank you for your reply. As a mater of fact this would s an academic project next o am trying to do to write a small firewall. What if rephrase the question to lookf or to capture frames from NIC?

        L J 2 Replies Last reply
        0
        • M Member_16391238

          Thank you for your reply. As a mater of fact this would s an academic project next o am trying to do to write a small firewall. What if rephrase the question to lookf or to capture frames from NIC?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Well either way this is a research issue. You should google for likely candidates of sample code to help to do what you want. There are already applications available that can capture the internet packets (e.g. Wireshark · Go Deep[^] ), and maybe that would be a good place to start.

          1 Reply Last reply
          0
          • M Member_16391238

            Thank you for your reply. As a mater of fact this would s an academic project next o am trying to do to write a small firewall. What if rephrase the question to lookf or to capture frames from NIC?

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            Member 16391238 wrote:

            What if rephrase the question to lookf or to capture frames from NIC?

            And then what? How do you view them? How do you collect them? You are going to need more than just that.

            Member 16391238 wrote:

            an academic project

            This is going to be a complex project. FIRST, you would need to learn how to write a driver, and driver. And figure out how to do it for the target OS. Either Windows or Linux. Then you would need to find a NIC that you can actually find internal documentation for. So you can access it. Following is the layers you would be looking to replace. And it took me a bit to even find that diagram. The Internet Protocol Stack[^] I suspect you would need to create a IP layer. I think you can do that these days with C++. However you are going to need to really understand how linking works and API interfaces. And probably a bit of hardware knowledge also. It will likely also require special compilation macros to insure that your API is constructed correctly. Internally you might be able to use OO but for the API methods they will not be class methods. It is possible that one of the small hobby computers (like 'Basic Stamp') might be workable mainly because it might be easier to find hardware details. But with that you are then also going to learn how to use that and to create binaries for it.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups