How do I hook the TCP stack in Windows to sniff and modify packets?

后端 未结 7 1417
没有蜡笔的小新
没有蜡笔的小新 2021-01-31 22:44

I\'d like to write a packet sniffer and editor for Windows. I want to able to see the contents of all packets entering and leaving my system and possibly modify them. Any lang

7条回答
  •  没有蜡笔的小新
    2021-01-31 23:01

    There's a question you need to ask which you don't know you need to ask; do you want to know which applications sockets belong to? or are you happy to be restricted to the IP:port quad for a connection?

    If you want to know applications, you need to write a TDI filter driver, but that makes handling the receive almost impossible, since you can't block on the receive path.

    If you're happy with IP:port, go in at the NDIS level, and I believe you can block on receive to your hearts content.

    A word of warning; if you have no prior kernel experience, writing either of these drivers (although TDI is significantly harder) will take about two years, full time.

提交回复
热议问题